docs error: cythonize(include_path=x) does not set C include path
See original GitHub issueThe documentation in compilation.rst claims that
cythonize(extensions, include_path=[numpy.get_include()])
adds the numpy include path to the include file search path used by the compiler. This has been quoted many times and the documented feature is used by many packages, although with zero effect: include_path
only adds to the search path used by Cython to find pyx
and pxd
files.
Some alternative ways to address this:
- Change docs to match code by removing the misleading section.
- Change code to match docs by adding the feature.
- Change docs and code to use
cython(include_dirs=[])
as a way for globally specifying C include paths. - Change it all to have
cython_include_dirs
andc_include_dirs
(or path).
3 has the benefit that code using include_path
will continue to function as before (no effect on C include path), while making the feature people have obviously been expecting available. The term include_dir
would then consistently (albeit not obviously) refer to the C includes and the term include_path
to the Cython includes.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:15
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Cython compilation error with include_path as a keyword in ...
c (346) : fatal error C1083: Cannot open include file: 'numpy/arrayobject.h': No such file or directory. I am using Python 3.3 64-bit on...
Read more >Source Files and Compilation - Cython's Documentation
A .pyx (or .py ) file is compiled by Cython to a .c file. ... static_libs/include/ but this path isn't always fixed and...
Read more >How to Fix Include Path Error in C/C++ Files using ... - YouTube
How to fix vscode error : # include errors detected. Please update your includePath. ... Your browser can't play this video.
Read more >Compilation — Cython 0.21 documentation - API Manual
The .c file is compiled by a C compiler to a .so file (or a .pyd file on ... same directory and your...
Read more >Importing a cython module from another module
from cythonAnimal.cat import Cat #Fail here with the error below ... I saw somewhere that setup.py should be in the root directory, not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Having just hit this and spent a while trying to figure out how to work around it, I’d like to voice my support for solution #2 (I can’t see the harm, but I don’t know much about this, so …), but also just as an interim measure doing #1 or some variant to fix the docs, which is explicitly claiming something with numpy that doesn’t work. I know I’m not the only one to be mislead by this, just by how very often this issue shows up:
https://www.google.com/search?q=numpy%2Farrayobject.h'+file+not+found&oq=numpy%2Farrayobject.h'+file+not+found&aqs=chrome..69i57j69i58.427j0j7&sourceid=chrome&ie=UTF-8
For posterity, my interim solution was to pass in my own Extension() to cythonize, which does kinda take away from the benefit of having cythonize in the first place IMHO.
I’d say it’s not a doc bug but a Cython bug.
cythonize
produces anExtension
object which hasinclude_dirs
as one of its attributes.cythonize
should be setting this attribute.