Skip to content
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

Special case pip entrypoint names #1593

Closed
woutervh opened this issue Feb 17, 2024 · 11 comments · Fixed by #1918 or #1982
Closed

Special case pip entrypoint names #1593

woutervh opened this issue Feb 17, 2024 · 11 comments · Fixed by #1918 or #1982
Assignees
Labels
bug Something isn't working virtualenv Related to virtual environments

Comments

@woutervh
Copy link

woutervh commented Feb 17, 2024

on Alma Linux 9.2, using uv 0.1.3
python3.x all installed via pyenv

 > venv foo -p 3.8 --seed
  Using Python 3.8.18 interpreter at /opt/tools/pyenv/var/repo/versions/3.8.18/bin/python3.8
  Creating virtualenv at: foo
   + setuptools==69.1.0
   + pip==24.0
   + wheel==0.42.0

> ls -al foo/bin
    activate*  
    pip  
    pip3  
    pip3.10      <-- should be pip3.8
    python  
    python3   
    python3.8 

the pip / pip3 / pip3.10 are all identical and correct,
so it's just an incorrect filename.

all other versions also create a pip3.10:

 > venv foo -p 3.9 --seed
 > venv foo -p 3.11 --seed
 > venv foo -p 3.12 --seed
@zanieb zanieb added the bug Something isn't working label Feb 17, 2024
@zanieb
Copy link
Member

zanieb commented Feb 17, 2024

Thanks for the report! No idea why this would be.

@henryiii
Copy link
Contributor

Isn't that -p?

@woutervh
Copy link
Author

@henryiii , Yes, corrected.

@woutervh woutervh changed the title venv foo p 3.8 --seed generates a pip3.10 executable venv foo -p 3.8 --seed generates a pip3.10 executable Feb 17, 2024
@zanieb zanieb added the virtualenv Related to virtual environments label Feb 18, 2024
@charliermarsh
Copy link
Member

My guess is that it's a caching issue. We cache interpreter metadata using the ctime, to avoid having to run the Python interpreter on every invocation (which is expensive, in a relative sense). Perhaps the ctime isn't changing here?

@charliermarsh
Copy link
Member

Err wait, sorry -- so it creates a file named pip3.10, but pip3.10 is actually pip3.8?

@woutervh
Copy link
Author

woutervh commented Feb 20, 2024

There is no version info in the pip-entrypoint.

> cat pip | pip3 | pip3.10

#!/tmp/foo/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from pip._internal.cli.main import main
if __name__ == "__main__":
    sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
    sys.exit(main())

@konstin
Copy link
Member

konstin commented Feb 20, 2024

pip has an entrypoint pip3.10 in its wheel: https://files.pythonhosted.org/packages/8a/6a/19e9fe04fca059ccf770861c7d5721ab4c2aebc539889e97c7977528a53b/pip-24.0-py3-none-any.whl. I think you're supposed to special case pip entrypoints (pypa/pip#11547)?

@konstin
Copy link
Member

konstin commented Feb 20, 2024

@konstin konstin changed the title venv foo -p 3.8 --seed generates a pip3.10 executable Special case pip entrypoint names Feb 20, 2024
@henryiii
Copy link
Contributor

@charliermarsh
Copy link
Member

@konstin - Do you mind taking this one?

@konstin konstin self-assigned this Feb 20, 2024
konstin added a commit that referenced this issue Feb 23, 2024
Users expect pip to have `pip`, `pip3` and `pip3.x` entrypoints. But pip is a universal wheel, so it contains the `pip3.x` entrypoint where it was built on. To fix this, pip special cases itself when installing (https://github.com/pypa/pip/blob/3898741e29b7279e7bffe044ecfbe20f6a438b1e/src/pip/_internal/operations/install/wheel.py#L283), replacing the wheel entrypoint with one for the current version. We now do the same.

Fixes #1593
konstin added a commit that referenced this issue Feb 23, 2024
Users expect pip to have `pip`, `pip3` and `pip3.x` entrypoints. But pip
is a universal wheel, so it contains the `pip3.x` entrypoint where it
was built on. To fix this, pip special cases itself when installing
(https://github.com/pypa/pip/blob/3898741e29b7279e7bffe044ecfbe20f6a438b1e/src/pip/_internal/operations/install/wheel.py#L283),
replacing the wheel entrypoint with one for the current version. We now
do the same.

Fixes #1593
@konstin
Copy link
Member

konstin commented Feb 23, 2024

Reopening because the upstream fix breaks my workaround: pypa/pip#12536

@konstin konstin reopened this Feb 23, 2024
konstin added a commit that referenced this issue Feb 26, 2024
Update #1918 to handle pypa/pip#12536, where pip removed their python minor entrypoints.

Closes #1593.
konstin added a commit that referenced this issue Feb 26, 2024
Update #1918 to handle pypa/pip#12536, where pip removed their python minor entrypoints.

Closes #1593.
konstin added a commit that referenced this issue Feb 28, 2024
Update #1918 to handle pypa/pip#12536, where pip removed their python minor entrypoints.

Closes #1593.
konstin added a commit that referenced this issue Mar 1, 2024
Update #1918 to handle pypa/pip#12536, where pip
removed their python minor entrypoint. The pip test is semi-functional
since it builds pip from source instead of using a wheel with the wrong
entrypoint, we have to update it when this pip version has a release.

Closes #1593.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working virtualenv Related to virtual environments
Projects
None yet
5 participants