setuptools: [BUG] No module named '_sysconfigdata_d_linux_x86_64-linux-gnu'

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: https://github.com/deadsnakes/issues/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 on ubuntu-latest, GHA, followed by the final line below. Or it can be reproduced in Docker. Here is a MWE:

$ docker run --rm -it ubuntu:20.04
# apt update && apt install software-properties-common -y
# add-apt-repository ppa:deadsnakes/ppa && apt update && apt install -y python3.9-dev python3.9-dbg python3.9-venv python3.9-distutils
# python3.9-dbg -m venv .venv
# ./.venv/bin/python -m pip install -U pip setuptools wheel
# ./.venv/bin/python -c "import setuptools; from distutils import sysconfig as s; s.get_config_var('LDVERSION')"

Output

Traceback (most recent call last):
  File "/.venv/lib/python3.9/site-packages/setuptools/_distutils/sysconfig.py", line 488, in _init_posix
    _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
ModuleNotFoundError: No module named '_sysconfigdata_d_linux_x86_64-linux-gnu'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/.venv/lib/python3.9/site-packages/setuptools/_distutils/sysconfig.py", line 601, in get_config_var
    return get_config_vars().get(name)
  File "/.venv/lib/python3.9/site-packages/setuptools/_distutils/sysconfig.py", line 532, in get_config_vars
    func()
  File "/.venv/lib/python3.9/site-packages/setuptools/_distutils/sysconfig.py", line 491, in _init_posix
    _temp = __import__(
ModuleNotFoundError: No module named '_sysconfigdata'

Code of Conduct

  • I agree to follow the PSF Code of Conduct

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 24 (22 by maintainers)

Most upvoted comments

I had this same issue and this StackOverflow answer was able to resolve it for me

Creating a debug symlink seems to work around the issue.

root@eda1978d024a:/# ln -s _sysconfigdata_d_x86_64-linux-gnu.py /usr/lib/python3.9/_sysconfigdata_d_linux_x86_64-linux-gnu.py
root@eda1978d024a:/# ./.venv/bin/python -c "from distutils import sysconfig as s; s.get_config_var('LDVERSION')" && echo worked
worked