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
ensurepip fails if cwd contains illformed setup.cf #86216
Comments
If the current directory contains a ill-formed setup.cfg, setting up a virtual env fails, caused by ensurepip failing: Expected behaviour: How to reproduce: $ rm -rf /tmp/v2
$ mkdir /tmp/v2
$ cd /tmp/v2
$ cat > setup.cfg <<EOF
> [options]
> setuptools_requires
> EOF
$ python3 -m venv /tmp/v2/_venv
Error: Command '['/tmp/v2/_venv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 2.
$ /tmp/v2/_venv/bin/python3 -Im ensurepip --upgrade --default-pip
Looking in links: /tmp/tmpimoh6tke
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Exception:
…
configparser.ParsingError: Source contains parsing errors: 'setup.cfg'
[line 2]: 'setuptools_requires\n' Environment: |
Just wanted to say, I ran into this while using direnv. See the issue I opened before knowing of this one: https://bugs.python.org/issue43038 |
I'm unable to reproduce this on 3.12. Since (according to https://bugs.python.org/issue43038) it is related to distutils, it may no longer be relevant. |
This is related to pip's usage of distutils as the source of truth for figuring out where to install things (i.e. "locations"). Starting Python 3.10, pip now uses sysconfig for that, which means that it won't try using the code path that invoked distutils to trigger this crash. The relevant portion of pip's codebase is https://github.com/pypa/pip/tree/22.3.1/src/pip/_internal/locations ( |
So this issue is out date? |
Given that 3.7, 3.8 and 3.9 are in a security-fix status, I don't think we're gonna be fixing/changing the behaviour of distutils for this case. 3.10+ aren't affected unless CPython is patched by a downstream redistributor. This would've been the first time I'm gonna click close on an issue on CPython with my "new" triage permissions. But, I'm gonna be cautious and avoid doing things wrong -- and defer to a core dev or another triager to close this. :) |
Closing on @pradyunsg's recommendation :) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: