<#21716 python export version in dirname does not ...
# github-notifications
c
#21716 python export version in dirname does not always match reality Issue created by cburroughs Describe the bug In the example-python repository with
interpreter_constraints = ["==3.11.*"]
Copy code
$ pants export --resolve=python-default
15:32:39.29 [INFO] Initialization options changed: reinitializing scheduler...
15:32:39.49 [INFO] Initializing Nailgun pool for 16 processes...
15:32:41.48 [INFO] Scheduler initialized.
/home/ecsb/.cache/pants/named_caches/pex_root/installed_wheels/0d74a0c79aa366e646d6e0f55dfbb91dde26ea01fbfee6178871d92a8018c0ca/pex-2.16.2-py2.py3-none-any.whl/pex/venv/installer.py:131: PEXWarning: You asked for --pip to be installed in the venv at /home/ecsb/src/o/example-python/dist/export/python/virtualenvs/python-default/3.11.9,
but the PEX at /home/ecsb/src/o/example-python/dist/export/python/virtualenvs/python-default/3.11.9/.4b4ae2fdd23744428b0f18f348f92998.tmp/python-default.pex already contains:
setuptools 56.2
Uninstalling venv versions and using versions from the PEX.
  pex_warnings.warn(
Found existing installation: setuptools 74.1.3
Uninstalling setuptools-74.1.3:
  Successfully uninstalled setuptools-74.1.3
Wrote mutable virtualenv for python-default (using Python 3.11.9) to dist/export/python/virtualenvs/python-default/3.11.9
$ dist/export/python/virtualenvs/python-default/3.11.9/bin/python
Python 3.11.10 (main, Nov 11 2024, 20:28:02) [GCC 13.3.1 20241024] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
And when running the Pants tests:
Copy code
>               assert ppc0.argv[3:7] == (
                    "venv",
                    "--pip",
                    "--collisions-ok",
                    f"--prompt={resolve}/{current_interpreter}",
                )
E               AssertionError: assert equals failed
E                 (                                (                               
E                   'venv',                          'venv',                       
E                   '--pip',                         '--pip',                      
E                   '--collisions-ok',               '--collisions-ok',            
E                   '--prompt=a/3.11.9',             '--prompt=a/3.11.10',         
E                 )                                )

src/python/pants/backend/python/goals/export_test.py:158: AssertionError
Pants version
2.23.0
and
main
OS Linux Additional info I started out thinking we needed to include the minor version or something in the cache key, but I see we are already hashing the entire Python binary. Cache scope last changed in #17207 broader discussion in #10769 (but as I said I think the hashing should already cover this.) pantsbuild/pants