You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The warning makes no sense to me since importing the module and calling myFunc works fine.
If I put main.pyx and header.pxd in the same directory as setup.py the warning goes away.
What am I missing here?
If I add a empty __init__.py - file to the src-directory the warning goes away but then I cannot import any global module in main.pxy ... So when I add the init-file and change main.pxy to this
Python 3.5.2 (default, Dec 22 2016, 10:15:38)
[GCC 6.2.1 20160822] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import main
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "src/main.pyx", line 4, in init src.main (src/main.c:1050)
import sys
SystemError: Parent module '' not loaded, cannot perform relative import
The text was updated successfully, but these errors were encountered:
I faced the same problem. Looks like cythonize assumes the package is layed out below setup.py, without interim directories (technically: adds just "." to its pxd search path to handle local pxd files).
There is simple workaround: add src to path yourself. In my case it was
ext_modules=cythonize(
…,
# help cythonize find my own .pxd files
include_path=[os.path.join(os.path.dirname(os.path.abspath(__file__)), "src")],
)
(mayhaps bare ["src"] would suffiice but I opted to be safe and calculated absolute path)
and of course at the time cythonize is called, this option is in no way available. Not sure whether pretty solution is possible (by pretty I mean handling this automatically, what would mean lazy-ing dependency calculation until setup object is constructed) but probably cythonize could handle some "where is top of my package" argument (defaulting to "." but allowing me to set it to "src" or whatever I use in given case)
I basically got these files:
src/header.pxd
src/main.pyx
setup.py
Now if I run this I get this output:
The warning makes no sense to me since importing the module and calling myFunc works fine.
If I put main.pyx and header.pxd in the same directory as setup.py the warning goes away.
What am I missing here?
If I add a empty __init__.py - file to the src-directory the warning goes away but then I cannot import any global module in main.pxy ... So when I add the init-file and change main.pxy to this
I get this this error when importing the module:
The text was updated successfully, but these errors were encountered: