0

I'm working on a Python package, that wraps a C++ library using Pybind11 + cmake, the code is available at https://github.com/bayesmix-dev/pybmix

Since I'm working on Linux, in order to distribute it through PyPi, I understand that there are two options:

  1. build a manylinux wheel
  2. distribute binaries and users need to install it locally

Given that I'm not sure how many users will use my package, I opted for the 2nd option. Moreover, I handle all C++ libraries through CMake submodules so that the library is "self-contained".

Now here's the problem: running

python3 setup.py bdist_wheel

produces a file dist/pybmix-0.0.2-cp38-cp38-linux_x86_64.whl which is bad due to the linux_... part. However running

pip3 install pybmix-0.0.2-cp38-cp38-linux_x86_64.whl

works on my machine

running

python3 setup.py sdist

produces a file dist/pybmix-0.0.2.tar.gz, installing it fails:

pip3 install dist/pybmix-0.0.2.tar.gz

.....
 
subprocess.CalledProcessError: Command '['cmake', '--version']' returned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for pybmix
Failed to build pybmix
ERROR: Could not build wheels for pybmix which use PEP 517 and cannot be installed directly

Also maybe related but maybe not, I am using protocol buffer to generate some Python and C++ files, this is done in the CMakeLists.txt file so that in my setup.py I have overridden the build_py in order to first call build_ext (which is overridden as well as in https://github.com/pybind/cmake_example)

mariob6
  • 469
  • 1
  • 6
  • 16
  • 1
    Providing link to a GitHub repository doesn’t replace a [mre]. – ead Jun 06 '21 at 17:45
  • regarding the two options in your opening paragraph, they are 1) building a platform dependent binary distribution by shipping built binaries, and 2) building a platform independent source distribution, shipping code and build-instructions. And what's usually done is to just do both, because why not. pypi and pip will handle the decision making, and clients will install a binary distribution if it exists, and try to build+install the source distribution as a fallback. – Arne Jun 07 '21 at 09:26

0 Answers0