Home » Python hmmlearn installation issues

Python hmmlearn installation issues

by Jack Simpson

I’ve recently started learning how to apply a Hidden Markov Model (HMM) to some states of honeybee behaviour in my data and have been trying to install Python’s hmmlearn library. Unfortunately I kept getting this frustrating error due to it being unable to locate NumPy headers:

 hmmlearn error: 'numpy/arrayobject.h' file not found 

After a bit of searching I found the solution in a ticket on GitHub, but I thought I’d include it here a) for my own future reference and b) I’ve updated the command to be applicable for Python 3.5.

 export CFLAGS="-I /usr/local/lib/python3.5/site-packages/numpy/core/include/ $CFLAGS" 

Once you’ve run this then you should should be able to install hmmlearn via pip without any problem.

You may also like