milksnake icon indicating copy to clipboard operation
milksnake copied to clipboard

Use with pybind11 to package external dependencies in the wheel?

Open safijari opened this issue 7 years ago • 2 comments

So, if this is the wrong place to ask this question you can bump me elsewhere (I just wasn't sure what that elsewhere was). I'm trying to understand how to create a self contained wheel for a private package I'm making. It depends on a 3rd party library for which I have headers and a .so file (but no source). I'm wrapping the libray with pybind11 and so long as the library is installed such that the .so file is in /usr/lib everything goes hunky dory. However I am having the roughest of times figuring out how to include that .so in the package itself.

Milksnake kinda seems like it can help with this but I'm unsure where to start. Am I barking up the wrong tree or have I come to the right place.

safijari avatar Sep 28 '18 17:09 safijari

if you don't have the sources for this third-party library then i think it's better that you simply include it inside your package using setuptools' package_data, and then you load it using either pkg_resources.resource_filename or importlib_resources.path

anthrotype avatar Sep 28 '18 17:09 anthrotype

So I'm able to inject the .so files into the wheel with this method, but what I'm struggling with is that pybind11 still looks at /usr/lib for the file. Unsure how to deal with that.

safijari avatar Sep 28 '18 22:09 safijari