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.

ModuleNotFoundError: No module named 'pkg_resources'

See original GitHub issue

The docker environment where we run our tests has been failing since yesterday morning (10th February) with a ModuleNotFoundError: No module named 'pkg_resources' error.

After some investigation, we noticed it upgraded setuptools to version 45.2.0 on that morning.

Downgrading setuptools to 45.1.0 fixed our issue, and everything is working as expected again.

There might have been some change in 45.2.0 that triggered this issue. Let me know what other information I can provide.

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 338, in execute
    django.setup()
  File "/venv/lib/python3.6/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/venv/lib/python3.6/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/venv/lib/python3.6/site-packages/django/apps/config.py", line 94, in create
    module = import_module(entry)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/venv/lib/python3.6/site-packages/nested_admin/__init__.py", line 10, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:7
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ineesalmeidacommented, Feb 11, 2020

We found out that using the inbuilt venv instead of virtualenv (using setuptools 45.2.0) actually also worked

0reactions
abravalhericommented, Sep 2, 2022

Hi @alexscott-ff , could you please share with us a minimal reproducible example that demonstrates a (simplied) situation when this error happens (as mentioned by Jason)?

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 >
No module named 'pkg_resources' in Python | bobbyhadz
The Python "No module named 'pkg_resources'" occurs when setuptools is not installed in our Python environment. To solve the error, ...
Read more >
No module named 'pkg_resources' when installing ... - GitHub
Hi. I'm getting the error below both on Python 3.10.0 and 3.9.7, only on this mirrors-prettier repo. [INFO] Installing environment for ...
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 >
ImportError: No module named pkg_resources - Ask Ubuntu
pkg_resources is a dependency of setuptools. Open the terminal and type: sudo apt install --reinstall python3-pkg-resources ...
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