Closed mathDR closed 9 years ago
Yeah; actually my main development machine is a mac.
It sounds like there may be a problem with your python setup. Are you able to build other cython code that uses numpy (via cimport numpy
)?
Things to check:
np.get_include()
If you're not already using anaconda or miniconda, now might be a good time to give those a shot.
Here's a small test to see if cython is able to build things:
Put this in foo.pyx:
import numpy as np
cimport numpy as np
def foo(double[:] a, double[:] b):
return np.dot(a,b)
Put this in setup.py:
from distutils.core import setup
import numpy as np
from Cython.Build import cythonize
setup(ext_modules=cythonize('*.pyx'), include_dirs=[np.get_include()])
I checked that the generated foo.c
includes numpy/arrayobject.h
and that things build (and run correctly) with python setup.py build_ext --inplace
.
Thanks, yep your example didn't work on my machine. Interesting. I used to be able to compile, but for some reason it doesn't work now. Maybe homebrew did something, but I will close this as it is definitely my environment.
Just a heads up: if I change from: distutils.core import setup to: from numpy.distutils.core import setup
everything works. This seems super crazy. Apparently with disutils, the default clang couldn't see the numpy header files? Strange...
So currently both pip install pyhsmm breaks and attempting to manually build via python setup.py build_ext --inplace --with-cython breaks with the same error:
pyhsmm/internals/hmm_messages_interface.cpp:271:10: fatal error: 'numpy/arrayobject.h' file not found
There are other examples of this online (i.e. it is apparently due to cython compiler not finding the numpy header files)
Have you successfully compiled on mac?