Description
Description
I experienced the following error in a CI environment
Getting requirements to build wheel: started
Running command Getting requirements to build wheel
Error in sitecustomize; set PYTHONVERBOSE for traceback:
AssertionError:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
main()
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
File "/usr/local/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "/usr/local/lib/python3.10/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
self.run_setup()
File "/usr/local/lib/python3.10/site-packages/setuptools/build_meta.py", line 335, in run_setup
exec(code, locals())
File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'skbuild'
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
Since I know from the pip install -v
log above this truncated output that skbuild
was definitely picked up from pyproject.toml and installed, it's clear that the assertion error prevents the skbuild
package from being found.
Enabling PYTHONVERBOSE=1
:
Adding directory: '/usr/local/lib/python3.10/site-packages'
Processing .pth file: '/usr/local/lib/python3.10/site-packages/distutils-precedence.pth'
Traceback (most recent call last):
File "/usr/local/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site.py", line 549, in execsitecustomize
import sitecustomize
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/private/var/folders/cb/yqyhmsb136xcxm64h9vrswcw0000gn/T/pip-build-env-f7sm6np4/site/sitecustomize.py", line 22, in <module>
assert not path in sys.path
AssertionError
I see that it comes from
pip/src/pip/_internal/build_env.py
Line 130 in ff207cf
This is not my project so I don't know if this is something wrong with the package itself, the CI environment where this happens, or something else.
Changing the CI job to use a venv gets rid of the issue (which is of course a good idea anyway), but it would be good to understand why this assertion is in place and what I should do to fix it.
I think the message should at least include path
and sys.path
, which I could open a PR for, but I would also like some context from someone familiar with the implementation about what one should do in this case.
Expected behavior
The AssertionError would include actionable information
pip version
22.3
Python version
3.10.8
OS
macOS 10.14.6
How to Reproduce
I don't yet know why this happens, and since this issue about improving the message I think it's ok.
Output
No response
Code of Conduct
- I agree to follow the PSF Code of Conduct.