[BUG] Confusing ModuleNotFoundError
for distutils
if using setuptools in CPython directory
#4944
Labels
ModuleNotFoundError
for distutils
if using setuptools in CPython directory
#4944
setuptools version
setuptools==78.1.0
Python version
Python 3.13.2
OS
Arch Linux
Additional environment information
No response
Description
I was trying to reproduce a bug in CPython involving a third-party package. I created a virtualenv to do so, but my current working directory was the CPython source tree, as I was trying to git bisect the bug.
I was greeted with:
and ended up having to debug setuptools to find the culprit:
setuptools/_distutils_hack/__init__.py
Lines 111 to 113 in 3a3144f
setuptools/_distutils_hack/__init__.py
Lines 144 to 150 in 3a3144f
Context:
Expected behavior
Ideally, a more robust way to detect CPython builds should be found. Failing that, perhaps the detection can be disabled if running in a virtualenv?
If that's also not possible, IMHO at least some sort of note/warning should be logged as currently it's impossible to see what's going on without delving into setuptools sources (and knowing about how
distutils
is coming fromsetuptools
, and how custom import finders work).How to Reproduce
This triggers as soon as a
pybuilddir.txt
is in the current working directory:Output
The text was updated successfully, but these errors were encountered: