Setuptools: 50.0.0 Broken?

Created on 31 Aug 2020  路  6Comments  路  Source: pypa/setuptools

This is taken from our CI builds.

21:30:11         nox > Creating virtualenv using python3 in .nox/runtests-parametrized-3-coverage-true-crypto-none-transport-tcp
21:30:16         nox > Command python -cimport sys; from distutils.sysconfig import get_python_lib; sys.stdout.write(get_python_lib()) failed with exit code 1:
21:30:16         Traceback (most recent call last):
21:30:16           File "<string>", line 1, in <module>
21:30:16           File "<frozen importlib._bootstrap>", line 969, in _find_and_load
21:30:16           File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
21:30:16           File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
21:30:16           File "<frozen importlib._bootstrap>", line 577, in module_from_spec
21:30:16           File "/tmp/kitchen/testing/.nox/runtests-parametrized-3-coverage-true-crypto-none-transport-tcp/lib/python3.5/site-packages/_distutils_hack/__init__.py", line 82, in create_module
21:30:16             return importlib.import_module('._distutils', 'setuptools')
21:30:16           File "/tmp/kitchen/testing/.nox/runtests-parametrized-3-coverage-true-crypto-none-transport-tcp/lib/python3.5/importlib/__init__.py", line 126, in import_module
21:30:16             return _bootstrap._gcd_import(name[level:], package, level)
21:30:16           File "<frozen importlib._bootstrap>", line 981, in _gcd_import
21:30:16           File "<frozen importlib._bootstrap>", line 931, in _sanity_check
21:30:16         SystemError: Parent module 'setuptools' not loaded, cannot perform relative import
duplicate

Most helpful comment

I can confirm this. We have the same issue.

A simple way to reproduce:

python3 -m venv env
./env/bin/pip install "setuptools == 50.0.0"
./env/bin/python -c "import distutils"

I am in the process of blacklisting 50.0.0 in our dependencies using setuptools != 50.0.0 in our dependencies.

All 6 comments

I can confirm this. We have the same issue.

A simple way to reproduce:

python3 -m venv env
./env/bin/pip install "setuptools == 50.0.0"
./env/bin/python -c "import distutils"

I am in the process of blacklisting 50.0.0 in our dependencies using setuptools != 50.0.0 in our dependencies.

Similar issue here, broken requirements.txt:

```requirements.txt
setuptools
git+https://github.com/taspinar/twitterscraper.git#egg=twitterscraper

Disallowing v50.0.0 fixes the problem for me:

```diff
-setuptools
+setuptools!=50.0.0
 git+https://github.com/taspinar/twitterscraper.git#egg=twitterscraper

I'm unable to replicate the issue on Python 3.8 and Python 3.6 on macOS. I don't yet know what factors cause the failure.

(also Python 3.5)

Same issue is seen with django-autocomplete-light in the context of ModuleNotFoundError: No module named 'dal' in an Ubuntu 18.04 context using Python 3.6

Edit: The ENV variable method as mentioned in #2350 shows promise in Docker:

ENV SETUPTOOLS_USE_DISTUTILS stdlib

However, I'm still determining what effect this has (is it using ancient setuptools 39.x that comes with Ubuntu 18.04?)

More discussion here as well: https://github.com/pypa/pip/issues/8761

I suspect this issue is the same as #2352. The error message is the same, so assuming so unless I hear otherwise.

Was this page helpful?
0 / 5 - 0 ratings