[Distutils] Critical: PR for packaging.specifiers not found issue

Andrey Galkin andrey at futoin.org
Fri Mar 10 17:25:06 EST 2017


Can someone please take a look at https://github.com/pypa/setuptools/pull/990 ?

Previously, the issue was reported by another user and then rejected:
https://github.com/pypa/setuptools/issues/967

The problem is reproducible on both Python 2.7.13 and 3.5.3 shipped in
Debian Stretch.
Yes, it's not yet visible in other OSes including Ubuntu with previous
patch versions of 2.7 & 3.5.

I believe it's related to this change:
bpo-27419: Standard __import__() no longer look up “__import__” in
globals or builtins for importing submodules or “from import”. Fixed
handling an error of non-string package name.
https://bugs.python.org/issue27419

The packaging module does not export specifiers in __init__.py.
It can be easily triggered with "pip -e source_dir".

I can confirm the issue gets vanished once PR with one-liner is
applied to latest setuptools located in virtualenv.

Error output:
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/vagrant/setup.py", line 67, in <module>
        setup(**config)
      File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/home/vagrant/.virtualenv-2.7/local/lib/python2.7/site-packages/setuptools/dist.py",
line 320, in __init__
        _Distribution.__init__(self, attrs)
      File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
        self.finalize_options()
      File "/home/vagrant/.virtualenv-2.7/local/lib/python2.7/site-packages/setuptools/dist.py",
line 387, in finalize_options
        ep.load()(self, ep.name, value)
      File "/home/vagrant/.virtualenv-2.7/local/lib/python2.7/site-packages/setuptools/dist.py",
line 166, in check_specifier
        except packaging.specifiers.InvalidSpecifier as error:
    AttributeError: 'module' object has no attribute 'specifiers'


    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "/home/vagrant/.virtualenv-3.5/lib/python3.5/site-packages/setuptools/dist.py",
line 165, in check_specifier
        packaging.specifiers.SpecifierSet(value)
    AttributeError: module 'packaging' has no attribute 'specifiers'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/vagrant/setup.py", line 67, in <module>
        setup(**config)
      File "/usr/lib/python3.5/distutils/core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "/home/vagrant/.virtualenv-3.5/lib/python3.5/site-packages/setuptools/dist.py",
line 320, in __init__
        _Distribution.__init__(self, attrs)
      File "/usr/lib/python3.5/distutils/dist.py", line 281, in __init__
        self.finalize_options()
      File "/home/vagrant/.virtualenv-3.5/lib/python3.5/site-packages/setuptools/dist.py",
line 387, in finalize_options
        ep.load()(self, ep.name, value)
      File "/home/vagrant/.virtualenv-3.5/lib/python3.5/site-packages/setuptools/dist.py",
line 166, in check_specifier
        except packaging.specifiers.InvalidSpecifier as error:
    AttributeError: module 'packaging' has no attribute 'specifiers'


More information about the Distutils-SIG mailing list