Search code examples
pythonc++setuptoolspybind11scikit-build

Installing python extension module : understanding skbuild+setuptools


I am one of the devs of a (fairly large) C++ simulation tool. Disclaimer : I'm more of a physicist than a dev. I wrote Python bindings for that project using pybind11.

I managed to get the Python module to compile with cmake. I then managed to write a setup.py file using skbuild that does compile the Python module :

python3 setup.py sdist bdist_wheel

In _skbuild/linux-x86_64-3.9/cmake-build/lib/ (and in the tar archive dist/cytosim-0.0.0.tar.gz) there is indeed a compiled library : cytosim.cpython-39-x86_64-linux-gnu.so.

However, when I want to install the module :

pip3 install dist

I get an error :

gcc: error: src/py3/dist.c: No such file or directory

I am very confused because I do not have an directory called py3 in src.

Any pointer ? Anything I'm doing wrong ? Thanks !


Solution

  • The command

    pip3 install dist
    

    tries (and fails) to install the dist package from the pypi repository.

    Maybe try

    pip3 install dist/cytosim-0.0.0.tar.gz
    

    instead.