-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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] KeyError: '__file__' with setuptools 60.0.0 #2941
Comments
It seems that we have observed a similar crash on our CI: https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=36235&view=logs&jobId=aabdcdc3-bb64-5414-b357-ed024fe8659e&j=aabdcdc3-bb64-5414-b357-ed024fe8659e&t=08761b20-68b0-57e8-3399-a73e66658a1f Traceback: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/io/sklearn/utils/_show_versions.py", line 85, in show_versions
deps_info = _get_deps_info()
File "/io/sklearn/utils/_show_versions.py", line 69, in _get_deps_info
mod = importlib.import_module(modname)
File "/io/testvenv/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 963, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 906, in _find_spec
File "/io/testvenv/lib/python3.7/site-packages/_distutils_hack/__init__.py", line 83, in find_spec
return method()
File "/io/testvenv/lib/python3.7/site-packages/_distutils_hack/__init__.py", line 104, in spec_for_pip
if self.pip_imported_during_build():
File "/io/testvenv/lib/python3.7/site-packages/_distutils_hack/__init__.py", line 117, in pip_imported_during_build
for frame, line in traceback.walk_stack(None)
File "/io/testvenv/lib/python3.7/site-packages/_distutils_hack/__init__.py", line 117, in <genexpr>
for frame, line in traceback.walk_stack(None)
KeyError: '__file__' |
A simple snippet reproducing the problem: if [ -d /tmp/test-venv ]; then
rm -rf /tmp/test-venv
fi
python -m venv /tmp/test-venv
source /tmp/test-venv/bin/activate
pip install 'setuptools>=60'
pip list
python -c 'import importlib; importlib.import_module("pip")' A few comments:
|
This breaks python -m venv test-venv
test-venv/bin/python -m pip install 'setuptools>=60'
test-venv/bin/python -m ensurepip
|
The bug is occuring because setuptools bundled distutils that's breaking stuff. It was apparently only tested on Fedora #2896 Temporary workaround is setting |
Changing to ignore Happy to send a PR. |
This issue is pretty much a duplicate of #2940. |
Thanks, I can confirm 60.0.3 fixes the problem for the snippet I posted above. |
setuptools version
setuptools==60.0.0
Python version
Python 3.8.12
OS
Windows 10
Additional environment information
I use Anaconda with Python 3.8.12.
I use PyArmor 7.0.3.
I user PyInstaller 4.7.
Description
I use PyArmor to pack my project (Obfuscation + Executable with PyInstaller).
It is used inside a Conda Environment.
I have a script that calls PyArmor.
Expected behavior
To the project's Executable be properly generated.
How to Reproduce
Output
Code of Conduct
The text was updated successfully, but these errors were encountered: