Attempting To Build A Cython Extension To A Python Package, Not Creating Shared Object (.so) File
I have attempted to use the answer here to add the building of a cython extension into my package. It currently cythonizes the code to produce a .c file from the .pyx file but does
Solution 1:
The code in my question was working and building the .so file inside the package/subpackage directory in the install location, however, when I tried to import the package it couldn't find the file. However when I manually moved the file to the location of the root install directory of the package it worked.
It appears to therefore require that the shared object file be in the root directory of the package rather than the submodule directory.
I am able to achieve this by changing the extension definition like so:
extensions = [Extension(
name="foo",
sources=["package/submodule/foo.pyx"],
include_dirs=[numpy.get_include()],
)
]
This puts the .so file in the root install directory.
However I'm not sure why it requires this shared object file to be in the root of the package rather than the subpackage directory as is the case with normal python files.
Post a Comment for "Attempting To Build A Cython Extension To A Python Package, Not Creating Shared Object (.so) File"