question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Unable to import pkg_resources before setuptools

See original GitHub issue

setuptools version

60.9.3 (also affects the main branch)

Python version

Python 3.7 from PyPy 7.3.7

OS

macOS

Additional environment information

Using packages from conda-forge.

Description

Importing pkg_resources before setuptools results in setuptools being broken with AttributeError: module 'setuptools' has no attribute 'version'.

Expected behavior

The import order doesn’t matter.

How to Reproduce

> conda create -c conda-forge --name test setuptools pypy
> conda activate test
> python -c 'import setuptools, pkg_resources; print("All good")'
All good
> python -c 'import pkg_resources, setuptools; print("All good")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/cburr/mambaforge/envs/test/site-packages/setuptools/__init__.py", line 35, in <module>
    __version__ = setuptools.version.__version__
AttributeError: module 'setuptools' has no attribute 'version'

Output

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/cburr/mambaforge/envs/test/site-packages/setuptools/__init__.py", line 35, in <module>
    __version__ = setuptools.version.__version__
AttributeError: module 'setuptools' has no attribute 'version'

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
chrisburrcommented, Mar 12, 2022

I’ve opened an issue for PyPy: https://foss.heptapod.net/pypy/pypy/-/issues/3703

I’ll follow up here when there is a response.

0reactions
abravalhericommented, Mar 17, 2022

Hi Cris, yes! Thank you very much for spotting the problem and coordinating a solution with the PyPy team! ❤️ 💚 💛 💙

I can see that they are planning a release including the changes you proposed https://foss.heptapod.net/pypy/pypy/-/commit/a1b1b3169deb1d309c88c1ba3cfef6fb069ddc6a

Hopefully it will be out soon 🤞

Read more comments on GitHub >

github_iconTop Results From Across the Web

No module named pkg_resources - python - Stack Overflow
This error message is caused by a missing/broken Python setuptools package. Per Matt M.'s comment and setuptools issue #581, the bootstrap script referred ......
Read more >
1222389 – [abrt] python-pip: pip:5:<module>:ImportError: No ...
When you launch "sudo python", and then type "import pkg_resources" in the interactive interpreter, do you get a backtrace as well?
Read more >
The error was: ImportError: No module named pkg_resources
Hi,. I am new to the Koa deployment. I'm trying to install the builds (Koa.2, Koa.2a, Koa.Master), everything show different error each time ......
Read more >
Fix for 'ImportError: No module named pkg_resources' error
You will see this error when you try to install a PIP package. This error message means Python setuptools is missing or broken....
Read more >
setuptools-scm - PyPI
from pkg_resources import get_distribution, DistributionNotFound try: ... If this is unset (the default), setuptools_scm will error if it fails to detect ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found