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

[BUG] PR #3061 breaks zip importing with "ImportError: The 'jaraco' package is required;" #3084

Closed
asottile opened this issue Feb 5, 2022 · 2 comments
Labels

Comments

@asottile
Copy link
Contributor

asottile commented Feb 5, 2022

setuptools version

60.7.1

Python version

3.8.10

OS

ubuntu 20.04

Additional environment information

n/a

Description

this breaks virtualenv (and others as it seems from Nuitka/Nuitka#1406) https://github.com/pypa/virtualenv/runs/5077580857?check_suite_focus=true

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/pytest-of-asottile/pytest-1/test_zip_importer_can_import_s0/site-packages.zip/setuptools/__init__.py", line 16, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/pytest-of-asottile/pytest-1/test_zip_importer_can_import_s0/site-packages.zip/setuptools/version.py", line 1, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/pytest-of-asottile/pytest-1/test_zip_importer_can_import_s0/site-packages.zip/pkg_resources/__init__.py", line 74, in <module>
  File "/tmp/pytest-of-asottile/pytest-1/test_zip_importer_can_import_s0/site-packages.zip/pkg_resources/extern/__init__.py", line 52, in create_module
  File "/tmp/pytest-of-asottile/pytest-1/test_zip_importer_can_import_s0/site-packages.zip/pkg_resources/extern/__init__.py", line 44, in load_module
ImportError: The 'jaraco' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.

via this subprocess call

E           subprocess.CalledProcessError: Command '['/tmp/pytest-of-asottile/pytest-1/test_zip_importer_can_import_s0/venv/bin/python', '-c', 'from setuptools.dist import Distribution']' returned non-zero exit status 1.

note that this is exercising the zipimporter, so this likely breaks zip importing

Expected behavior

not crashing

How to Reproduce

$ PYTHONPATH=setuptools-60.7.1-py3-none-any.whl python -c 'from setuptools import dist'

Output

$ PYTHONPATH=setuptools-60.7.1-py3-none-any.whl python -c 'from setuptools import dist'
Error processing line 1 of /tmp/y/virtualenv/venv/lib/python3.8/site-packages/distutils-precedence.pth:

  Traceback (most recent call last):
    File "/usr/lib/python3.8/site.py", line 175, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  AttributeError: module '_distutils_hack' has no attribute 'ensure_shim'

Remainder of file ignored
Error processing line 1 of /tmp/y/virtualenv/venv/lib/python3.8/site-packages/distutils-precedence.pth:

  Traceback (most recent call last):
    File "/usr/lib/python3.8/site.py", line 175, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
  AttributeError: module '_distutils_hack' has no attribute 'ensure_shim'

Remainder of file ignored
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/y/virtualenv/setuptools-60.7.1-py3-none-any.whl/setuptools/__init__.py", line 16, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/y/virtualenv/setuptools-60.7.1-py3-none-any.whl/setuptools/version.py", line 1, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/tmp/y/virtualenv/setuptools-60.7.1-py3-none-any.whl/pkg_resources/__init__.py", line 74, in <module>
  File "/tmp/y/virtualenv/setuptools-60.7.1-py3-none-any.whl/pkg_resources/extern/__init__.py", line 52, in create_module
  File "/tmp/y/virtualenv/setuptools-60.7.1-py3-none-any.whl/pkg_resources/extern/__init__.py", line 44, in load_module
ImportError: The 'jaraco' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.
@asottile asottile added bug Needs Triage Issues that need to be evaluated for severity and status. labels Feb 5, 2022
@jaraco
Copy link
Member

jaraco commented Feb 6, 2022

I suspect the issue here is that jaraco is a namespace package and that the zip importer doesn't support namespace packages in subpackages but the standard importer does, and all the tests rely on the standard importer. Should be an easy fix.

@jaraco jaraco removed the Needs Triage Issues that need to be evaluated for severity and status. label Feb 6, 2022
@jaraco jaraco closed this as completed in 8afd3a3 Feb 6, 2022
@jaraco
Copy link
Member

jaraco commented Feb 6, 2022

Fix releasing with 60.8.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants