You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use pybind11 and scikit-build in a minimal repository based on their cpp example repo. When trying to build it via pip install -e ., pip claims that the file was "Successfully installed", but didn't actually build anything (I suspect it never even ran the setup function inside setup.py). I can confirm it doesn't work given the error message ImportError: cannot import name 'example' from 'hello' when attempting to use the module.
Interestingly enough, the project works when I either
run python setup.py develop directly (thus bypassing pyproject.toml, pressumably). For this, I installed setuptools, scikit-build, cmake, pybind11, and ninja to their appropriate version through conda install X.
Deleting pyproject.toml, relying on pre-installed build-time dependencies.
I don't see how my pyproject.toml file would be problematic. Can anyone help me figure out what's wrong?
#include <pybind11/pybind11.h>
int add(int i, int j) {
return i + j;
}
PYBIND11_MODULE(example, m) {
m.doc() = "pybind11 example plugin"; // optional module docstring
m.def("add", &add, "A function that adds two numbers");
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to use
pybind11
andscikit-build
in a minimal repository based on their cpp example repo. When trying to build it viapip install -e .
, pip claims that the file was "Successfully installed", but didn't actually build anything (I suspect it never even ran thesetup
function insidesetup.py
). I can confirm it doesn't work given the error messageImportError: cannot import name 'example' from 'hello'
when attempting to use the module.Interestingly enough, the project works when I either
python setup.py develop
directly (thus bypassingpyproject.toml
, pressumably). For this, I installedsetuptools
,scikit-build
,cmake
,pybind11
, andninja
to their appropriate version throughconda install X
.pyproject.toml
, relying on pre-installed build-time dependencies.I don't see how my
pyproject.toml
file would be problematic. Can anyone help me figure out what's wrong?My project layout is
setup.py:
CMakeLists.txt:
pyproject.toml (I'll note that the problem persists even without constraining versions here):
src/hello.cpp:
I'm trying this in Ubuntu 20.
Beta Was this translation helpful? Give feedback.
All reactions