hmmlearn: gcc error when installing with pip install

I get hmmlearn/_hmmc.c:239:28: fatal error: numpy/npy_math.h: No such file or directory yet the installation seems to finish successfully.

requirements.txt file:

click==6.7
cython==0.25.2
joblib==0.11
numpy==1.12.1
pandas==0.19.2
python-speech-features==0.5
scikit-learn==0.18.1
scipy==0.19.0
hmmlearn==0.2.0
Running setup.py bdist_wheel for hmmlearn: started
  Running setup.py bdist_wheel for hmmlearn: finished with status 'error'
  Complete output from command /opt/conda/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-8l6nu2n1/hmmlearn/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpi_45qjtvpip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  creating build/lib.linux-x86_64-3.6/hmmlearn
  copying hmmlearn/hmm.py -> build/lib.linux-x86_64-3.6/hmmlearn
  copying hmmlearn/utils.py -> build/lib.linux-x86_64-3.6/hmmlearn
  copying hmmlearn/base.py -> build/lib.linux-x86_64-3.6/hmmlearn
  copying hmmlearn/__init__.py -> build/lib.linux-x86_64-3.6/hmmlearn
  creating build/lib.linux-x86_64-3.6/hmmlearn/tests
  copying hmmlearn/tests/test_utils.py -> build/lib.linux-x86_64-3.6/hmmlearn/tests
  copying hmmlearn/tests/test_gaussian_hmm.py -> build/lib.linux-x86_64-3.6/hmmlearn/tests
  copying hmmlearn/tests/test_gmm_hmm.py -> build/lib.linux-x86_64-3.6/hmmlearn/tests
  copying hmmlearn/tests/test_multinomial_hmm.py -> build/lib.linux-x86_64-3.6/hmmlearn/tests
  copying hmmlearn/tests/test_base.py -> build/lib.linux-x86_64-3.6/hmmlearn/tests
  copying hmmlearn/tests/__init__.py -> build/lib.linux-x86_64-3.6/hmmlearn/tests
  running build_ext
  building 'hmmlearn._hmmc' extension
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/hmmlearn
  gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/conda/include/python3.6m -c hmmlearn/_hmmc.c -o build/temp.linux-x86_64-3.6/hmmlearn/_hmmc.o -O3
  hmmlearn/_hmmc.c:239:28: fatal error: numpy/npy_math.h: No such file or directory
   #include "numpy/npy_math.h"
                              ^
  compilation terminated.
  error: command 'gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for hmmlearn
  Running setup.py clean for hmmlearn
Successfully built python-speech-features
Failed to build hmmlearn
Installing collected packages: click, cython, joblib, numpy, pytz, python-dateutil, pandas, python-speech-features, scikit-learn, scipy, hmmlearn
  Running setup.py install for hmmlearn: started
    Running setup.py install for hmmlearn: finished with status 'done'
**Successfully installed** click-6.7 cython-0.25.2 **hmmlearn-0.2.0** joblib-0.11 numpy-1.12.1 pandas-0.19.2 python-dateutil-2.6.0 python-speech-features-0.5 pytz-2017.2 scikit-learn-0.18.1 scipy-0.19.0

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 21 (5 by maintainers)

Most upvoted comments

This issue can be reproduced easily with: docker run --rm python:3.7.4 pip install hmmlearn==0.2.1

However, it has been fixed in 0.2.2: docker run --rm python:3.7.4 pip install hmmlearn==0.2.2

Same issue with latest python. @alegonz. @anntzer Its lame that this issue hasnt been fixed but the issue has been closed.

I can’t repro in a clean venv:

$ python -mvenv /tmp/testenv
$ source /tmp/testenv/bin/activate
$ printf 'numpy\nhmmlearn\n' > requirements.txt
$ pip install -r requirements.txt
Collecting numpy (from -r requirements.txt (line 1))
  Using cached https://files.pythonhosted.org/packages/38/39/f73e104d44f19a6203e786d5204532e214443ea2954917b27f3229e7639b/numpy-1.15.4-cp37-cp37m-manylinux1_x86_64.whl
Collecting hmmlearn (from -r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/94/1d/af4071cbe561f62d744946211414beb22ea7c72d4bb2f42636b6820b5ae5/hmmlearn-0.2.1.tar.gz (150kB)
    100% |████████████████████████████████| 153kB 377kB/s 
Collecting scikit-learn>=0.16 (from hmmlearn->-r requirements.txt (line 2))
  Using cached https://files.pythonhosted.org/packages/56/7d/0737aed3e157fb90a1eaecb1cbfa5742fa4206fb305c8f157b666b71da14/scikit_learn-0.20.0-cp37-cp37m-manylinux1_x86_64.whl
Collecting scipy>=0.13.3 (from scikit-learn>=0.16->hmmlearn->-r requirements.txt (line 2))
  Using cached https://files.pythonhosted.org/packages/40/de/0c22c6754370ba6b1fa8e53bd6e514d4a41a181125d405a501c215cbdbd6/scipy-1.1.0-cp37-cp37m-manylinux1_x86_64.whl
Installing collected packages: numpy, scipy, scikit-learn, hmmlearn
  Running setup.py install for hmmlearn ... done
Successfully installed hmmlearn-0.2.1 numpy-1.15.4 scikit-learn-0.20.0 scipy-1.1.0
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Could you install NumPy and retry the installation?