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

pip-sync --python-executable evaluates markers for the wrong environment #2115

Open
gschaffner opened this issue Jul 24, 2024 · 0 comments · May be fixed by #2116
Open

pip-sync --python-executable evaluates markers for the wrong environment #2115

gschaffner opened this issue Jul 24, 2024 · 0 comments · May be fixed by #2116
Labels
bug Something is not working markers Related to environment markers sync

Comments

@gschaffner
Copy link
Member

pip-sync --python-executable evaluates environment markers for the wrong environment. It evaluates for the calling environment instead of the target environment.

Environment Versions

  1. OS Type: Arch Linux
  2. Python version: multiple required to repro; see below
  3. pip version: 24.1.2
  4. pip-tools version: 7.4.1

Steps to replicate

Minimal reproducer:

#!/usr/bin/env bash

shopt -s inherit_errexit
set -o errexit -o errtrace -o nounset -o pipefail -o xtrace

cd "$(mktemp -d)"

:
python3.12 -m venv --upgrade-deps .venv312
.venv312/bin/python -V
.venv312/bin/pip install --quiet pip-tools
.venv312/bin/pip-sync --version
.venv312/bin/pip --version

:
python3.11 -m venv --upgrade-deps .venv311
.venv311/bin/python -V
.venv311/bin/pip uninstall --quiet --yes setuptools
.venv311/bin/pip --version

:
<<EOF cat > req.pipreq
typing-extensions==4.12.2 ; python_version < "3.12"
EOF
.venv312/bin/pip-sync --python-executable=.venv311/bin/python req.pipreq
.venv311/bin/python -c 'import typing_extensions'

Output:

++ mktemp -d
+ cd /tmp/tmp.0EtEvbDhIl
+ :
+ python3.12 -m venv --upgrade-deps .venv312
+ .venv312/bin/python -V
Python 3.12.4
+ .venv312/bin/pip install --quiet pip-tools
+ .venv312/bin/pip-sync --version
pip-sync, version 7.4.1
+ .venv312/bin/pip --version
pip 24.1.2 from /tmp/tmp.0EtEvbDhIl/.venv312/lib/python3.12/site-packages/pip (python 3.12)
+ :
+ python3.11 -m venv --upgrade-deps .venv311
+ .venv311/bin/python -V
Python 3.11.9
+ .venv311/bin/pip uninstall --quiet --yes setuptools
+ .venv311/bin/pip --version
pip 24.1.2 from /tmp/tmp.0EtEvbDhIl/.venv311/lib/python3.11/site-packages/pip (python 3.11)
+ :
+ cat
+ .venv312/bin/pip-sync --python-executable=.venv311/bin/python req.pipreq
Everything up-to-date
+ .venv311/bin/python -c 'import typing_extensions'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'typing_extensions'

Expected result

pip-sync installs typing_extensions.

Actual result

pip-sync exits 0 without installing typing_extensions (Everything up-to-date).

@gschaffner gschaffner added bug Something is not working markers Related to environment markers sync labels Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working markers Related to environment markers sync
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant