-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot install ctypes wrapper #8159
Comments
Hi! Thanks for filing this but this isn't the right place for this issue. pip doesn't handle system libraries or I think that python-list mailing lists, #python on Freenode (IRC) or StackOverflow would be better channels to get support for the issue you're facing. |
Thanks for the comment. I would not say this is the wrong project (the linked project is just a minimal example). So is the general answer that |
It sounds like the problem is with the way you build the wheel - pip will simply install a wheel by unpacking it as defined in the wheel spec. It is the build backend's responsibility to lay out the wheel in a way that can be installed using that process. In this case, I assume you are using setuptools, so it's probably going to need some custom code in your |
I'm have little experience with creating a I would appreciate a minimal working example showing how to distribute a |
Looking at the code, it appears that Note - I don't think this is common at all. Normally C extensions should be written to be importable directly, loading them via ctypes is very unusual in my experience. |
Thanks for your patience. Importing raw DLL seems to be the normal way in ctypes. Note - There pros and cons for ctypes and C extension (high maintenance cost) (see https://scipy-lectures.org/advanced/interfacing_with_c/interfacing_with_c.html). It seems like C-extensions should be written only by truly experts. |
If you have a normal C shared library, you shouldn't be building it with the setuptools I don't have an answer for you, I'm afraid. This isn't a pip issue (or even a packaging issue, to be honest!) - it's basically a question of how to integrate C code and Python, and you probably need to ask somewhere else, where people with experience in this type of problem will be able to help. Judging from your link to a SciPy lectures site, and the fact that you seem to be integrating with numpy in your code, maybe some form of scientific Python users forum would be your best bet. |
Thanks for clarification. |
Environment
Description
It is not possible for me to distribute a ctypes wrapper with
pip3
.Expected behavior
As for
python setup.py install --user
, which works.How to Reproduce
The installation process gives no error. But then calling
import ke_dbl_i
raises:
OSError: ~/.local/lib/python3.6/site-packages/lib/ke_dbl_i.so: cannot open shared object file: No such file or directory
The problem is that
pip3
appends the platform tag to the generated shared library:~/.local/lib/python3.6/site-packages/lib/ke_dbl_i.cpython-36m-x86_64-linux-gnu.so
.But the shared library is basically loaded with
ctypes.CDLL('lib/ke_dbl_i.so')
.pip2
does not append a platform tag and runs without error.python3 setup.py
tags a parent folder~/.local/lib/python3.6/site-packages/ke_dbl-0.0.0-py3.6-linux-x86_64.egg
with thename
argument ofsetup
. Such a parent yields, in my opinion, a cleaner structure.The text was updated successfully, but these errors were encountered: