-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[BUG] ImportError running entrypoint in setuptools 64.0.0+ when PYTHONPATH defined #3535
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
Needs TriageIssues that need to be evaluated for severity and status.Issues that need to be evaluated for severity and status.bug
Description
setuptools version
setuptools==64.0.0
Python version
Python 3.10
OS
Debian (official Python docker images)
Additional environment information
Last known good version: setuptools v63.4.3
First failing version: setuptools v64.0.0 (also confirmed failing with setuptools v65.0.2)
Description
Installing a local package (which has an entrypoint) as editable, now results in an ImportError when that entrypoint is run with PYTHONPATH set, when it worked before.
Example project repo:
https://github.com/edmorley/testcase-setuptools-pep660-pythonpath
Expected behavior
Either:
- Existing package continues to work with setuptools v64's new PEP660 editable mode (if what the package is doing is reasonable)
- Or, if a certain workflow/scenario is no longer supported, then ideally for setuptools to output an error or warning at build/install time, rather than there being a hard to diagnose
ImportErrorat runtime.
How to Reproduce
git clone https://github.com/edmorley/testcase-setuptools-pep660-pythonpath && cd testcase-setuptools-pep660-pythonpathdocker build -t testcase . && docker run --rm -it -e PYTHONPATH=/src testcase hello
Notes:
- This testcase uses Python 3.10.6, pip 22.2.2, setuptools 65.0.2, wheel 0.37.1.
- Any of the following prevents the issue from occurring:
- Downgrading to setuptools <64 (eg: 63.4.3) in the
[build-system]requiresofpyproject.toml. - Removing the
-e PYTHONPATH=/srcfrom thedocker runcommand.
- Downgrading to setuptools <64 (eg: 63.4.3) in the
However usingSETUPTOOLS_ENABLE_FEATURE=legacy-editabledoesn't seem to help (uncomment inDockerfileto try it).
Output
Traceback (most recent call last):
File "/usr/local/bin/hello", line 5, in <module>
from my_package import hello
ImportError: cannot import name 'hello' from 'my_package' (unknown location)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Needs TriageIssues that need to be evaluated for severity and status.Issues that need to be evaluated for severity and status.bug