How to install python cairo? - python

I am new to python3. I have created the virtual environment. I try to install the pycairo package using pip command. I need install python cairo. Please see the below info
pip install git+http://anongit.freedesktop.org/git/pycairo
Downloading/unpacking git+http://anongit.freedesktop.org/git/pycairo
Cloning http://anongit.freedesktop.org/git/pycairo to /tmp/pip-0c_foz-build
Running setup.py egg_info for package from git+http://anongit.freedesktop.org/git/pycairo
cairo >= 1.10.2 Successful
Installing collected packages: pycairo
Running setup.py install for pycairo
cairo >= 1.10.2 Successful
building 'cairo._cairo' extension
gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/python3.2mu -c src/cairomodule.c -o build/temp.linux-i686-3.2/src/cairomodule.o
src/cairomodule.c:22:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
Complete output from command /home/nyros/Desktop/NewWeb/venv/bin/python3 -c "import setuptools;__file__='/tmp/pip-0c_foz-build/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lo0egc-record/install-record.txt --single-version-externally-managed --install-headers /home/nyros/Desktop/NewWeb/venv/include/site/python3.2:
cairo >= 1.10.2 Successful
creating py3cairo.pc
creating src/config.h
running install
running build
running build_ext
building 'cairo._cairo' extension
creating build
creating build/temp.linux-i686-3.2
creating build/temp.linux-i686-3.2/src
gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/python3.2mu -c src/cairomodule.c -o build/temp.linux-i686-3.2/src/cairomodule.o
src/cairomodule.c:22:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command /home/nyros/Desktop/NewWeb/venv/bin/python3 -c "import setuptools;__file__='/tmp/pip-0c_foz-build/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lo0egc-record/install-record.txt --single-version-externally-managed --install-headers /home/nyros/Desktop/NewWeb/venv/include/site/python3.2 failed with error code 1 in /tmp/pip-0c_foz-build
Storing complete log in /home/nyros/.pip/pip.log
But I got the error. Please solve my problem. Thanks

I think this may solve your problem:
sudo apt-get install python3-dev
But I cannot guarantee that this will work 100% :-)

Related

Why is pip installing textract failing on Debian?

I'm trying to install the python package textract on (dockerized) Debian:
FROM python:2.7
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get -y install libevent-dev python-dev libxml2-dev libxslt1-dev antiword unrtf poppler-utils pstotext tesseract-ocr flac ffmpeg lame libmad0 libsox-fmt-mp3 sox libjpeg-dev swig
RUN pip install textract
But it fails on the last step pip install textract. Why? How to get around this issue? Below is the error:
Building wheels for collected packages: textract, python-pptx, docx2txt, xlrd, EbookLib, pocketsphinx
Running setup.py bdist_wheel for textract: started
Running setup.py bdist_wheel for textract: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/7b/88/ca/fe02cca616f52ba41e11ee9eff08ca0d8391f3df35e0ede5e2
Running setup.py bdist_wheel for python-pptx: started
Running setup.py bdist_wheel for python-pptx: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/14/50/ec/bf4ff7cedffcde6ef29d3154f758a5d65f40427f526cbdb1d5
Running setup.py bdist_wheel for docx2txt: started
Running setup.py bdist_wheel for docx2txt: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/a8/a1/2e/61cea06f166c6f6ac4df4d75a409328406bd0d2f8e007592f9
Running setup.py bdist_wheel for xlrd: started
Running setup.py bdist_wheel for xlrd: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/f7/2e/62/b4b26f9bc16968996a93dab7a1ec3cf9a1c8ca409114f4fefe
Running setup.py bdist_wheel for EbookLib: started
Running setup.py bdist_wheel for EbookLib: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/3a/b9/cb/834288199b3b3c6c08441d5780ce4a6cfc161d4c859f28a915
Running setup.py bdist_wheel for pocketsphinx: started
Running setup.py bdist_wheel for pocketsphinx: finished with status 'error'
Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-rkBOkm/pocketsphinx/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/pip-wheel-lmkSIP --python-tag cp27:
running bdist_wheel
running build_ext
building 'sphinxbase._ad' extension
swigging swig/sphinxbase/ad.i to swig/sphinxbase/ad_wrap.c
swig -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -Ideps/sphinxbase/swig -outdir sphinxbase -o swig/sphinxbase/ad_wrap.c swig/sphinxbase/ad.i
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/swig
creating build/temp.linux-x86_64-2.7/swig/sphinxbase
creating build/temp.linux-x86_64-2.7/deps
creating build/temp.linux-x86_64-2.7/deps/sphinxbase
creating build/temp.linux-x86_64-2.7/deps/sphinxbase/src
creating build/temp.linux-x86_64-2.7/deps/sphinxbase/src/libsphinxad
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DSPHINXBASE_EXPORTS -DPOCKETSPHINX_EXPORTS -DSPHINX_DLL -DHAVE_CONFIG_H -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -I/usr/local/include/python2.7 -c swig/sphinxbase/ad_wrap.c -o build/temp.linux-x86_64-2.7/swig/sphinxbase/ad_wrap.o -Wno-unused-label -Wno-strict-prototypes -Wno-parentheses -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-result -Wno-sign-compare -Wno-misleading-indentation
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DSPHINXBASE_EXPORTS -DPOCKETSPHINX_EXPORTS -DSPHINX_DLL -DHAVE_CONFIG_H -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -I/usr/local/include/python2.7 -c deps/sphinxbase/src/libsphinxad/ad_pulse.c -o build/temp.linux-x86_64-2.7/deps/sphinxbase/src/libsphinxad/ad_pulse.o -Wno-unused-label -Wno-strict-prototypes -Wno-parentheses -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-result -Wno-sign-compare -Wno-misleading-indentation
deps/sphinxbase/src/libsphinxad/ad_pulse.c:44:30: fatal error: pulse/pulseaudio.h: No such file or directory
#include <pulse/pulseaudio.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Failed building wheel for pocketsphinx
Running setup.py clean for pocketsphinx
Successfully built textract python-pptx docx2txt xlrd EbookLib
Failed to build pocketsphinx
requests 2.20.0 has requirement chardet<3.1.0,>=3.0.2, but you'll have chardet 2.3.0 which is incompatible.
Installing collected packages: argcomplete, chardet, Pillow, XlsxWriter, python-pptx, docx2txt, beautifulsoup4, xlrd, six, EbookLib, SpeechRecognition, pocketsphinx, textract
Found existing installation: chardet 3.0.4
Uninstalling chardet-3.0.4:
Successfully uninstalled chardet-3.0.4
Found existing installation: beautifulsoup4 4.6.3
Uninstalling beautifulsoup4-4.6.3:
Successfully uninstalled beautifulsoup4-4.6.3
Running setup.py install for pocketsphinx: started
Running setup.py install for pocketsphinx: finished with status 'error'
Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-rkBOkm/pocketsphinx/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-record-MiPh8Y/install-record.txt --single-version-externally-managed --compile:
running install
running build_ext
building 'sphinxbase._ad' extension
swigging swig/sphinxbase/ad.i to swig/sphinxbase/ad_wrap.c
swig -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -Ideps/sphinxbase/swig -outdir sphinxbase -o swig/sphinxbase/ad_wrap.c swig/sphinxbase/ad.i
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/swig
creating build/temp.linux-x86_64-2.7/swig/sphinxbase
creating build/temp.linux-x86_64-2.7/deps
creating build/temp.linux-x86_64-2.7/deps/sphinxbase
creating build/temp.linux-x86_64-2.7/deps/sphinxbase/src
creating build/temp.linux-x86_64-2.7/deps/sphinxbase/src/libsphinxad
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DSPHINXBASE_EXPORTS -DPOCKETSPHINX_EXPORTS -DSPHINX_DLL -DHAVE_CONFIG_H -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -I/usr/local/include/python2.7 -c swig/sphinxbase/ad_wrap.c -o build/temp.linux-x86_64-2.7/swig/sphinxbase/ad_wrap.o -Wno-unused-label -Wno-strict-prototypes -Wno-parentheses -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-result -Wno-sign-compare -Wno-misleading-indentation
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DSPHINXBASE_EXPORTS -DPOCKETSPHINX_EXPORTS -DSPHINX_DLL -DHAVE_CONFIG_H -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -I/usr/local/include/python2.7 -c deps/sphinxbase/src/libsphinxad/ad_pulse.c -o build/temp.linux-x86_64-2.7/deps/sphinxbase/src/libsphinxad/ad_pulse.o -Wno-unused-label -Wno-strict-prototypes -Wno-parentheses -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-result -Wno-sign-compare -Wno-misleading-indentation
deps/sphinxbase/src/libsphinxad/ad_pulse.c:44:30: fatal error: pulse/pulseaudio.h: No such file or directory
#include <pulse/pulseaudio.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-rkBOkm/pocketsphinx/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-record-MiPh8Y/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-rkBOkm/pocketsphinx/
ERROR: Service 'baleen' failed to build: The command '/bin/sh -c pip install textract' returned a non-zero code: 1
Solution:
Add RUN apt-get -y install libpulse-dev before pip installing textract.
It has clealy shows the error.
The chardet version-<3.1.0,>=3.0.2 is needed, but you have a older version<2.3.0>.
So you need uninstall your chardet
sudo pip list | grep chardet
then uninstall old version
sudo pip uninstall chardet

pip install module error

hello guys i tried to install a python module called gmpy2 with pip install gmpy2 but error occurs during wheel building
running install
running build
running build_ext
building 'gmpy2' extension
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/src
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-
prototypes -g -fdebug-prefix-map=/build/python3.6-LpWKty/python3.6-
3.6.5~rc1=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-
protector-strong -Wformat -Werror=format-security -Wdate-time -
D_FORTIFY_SOURCE=2 -fPIC -DWITHMPFR -DWITHMPC -
I/usr/include/python3.6m -c src/gmpy2.c -o build/temp.linux-x86_64-
3.6/src/gmpy2.o
In file included from src/gmpy2.c:426:0:
src/gmpy.h:252:12: fatal error: mpfr.h: No such file or directory
# include "mpfr.h"
^~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
`
`
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools,
tokenize;__file__='/tmp/pip-build-
onv0x975/gmpy2/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-izolloyr-record/install-record.txt --single-version-
externally-managed --compile" failed with error code 1 in /tmp/pip-
build-onv0x975/gmpy2/
I tried both pip and pip3
You need to download MPFR source code and compile it. See installation manual: https://gmpy2.readthedocs.io/en/latest/intro.html#installation

Error occurs when Install scrapy in python virtualenv use pip

system info :
Ubuntu 14.10
Linux vagrant-ubuntu-trusty 3.16.0-23-generic #31-Ubuntu SMP Tue Oct 21 17:56:17 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
I first install virtualenv in ubuntu
sudo pip install virtualenv
virtualenv scrapy-env
cd scrapy-env/
source bin/activate
pip install scrapy
then I get this error:
running build_ext
building 'twisted.test.raiser' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
creating build/temp.linux-x86_64-2.7/src/twisted
creating build/temp.linux-x86_64-2.7/src/twisted/test
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/twisted/test/raiser.c -o build/temp.linux-x86_64-2.7/src/twisted/test/raiser.o
src/twisted/test/raiser.c:4:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/vagrant/pyenv/scrapy-env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-NJKTtN/Twisted/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-_i2ueH-record/install-record.txt --single-version-externally-managed --compile --install-headers /vagrant/pyenv/scrapy-env/include/site/python2.7/Twisted" failed with error code 1 in /tmp/pip-build-NJKTtN/Twisted/
Any suggestions that could help me fix it?
You don't have Python developer package installed. Try installing them
sudo apt-get install python-dev # for python2.x installs
sudo apt-get install python3-dev # for python3.x installs

Error while installing oursql in virtualenv

When I try to install oursql under virtual environment using pip install oursql I get following error:
Collecting oursql
Using cached oursql-0.9.3.1.tar.bz2
Building wheels for collected packages: oursql
Running setup.py bdist_wheel for oursql
Complete output from command /home/raghav/janpro/release_1/venv/bin/python2 -c "import setuptools;__file__='/tmp/pip-build-ndxBoY/oursql/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpe4k7ejpip-wheel-:
cython not found, using previously-cython'd .c file.
running bdist_wheel
running build
running build_ext
warning: no usable mysql_config and no _winreg module to try; hopefully you have usable CFLAGS/LDFLAGS set.
building 'oursql' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/oursqlx
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c oursqlx/oursql.c -o build/temp.linux-x86_64-2.7/oursqlx/oursql.o
oursqlx/oursql.c:4:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for oursql
Failed to build oursql
Installing collected packages: oursql
Running setup.py install for oursql
Complete output from command /home/raghav/janpro/release_1/venv/bin/python2 -c "import setuptools, tokenize;__file__='/tmp/pip-build-ndxBoY/oursql/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-awH5dT-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/raghav/janpro/release_1/venv/include/site/python2.7/oursql:
cython not found, using previously-cython'd .c file.
running install
running build
running build_ext
warning: no usable mysql_config and no _winreg module to try; hopefully you have usable CFLAGS/LDFLAGS set.
building 'oursql' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c oursqlx/oursql.c -o build/temp.linux-x86_64-2.7/oursqlx/oursql.o
oursqlx/oursql.c:4: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 "/home/raghav/janpro/release_1/venv/bin/python2 -c "import setuptools, tokenize;__file__='/tmp/pip-build-ndxBoY/oursql/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-awH5dT-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/raghav/janpro/release_1/venv/include/site/python2.7/oursql" failed with error code 1 in /tmp/pip-build-ndxBoY/oursql
Then I installed MySQL C++ connectors with sudo apt-get install libmysqlcppconn-dev but still error was coming.
So, I tried sudo pip install oursql and got following output:
The directory '/home/raghav/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/raghav/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting oursql
Downloading oursql-0.9.3.1.tar.bz2 (119kB)
100% |████████████████████████████████| 122kB 986kB/s
Installing collected packages: oursql
Running setup.py install for oursql
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-GbfPiA/oursql/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-avSCME-record/install-record.txt --single-version-externally-managed --compile:
cython not found, using previously-cython'd .c file.
running install
running build
running build_ext
warning: no usable mysql_config and no _winreg module to try; hopefully you have usable CFLAGS/LDFLAGS set.
building 'oursql' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/oursqlx
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c oursqlx/oursql.c -o build/temp.linux-x86_64-2.7/oursqlx/oursql.o
oursqlx/oursql.c:4: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 -c "import setuptools, tokenize;__file__='/tmp/pip-build-GbfPiA/oursql/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-avSCME-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-GbfPiA/oursql
What is going wrong? I am unable to find out.
the directory '/home/raghav/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
I think you installed some library into your virtualenv using sudo pip. So now some files are owned by the root user and your user cannot write there. You never should use virtualenv as root.
If you have a requirements.txt file I think the easiest way is to create a new virtualenv and install everything again. If you don't want/can't do this try to change the permissions with chown
You do not have python development libraries installed. Try installing it first, and then running pip.
sudo apt-get install python2.7-dev
Try this -
$ sudo apt-get install libmysqlclient-dev
$ sudo pip install oursql

Having trouble installing fastcluster library, numpy include error

I'm trying to install the fastcluster Python library, but I'm running into a compilation error.
$ pip install fastcluster
produces the following output:
Collecting fastcluster
Using cached fastcluster-1.1.17.tar.gz
Building wheels for collected packages: fastcluster
Running setup.py bdist_wheel for fastcluster
Complete output from command /home/ruser/dedupe/venv/bin/python -c "import setuptools;__file__='/tmp/pip-build-9ejthV/fastcluster/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpXVyTyspip-wheel-:
Version: 1.1.17
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying fastcluster.py -> build/lib.linux-x86_64-2.7
running build_ext
building '_fastcluster' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/fastcluster_python.cpp -o build/temp.linux-x86_64-2.7/src/fastcluster_python.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
src/fastcluster_python.cpp:38:31: fatal error: numpy/arrayobject.h: No such file or directory
#include <numpy/arrayobject.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for fastcluster
Failed to build fastcluster
Installing collected packages: fastcluster
Running setup.py install for fastcluster
Complete output from command /home/ruser/dedupe/venv/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-9ejthV/fastcluster/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-85ovHC-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/ruser/dedupe/venv/include/site/python2.7/fastcluster:
Version: 1.1.17
running install
running build
running build_py
running build_ext
building '_fastcluster' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/fastcluster_python.cpp -o build/temp.linux-x86_64-2.7/src/fastcluster_python.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
src/fastcluster_python.cpp:38:31: fatal error: numpy/arrayobject.h: No such file or directory
#include <numpy/arrayobject.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/home/ruser/dedupe/venv/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-9ejthV/fastcluster/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-85ovHC-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/ruser/dedupe/venv/include/site/python2.7/fastcluster" failed with error code 1 in /tmp/pip-build-9ejthV/fastcluster
What would cause this? Something about setting include directories?
The issue you're seeing with installing fastcluster is related to this previous question - the compiler is not looking in the correct directory to find the numpy headers. You can use more or less the same solution as given in the accepted answer:
Download and untar the source for fastcluster
$ pip install fastcluster --download='.'
$ tar -xzf fastcluster-1.1.17.tar.gz
$ cd fastcluster-1.1.17/
Edit the setup.py file to add the output of numpy.get_include() to the include_dirs= argument for the Extension:
import numpy
...
ext_modules=[Extension('_fastcluster',
['src/fastcluster_python.cpp'],
extra_compile_args=['/EHsc'] if os.name=='nt' else [],
include_dirs=[numpy.get_include()]
)]
Install fastcluster:
$ python setup.py install
Let the fastcluster maintainer know that his package is broken :-)

Categories