Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

danjgo-admin fails with "ModuleNotFoundError: No module named 'pkg_resources'" #68479

Closed
peti opened this issue Sep 11, 2019 · 4 comments
Closed
Labels
0.kind: regression Something that worked before working no longer 6.topic: python
Milestone

Comments

@peti
Copy link
Member

peti commented Sep 11, 2019

The GNU Mailman django project has stopped working in current versions of master. When I run it in b425012, I get the following error:

Traceback (most recent call last):
  File "/nix/store/has52f9ds9cf95vb6d8pwfbpr3190qnj-python3.7-Django-1.11.24/bin/..django-admin-wrapped-wrapped", line 12, in <module>
    sys.exit(execute_from_command_line())
  File "/nix/store/049xih271v339wm1hdvlf5xv6vqm39dx-python3-3.7.4-env/lib/python3.7/site-packages/django/core/management/__init__.py", line 364, in
 execute_from_command_line
    utility.execute()
  File "/nix/store/049xih271v339wm1hdvlf5xv6vqm39dx-python3-3.7.4-env/lib/python3.7/site-packages/django/core/management/__init__.py", line 338, in execute
    django.setup()
  File "/nix/store/049xih271v339wm1hdvlf5xv6vqm39dx-python3-3.7.4-env/lib/python3.7/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/nix/store/049xih271v339wm1hdvlf5xv6vqm39dx-python3-3.7.4-env/lib/python3.7/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/nix/store/049xih271v339wm1hdvlf5xv6vqm39dx-python3-3.7.4-env/lib/python3.7/site-packages/django/apps/config.py", line 94, in create
    module = import_module(entry)
  File "/nix/store/k0igqpz995nmxwf6piyd5jjpcc7gcnyc-python3-3.7.4/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/nix/store/049xih271v339wm1hdvlf5xv6vqm39dx-python3-3.7.4-env/lib/python3.7/site-packages/haystack/__init__.py", line 7, in <module>
    from pkg_resources import DistributionNotFound, get_distribution, parse_version
ModuleNotFoundError: No module named 'pkg_resources'

The same commands succeeds fine in the older 8136744.

The error can be reproduced as follows:

  1. Check out the branch t/mailmain from https://github.com/peti/nixpkgs.
  2. cd pkgs/servers/mail/mailman
  3. sed -e s/@ALLOWED_HOSTS@// settings.py >tmp.py
  4. nix-shell -p 'python3.withPackages (x: with x; [postorius hyperkitty])' --run 'django-admin collectstatic --pythonpath $PWD --settings tmp'

Ping: @FRidh

@peti peti added 6.topic: python 0.kind: regression Something that worked before working no longer labels Sep 11, 2019
@peti
Copy link
Member Author

peti commented Sep 11, 2019

According to git bisect, the commit that broke this build is f7e28bf by @FRidh.

@FRidh
Copy link
Member

FRidh commented Sep 11, 2019

See #68314. setuptools is no longer implicitly included. Unfortunately this can only be detected at run-time

@FRidh
Copy link
Member

FRidh commented Sep 11, 2019

in this case the package haystack needs to have setuptools.

@peti
Copy link
Member Author

peti commented Sep 11, 2019

OK. Thank you for the pointer. I suppose more explicit dependencies are a good thing albeit less convenient. I'll test whether that change fixes the issue and push a fix if it does.

@FRidh FRidh added this to the 19.09 milestone Sep 11, 2019
@peti peti closed this as completed in b57f25a Sep 11, 2019
peti added a commit that referenced this issue Sep 11, 2019
…puts

As a side-effect of f7e28bf, the build
no longer propagated 'setuptools', which is a run-time dependency. See
#68314 for further details.

Fixes #68479.

(cherry picked from commit b57f25a)
matthuszagh pushed a commit to matthuszagh/nixpkgs that referenced this issue Sep 24, 2019
…puts

As a side-effect of f7e28bf, the build
no longer propagated 'setuptools', which is a run-time dependency. See
NixOS#68314 for further details.

Fixes NixOS#68479.
dtzWill pushed a commit to dtzWill/nixpkgs that referenced this issue Oct 23, 2019
…puts

As a side-effect of f7e28bf, the build
no longer propagated 'setuptools', which is a run-time dependency. See
NixOS#68314 for further details.

Fixes NixOS#68479.

(cherry picked from commit b57f25a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: regression Something that worked before working no longer 6.topic: python
Projects
None yet
Development

No branches or pull requests

2 participants