1

Used pybind11 in the past without issue pulled in as a submodule and used via cmake. Now working on another project that uses poetry, and so wanted to make everything poetry-centric.

Trying to build this simple example project https://github.com/octavifs/poetry-pybind11-integration results in the failure

Preparing build environment with build-system requirements poetry-core>=1.0.0
Building poetry-pybind11-integration (0.1.0)
Traceback (most recent call last):
  File "/blah/poetry-pybind11-integration/build.py", line 1, in <module>
    from pybind11.setup_helpers import Pybind11Extension, build_ext
ModuleNotFoundError: No module named 'pybind11'

where the first line of build.py is from pybind11.setup_helpers import Pybind11Extension, build_ext and pybind11 is listed in the toml.

Why?

1 Answer 1

1

There is an un-merged (at the time of writing) pull request that holds the solution. In the build settings in the config, build system should be adjusted as shown

[build-system]
# requires = ["poetry-core>=1.0.0"]
requires = [
    "poetry-core>=1.1.0",
    "setuptools>=65.4.1",
    "pybind11>=2.8.0"
]
build-backend = "poetry.core.masonry.api"

EDIT: It turns out there were more changes than this needed so I've set out a simple example project here for anyone stumbling upon this in the future.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.