-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[BUG] No module named '_sysconfigdata_d_linux_x86_64-linux-gnu' #2946
Comments
Looks like that code has been around a while, but it's not present in cpython's copy of distutils. Maybe that's an indication that there are some changes to the stdlib distutils that didn't make it into the standalone repo. |
Hmm. The relevant change is |
I'm guessing the problem with a direct port is that it would need to be Python version dependent? |
No, so was it just never applied? |
Hmm, this is a PR from April, how could it be breaking Python 3.9? |
Thanks Henry for the help. And thanks for creating the PR against distutils! Correct, it was never applied.
I believe the change was never backported and was only applied to Python 3.10, so may not have received any thorough testing on various Python versions. |
Corrected above, I somehow got confused when bouncing between PRs. The PR I believe to be needed by distutils is python/cpython#23142. |
That PR removes most of |
I don't think so. I don't have much time to dive into this, but my gut is telling me that the failure is because of the unusual loading that distutils makes of sysconfig. The failure is related to the loading of config variables, the |
It may be the case that the local distutils simply needs to fall back to Python 3.9 behaviors on Python 3.9 and earlier. |
I'm able to replicate the issue with this xonsh command (adapted from the repro above): docker run -it @$(echo '''FROM ubuntu:20.04
RUN apt update && apt install software-properties-common -y
RUN add-apt-repository ppa:deadsnakes/ppa && apt update && apt install -y python3.9-dev python3.9-dbg python3.9-venv python3.9-distutils
RUN python3.9-dbg -m venv .venv
RUN ./.venv/bin/python -m pip install -U pip setuptools wheel
CMD ./.venv/bin/python -c "import setuptools; from distutils import sysconfig as s; s.get_config_var('LDVERSION')"
''' | docker build -q -) |
The |
I observe these sysconfig modules exist in that environment:
|
It looks like something has created a symlink for the non-debug version but not for the debug version:
I wonder what creates that symlink. |
Creating a debug symlink seems to work around the issue.
|
But the question is - why doesn't the issue manifest on stdlib distutils? Aha. It's because Debian patches distutils.sysconfig:
(the pypa/distutils#68 may be the answer. |
I looked into applying the patch suggested here, but it doesn't do the trick as it doesn't include any support for patching _sysconfig_name_tmpl. But since pypa/distutils#69, distutils does provide a hook for that, which I was able to apply:
I'm unsure what distutils should do here. My instinct is that whatever creates that symlink for non-debug builds should do the same for debug builds. That will fix the issue without any extra patching of distutils. I'm not sure what distutils should do here, if anything. |
I note that the workaround also works if applied at the system lib level:
|
We could report this missing symlink to Debian or deadsnakes, then? @asottile, do you know where this should be raised? |
pypa/distutils#111 might help here, by delegating to sysconfig |
Ah, that sounds promising. |
I had this same issue and this StackOverflow answer was able to resolve it for me |
This issue no longer exists (available since Setuptools 61):
|
For me this StackOverflow comment solved the issue. Then I was able to install the latest setuptools running |
setuptools version
setuptools==60.0.0
Python version
Python 3.9
OS
Ubuntu 20.04
Additional environment information
Can reproduce in Docker or with deadsnakes action.
Description
Today, 3.9 deadsnakes debug builds on GitHub Actions for pybind11 started failing with
ModuleNotFoundError: No module named '_sysconfigdata_d_linux_x86_64-linux-gnu'. Setting
SETUPTOOLS_USE_DISTUTILS=stdlib` fixes it.Logs: https://github.com/pybind/pybind11/runs/4583094186?check_suite_focus=true
Original report: deadsnakes/issues#188
Expected behavior
It should be possible to use setuptools and sysconfig on Python 3.9 debug builds! :)
How to Reproduce
deadsnakes/action@v2.1.1
onubuntu-latest
, GHA, followed by the final line below. Or it can be reproduced in Docker. Here is a MWE:Output
Code of Conduct
The text was updated successfully, but these errors were encountered: