uv icon indicating copy to clipboard operation
uv copied to clipboard

Special case pip entrypoint names

Open woutervh opened this issue 1 year ago • 11 comments

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

woutervh avatar Feb 17 '24 14:02 woutervh

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

zanieb avatar Feb 17 '24 16:02 zanieb

Isn't that -p?

henryiii avatar Feb 17 '24 17:02 henryiii

@henryiii , Yes, corrected.

woutervh avatar Feb 17 '24 18:02 woutervh

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 avatar Feb 20 '24 02:02 charliermarsh

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

charliermarsh avatar Feb 20 '24 02:02 charliermarsh

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())

woutervh avatar Feb 20 '24 17:02 woutervh

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 (https://github.com/pypa/pip/pull/11547)?

konstin avatar Feb 20 '24 18:02 konstin

The pip discord pointed me to https://github.com/pypa/pip/blob/3898741e29b7279e7bffe044ecfbe20f6a438b1e/src/pip/_internal/operations/install/wheel.py#L283, we should special case pip.

konstin avatar Feb 20 '24 18:02 konstin

Better link imo: https://inspector.pypi.io/project/pip/24.0/packages/8a/6a/19e9fe04fca059ccf770861c7d5721ab4c2aebc539889e97c7977528a53b/pip-24.0-py3-none-any.whl/pip-24.0.dist-info/entry_points.txt

henryiii avatar Feb 20 '24 18:02 henryiii

@konstin - Do you mind taking this one?

charliermarsh avatar Feb 20 '24 18:02 charliermarsh

Reopening because the upstream fix breaks my workaround: https://github.com/pypa/pip/pull/12536

konstin avatar Feb 23 '24 22:02 konstin