In the iPython Notebook I am trying to use the notebook function %%cython_pyximport
to write a cython function that I can call later on in my notebook.
I want to use this command as opposed to %%cython
because there seems to be quite a bit of overhead with it. For example when I profile my code I get this:
168495 function calls in 4.606 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
1 3.234 3.234 4.605 4.605 {_cython_magic_0ef63e1ad591c89b73223c7a86d78802.knn_alg}
11397 0.326 0.000 0.326 0.000 {method 'reduce' of 'numpy.ufunc' objects}
987 0.152 0.000 0.266 0.000 decomp.py:92(eig)
987 0.118 0.000 0.138 0.000 function_base.py:3112(delete)
I'm hoping that using %%cython_pyximport
will cut down time spent calling this function. If there is a better way please let me know.
So getting to my actual question - When I use %%cython_pyximport
I get this error:
ImportError: Building module function failed: ['DistutilsPlatformError: Unable to find vcvarsall.bat\n']
Maybe it's related to something not being on my PATH but I'm not sure. What do I have to do to fix this?
I'm using Windows 7, Python 2.7.6 (Installed with Anaconda), Cython 0.20.1, iPython Notebook 2.1.0
EDIT: So after following @IanH 's suggestion I now have this error:
fatal error: numpy/arrayobject.h: No such file or directory
It seems like additional header files need to be included for numpy to work with pyximport. On this page https://github.com/cython/cython/wiki/InstallingOnWindows
there is a mention of this error and how to solve it but am lost at how to apply this so that the %%cython_pyximport command will work in my notebook.