pybind / pybind/pybind11

[QUESTION] Cannot import 'sysconfig' during cmake configuration

Open
#2,748 4 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.