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

sysconfig.get_path points to venv path when in build-isolation #12976

Open
1 task done
LecrisUT opened this issue Sep 24, 2024 · 0 comments
Open
1 task done

sysconfig.get_path points to venv path when in build-isolation #12976

LecrisUT opened this issue Sep 24, 2024 · 0 comments
Labels
S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior

Comments

@LecrisUT
Copy link

LecrisUT commented Sep 24, 2024

Description

This is an issue we've found in scikit-build-core 1 with @henryiii , where we were printing sysconfig.get_path("purelib") from within scikit-build-core scripts, which should be running within the build issolated environment. When running within build-isolation with pip installed in a venv then it points to the venv's site-packages folder. But when I run it indirectly with python3 -m build or using up pip install then it points to the correct build-isolation path only.

Expected behavior

sysconfig.get_path("purelib") should be printing the build-isolated site-packages: e.g. /tmp/build-env-z0u0zzpr/lib/python3.13/site-packages

pip version

24.2

Python version

3.x

OS

Fedora 41

How to Reproduce

Get any project that uses scikit-build-core and then try to build with verbose options to show the debug message:

$ git clone https://github.com/spglib/spglib
$ cd spglib
$ python3 -m venv venv
$ source venv/bin/activate
$ pip -v install . --config-settings=logging.level=DEBUG
$ pip install build uv
$ python3 -m build -v --config-setting=logging.level=DEBUG
$ uv pip -v install . --config-setting=logging.level=DEB

Output

Incorrect output:

  2024-09-24 15:45:25,744 - scikit_build_core - DEBUG - SITE_PACKAGES: /home/lecris/CLionProjects/spglib/venv/lib/python3.13/site-packages
  2024-09-24 15:45:25,744 - scikit_build_core - DEBUG - Extra SITE_PACKAGES: /tmp/pip-build-env-7al1zz2v/overlay/lib/python3.13/site-packages
  2024-09-24 15:45:25,744 - scikit_build_core - DEBUG - PATH: ['/home/lecris/CLionProjects/spglib/venv/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process', '/tmp/pip-build-env-7al1zz2v/site', '/usr/lib64/python313.zip', '/usr/lib64/python3.13', '/usr/lib64/python3.13/lib-dynload', '/tmp/pip-build-env-7al1zz2v/overlay/lib/python3.13/site-packages', '/tmp/pip-build-env-7al1zz2v/overlay/lib64/python3.13/site-packages', '/tmp/pip-build-env-7al1zz2v/normal/lib/python3.13/site-packages', '/tmp/pip-build-env-7al1zz2v/normal/lib64/python3.13/site-packages', '/tmp/pip-build-env-7al1zz2v/normal/lib/python3.13/site-packages/setuptools/_vendor']

Correct output (slightly altered to print more debug information):

2024-09-24 15:48:39,616 - scikit_build_core - DEBUG - SITE_PACKAGES: /tmp/build-env-z0u0zzpr/lib/python3.13/site-packages
2024-09-24 15:48:39,617 - scikit_build_core - DEBUG - Extra SITE_PACKAGES: /tmp/build-env-z0u0zzpr/lib/python3.13/site-packages
2024-09-24 15:48:39,617 - scikit_build_core - DEBUG - PATH: ['/home/lecris/CLionProjects/spglib/venv/lib/python3.13/site-packages/pyproject_hooks/_in_process', '/usr/lib64/python313.zip', '/usr/lib64/python3.13', '/usr/lib64/python3.13/lib-dynload', '/tmp/build-env-z0u0zzpr/lib64/python3.13/site-packages', '/tmp/build-env-z0u0zzpr/lib/python3.13/site-packages', '/tmp/build-env-z0u0zzpr/lib64/python3.13/site-packages/setuptools/_vendor']

The relevant debug statements there are found at:
https://github.com/scikit-build/scikit-build-core/blob/f0ae31922ff802b179fce3327a9c93ff65934a23/src/scikit_build_core/builder/builder.py#L150-L157

Code of Conduct

Footnotes

  1. https://github.com/scikit-build/scikit-build-core/pull/880#discussion_r1747646118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

1 participant