[QUESTION] Cannot import 'sysconfig' during cmake configuration
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 18k
- Forks
- 2.3k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 10
Description
Hi, my project builds fine in dev environment, but when I throw it into a drone CI docker image it gives me the following error:
-- pybind11 v2.6.2 dev1
-- Found PythonInterp: /usr/bin/python3.6 (found version "3.6.9")
CMake Error at python/pybind/tools/FindPythonLibsNew.cmake:131 (message):
Python config failure:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: cannot import name 'sysconfig'
Call Stack (most recent call first):
python/pybind/tools/pybind11Tools.cmake:38 (find_package)
python/pybind/tools/pybind11Common.cmake:201 (include)
python/pybind/CMakeLists.txt:169 (include)
I tried building directly in the docker image and it also builds fine. I also tried importing the sysconfig package in the python REPL and it also works fine. Any idea what's causing this?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at python/pybind/tools/FindPythonLibsNew.cmake around line 131 and trace the call from pybind11Tools.cmake during CMake configuration. Reproduce the failure in the Drone CI Docker image, compare it with the direct build and REPL environments, and identify a documented cause or reliable fix for the configuration-time import failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp, python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100