-
-
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] latest setuptools release (60.3.0) broke pip? #3002
Comments
Seen by @matthewfeickert and I as well. https://twitter.com/HEPfeickert/status/1478923370083545089 |
@jaraco if you happen to see this before you go offline till tomorrow, would it be worth yanking 60.3.0 off PyPI? |
Something worth noting perhaps is that what is broken is explicitly You can break $ docker run --rm -ti python:3.9 /bin/bash
root@767f3d487c7b:/# python -m venv venv && . venv/bin/activate && python -m pip --quiet install --upgrade setuptools && python -m pip list
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/venv/bin/python -m pip install --upgrade pip' command.
/venv/bin/python: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
(venv) root@767f3d487c7b:/# pip list
Package Version
---------- -------
pip 21.2.4
setuptools 60.3.0
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/venv/bin/python -m pip install --upgrade pip' command.
(venv) root@767f3d487c7b:/# pip install --upgrade pip
Requirement already satisfied: pip in /venv/lib/python3.9/site-packages (21.2.4)
Collecting pip
Downloading pip-21.3.1-py3-none-any.whl (1.7 MB)
|████████████████████████████████| 1.7 MB 3.1 MB/s
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.2.4
Uninstalling pip-21.2.4:
Successfully uninstalled pip-21.2.4
Successfully installed pip-21.3.1
(venv) root@767f3d487c7b:/# pip list
Package Version
---------- -------
pip 21.3.1
setuptools 60.3.0
(venv) root@767f3d487c7b:/# python -m pip list
/venv/bin/python: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__') |
Notably, work around bug in latest setuptools release. Ref: pypa/setuptools#3002
It seems the offending commit is likely 41fa663. $ python
Python 3.8.6 (default, Oct 28 2020, 19:59:21)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import __main__
>>> __main__.__file__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module '__main__' has no attribute '__file__' Edit: cross-ref discussion at #2993 as well. |
Experiencing this as well. Pinning to the previous setuptools gets around this issue until this is fixed:
|
Yanked 60.3.0. |
This caused some massive disruption (yikes!). I'd put too much faith in the test suite, which missed a crucial code path. The fix includes a regression test to ensure this code path is exercised and this issue doesn't happen again. |
I still have this broken and yanked version being installed in a fresh environment, when creating a virtualenv. Any idea why? Running On Debian Buster, it seems that setting |
Any chance your CI job is accessing a package index that has a cache? |
I reproduce this at home with the |
Can you post here the commands/scripts you are using to reproduce this problem? |
|
By running strace, it seems to check the version on https://pypi.org/simple/setuptools/ and the yanked version is still present. |
Hi @Exagone313 I believe this issue is related to the fact that If you try running: apt install python3-pip
python3 -m pip install virtualenv
python3 -m virtualenv -p python3 foo You should not see this error.
If you inspect the HTML page you can see a My guess is that the package in the apt repository might be outdated and comes with old versions of |
A newer version should probably be released with a fix. Applying workarounds like |
Removing all caches and venvs that I know about did not solve my issue, |
Hi @lhupfeldt thank you very much for the feedback, setuptools is working in a new version and it should be available soon. Meanwhile, please consider the workaround previously discussed (i.e. installing the latest version of Please notice that using an outdated version of pip and virtualenv that are not able to handle the "yanked" metadata provided by the index server might interfere (and cause breakages) with other packages (not only setuptools). |
@abravalheri Thank you for the update. |
This change also breaks I have a similar problem as @lhupfeldt, but with AWS Code Artifact - it seems to be downloading 6.3.0 if the exact version is not specified, so it keeps coming back. |
Hi @delicb, would you have a way of reproducing this behaviour? When I tried to install It might be the case the index server/cache-proxy does not handle "yanked" versions very well... If that is true, it would be good to report these issues to them so they can also investigate (just try first updating virtualenv/pip and see if the problem persists...) I would kindly ask you to bear with us just for a bit, while the new version is not out. |
@abravalheri Thanks for the response. I understand this is 99% due to AWS Code Artifact. I can not share the project (closed source), but it is a very simple library with the following section in
With those lines, After setting As additional test, I have removed index URL from pip config (thus falling back to default PyPI, instead of AWS Code Artifact) and build is successful even when version is not explicitly set. So, it does look like it is AWS Code Artifact Problem (btw, I have tried deleting the 60.3.0 from codeartifact, but it just pops up again). You are right, I will try to report this problem to AWS. I can check if there is a way to "forbid" some package versions or something similar, but workaround with fixing a version to |
I am using Solution: I need to wait for a version >60.3.0. Until then, the gitlab CI job is broken |
Setuptools 60.3.1 is going out now. I chose not to release it last night because I wanted to be alert and around when it's released, just in case there are other high-impact issues associated. |
Also, please use |
CI Back to working, thanks everyone who contributed for the speedy fix |
In case anyone comes here because their cd $PIPX_HOME/shared
. bin/activate
curl -# -LO https://bootstrap.pypa.io/pip/get-pip.py
export SETUPTOOLS_USE_DISTUTILS=stdlib
python3 get-pip.py --ignore-installed
pip install --upgrade pip setuptools wheel
deactivate |
setuptools version
60.3.0
Python version
Python 3.10 (but also reproduces with other versions)
OS
macOS (but also reproduces in GitHub Actions CI using ubuntu-latest)
Additional environment information
No response
Description
The new version of setuptools that was just released seems to have broken pip? After upgrading to latest setuptools, running pip commands is now failing with an AttributeError.
Expected behavior
Pip continues to work after installing the latest release of setuptools, rather than raising AttributeError.
How to Reproduce
Install the latest release of setuptools (60.3.0), and then run a pip command like
pip list
.Output
Code of Conduct
The text was updated successfully, but these errors were encountered: