Skip to content

pip/_vendor/pep517 is in sys.path when executing setup.py #104

@hexagonrecursion

Description

@hexagonrecursion

This causes issues when importing certain libraries in setup.py eg colorlog

pyproject.toml

[build-system]
requires = ["setuptools", "wheel", "colorlog"]
build-backend = "setuptools.build_meta"

setup.py

import sys
from pprint import pprint
from setuptools import setup

pprint(sys.path)
setup()
exit(1)

Relevant part of the output:

  ['/home/user/pip/src/pip/_vendor/pep517',
   '/tmp/pip-build-env-ypml46ei/site',
   '/home/user/.conda/envs/hello/lib/python39.zip',
   '/home/user/.conda/envs/hello/lib/python3.9',
   '/home/user/.conda/envs/hello/lib/python3.9/lib-dynload',
   '/tmp/pip-build-env-ypml46ei/overlay/lib/python3.9/site-packages',
   '/tmp/pip-build-env-ypml46ei/normal/lib/python3.9/site-packages']

pypa/pip#8887 (comment)
The end result of this is that if anyone's build relies on a library with the name of any files in the vendored copy of the pep517 library, they'll encounter this same problem.

pypa/pip#8887 (comment)
I was confused why out of the dozens of libraries pip vendors only pep517 is in the path. I was thinking maybe pep517 is not vendored correctly. bcc execsnoop cleared that up:

PCOMM            PID    PPID   RET ARGS
pip              21719  18141    0 /home/user/.conda/envs/hello/bin/pip install -e ./hello-setup/
uname            21721  21719    0 /usr/bin/uname -rs
python           21722  21719    0 /home/user/.conda/envs/hello/bin/python /home/user/pip/src/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-xmo5gc8z/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel colorlog
uname            21726  21722    0 /usr/bin/uname -rs
python           21727  21719    0 /home/user/.conda/envs/hello/bin/python /home/user/pip/src/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp1trhhp23

Note the last line: pip runs src/pip/_vendor/pep517/_in_process.py as a subprocess. This is why its parent directory is in the path.

I want to fix this. I was instructed to open an issue in this repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions