Problem installing Nupic on Linux

So I was trying to install nupic using “pip install nupic” and everything downloaded fine but when it came to the build it gave me this error:

Collecting nupic
Downloading nupic-1.0.3-py2-none-any.whl (4.8MB)
100% |████████████████████████████████| 4.8MB 218kB/s 
Requirement already satisfied: validictory==0.9.1 in /usr/local/lib/python2.7/dist-packages (from nupic)
Requirement already satisfied: PyMySQL==0.6.2 in /usr/local/lib/python2.7/dist-packages (from nupic)
Requirement already satisfied: unittest2==0.5.1 in /usr/local/lib/python2.7/dist-packages (from nupic)
Requirement already satisfied: ordereddict==1.1 in /usr/local/lib/python2.7/dist-packages (from nupic)
Collecting psutil==1.0.1 (from nupic)
Downloading psutil-1.0.1.tar.gz (156kB)
100% |████████████████████████████████| 163kB 2.2MB/s 
Collecting prettytable==0.7.2 (from nupic)
Downloading prettytable-0.7.2.tar.bz2
Collecting PyYAML==3.10 (from nupic)
Downloading PyYAML-3.10.tar.gz (241kB)
100% |████████████████████████████████| 245kB 1.7MB/s 
Collecting pytest-cov==2.5.0 (from nupic)
Downloading pytest_cov-2.5.0-py2.py3-none-any.whl
Collecting pytest==3.0.7 (from nupic)
Downloading pytest-3.0.7-py2.py3-none-any.whl (172kB)
100% |████████████████████████████████| 174kB 2.4MB/s 
Collecting pyproj==1.9.3 (from nupic)
Downloading pyproj-1.9.3.tar.gz (2.7MB)
100% |████████████████████████████████| 2.7MB 368kB/s 
Collecting pycapnp==0.5.12; platform_system == "Linux" or platform_system == "Darwin" (from nupic)
Downloading pycapnp-0.5.12.tar.gz (454kB)
100% |████████████████████████████████| 460kB 1.3MB/s 
Collecting python-dateutil==2.1 (from nupic)
Downloading python-dateutil-2.1.tar.gz (152kB)
100% |████████████████████████████████| 153kB 1.7MB/s 
Collecting numpy==1.12.1 (from nupic)
Downloading numpy-1.12.1-cp27-cp27mu-manylinux1_x86_64.whl (16.5MB)
100% |████████████████████████████████| 16.5MB 67kB/s 
Collecting asteval==0.9.1 (from nupic)
Downloading asteval-0.9.1.tar.gz
Collecting mock==1.0.1 (from nupic)
Downloading mock-1.0.1.tar.gz (818kB)
100% |████████████████████████████████| 819kB 952kB/s 
Collecting pytest-xdist==1.16.0 (from nupic)
Downloading pytest-xdist-1.16.0.tar.gz (88kB)
100% |████████████████████████████████| 92kB 2.3MB/s 
Collecting DBUtils==1.1 (from nupic)
Downloading DBUtils-1.1.tar.gz (109kB)
100% |████████████████████████████████| 112kB 1.6MB/s 
Collecting nupic.bindings==1.0.0 (from nupic)
Downloading nupic.bindings-1.0.0-cp27-cp27mu-manylinux1_x86_64.whl (3.9MB)
100% |████████████████████████████████| 3.9MB 267kB/s 
Collecting coverage==3.7.1 (from nupic)
Downloading coverage-3.7.1.tar.gz (284kB)
100% |████████████████████████████████| 286kB 1.7MB/s 
Collecting py>=1.4.29 (from pytest==3.0.7->nupic)
Downloading py-1.5.3-py2.py3-none-any.whl (84kB)
100% |████████████████████████████████| 92kB 1.9MB/s 
Requirement already satisfied: setuptools in /usr/local/lib/python2.7/dist-packages (from pytest==3.0.7- >nupic)
Collecting six (from python-dateutil==2.1->nupic)
Downloading six-1.11.0-py2.py3-none-any.whl
Collecting execnet>=1.1 (from pytest-xdist==1.16.0->nupic)
Downloading execnet-1.5.0-py2.py3-none-any.whl
Collecting apipkg>=1.4 (from execnet>=1.1->pytest-xdist==1.16.0->nupic)
Downloading apipkg-1.4-py2.py3-none-any.whl
Installing collected packages: psutil, prettytable, PyYAML, py, pytest, coverage, pytest-cov, pyproj, pycapnp, six, python-dateutil, numpy, asteval, mock, apipkg, execnet, pytest-xdist, DBUtils, nupic.bindings, nupic
Running setup.py install for psutil ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-0JxXwZ/psutil/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-MjrTn4-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/psutil
copying psutil/_psmswindows.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_pslinux.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/error.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psosx.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_error.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_compat.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/__init__.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_pssunos.py -> build/lib.linux-x86_64-2.7/psutil
running build_ext
building '_psutil_linux' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/psutil
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c psutil/_psutil_linux.c -o build/temp.linux-x86_64-2.7/psutil/_psutil_linux.o
psutil/_psutil_linux.c:10:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-0JxXwZ/psutil/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-MjrTn4-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-0JxXwZ/psutil/

It looks like it ran into a problem while installing psutil and python.h could not be found. Don’t know what the problem is. I’m running on Ubuntu 16 using Python 2.7. Anybody know why the install failed?

1 Like

Install python development headers on your system.