Cython (default) include directories

894 views Asked by At

I am writing some cython code which uses the packages mpi4py and cython_gsl. From Python I can do import mpi4py and import cython_gsl without errors. I can also do from cython_gsl cimport * which cythonizes, compiles and runs correctly. If I do from mpi4py cimport * however, I get the error 'mpi4py.pxd' not found. I can make it work if I supply the option -I /path/to/python/lib/python3.5/site-packages when invoking cython.

The __init__.pxd files (which I believe is what is used by cimport) for the two packages are located in

/path/to/python/lib/python3.5/site-packages/cython_gsl/__init__.pxd
/path/to/python/lib/python3.5/site-packages/mpi4py/include/mpi4py/__init__.pxd

My question is this: How come that cython is able to find the __init__.pxd for cython_gsl without explicitly including any path, but not the __init__.pxd for mpi4py? Sure the one for mpi4py is located at a deeper path, but why does including the site-packages directory enable cython to find site-packages/mpi4py/include/mpi4py/__init__.pxd when it already is able to find site-packages/cython_gsl/__init__.pxd?

My hypothesis is that cython_gsl adds itself to the list of directories to include by cython when it is installed. How can I see a list of all directories included by default when invoking cython?

0

There are 0 answers