Ctypes and editable mode #653
Replies: 2 comments 2 replies
-
I think the trick here is to use importlib.resources instead of importlib.resources.files(__package__).joinpath(".sharedlibs/libp-focus.so") meson-python's editable-mode hooks will resolve that to the build directory. |
Beta Was this translation helpful? Give feedback.
-
I think I had suggested at the time, not that you install the libraries in multiple places, but rather that your The library is created in You look for the library in That means that the library itself may be in one of two places:
The trick is going to be locating |
Beta Was this translation helpful? Give feedback.
-
Dears. Using
pip install -e . --no-build-isolation
, as suggested by the docs, I can correctly install the package and compile my C code, which is called through ctypes. However once I try to use the package it fails to find the shared libraries:The
_LIBCFOCUS
variable above is implemented here:If you want to take a look, here is the software I'm working on.
The problem is that, once in editable mode, the code looks for the shared libraries in the wrong place. While not in editable mode, the libraries are installed in my local environment directory (
site-packages/hbstools/triggers/.sharedlibs/lib-pfocus.so
). However, once in editable-mode, I do not know where they are actually installed, but they are expected to be in my source directory.I have asked this question under an issue (sorry @rgommers for reviving a dead issue) and got a kind reply from @eli-schwartz, which suggested to install the shared libraries in multiple places, so that I can try to import from these. However it is not fully clear to me how this should be carried out, and if there is any better solution not requiring multiple copies of the same file.
Is it possible to install my project in editable mode?
Thank you very much.
Beta Was this translation helpful? Give feedback.
All reactions