pypa / pypa/setuptools

ModuleNotFoundError: No module named 'pkg_resources'

Open
#1,990 7 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Waiting User Feedback
Dominant language
Python
Stars
2.9k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

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'

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure in the Docker test environment, starting with manage.py and the import in nested_admin/init.py shown in the traceback. Compare setuptools 45.2.0 with 45.1.0 and determine what prevents pkg_resources from being imported. Done means the test environment starts successfully without the ModuleNotFoundError.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, docker, python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.