I am running Fedora 26 in my PC and python version is 2.7. I have already installed
openssl-devel
package.
Now I am trying to install
M2Crypto==0.25.1
package inside python virtual environment using the command
pip install M2Crypto==0.25.1
. Installation always fails with following log statement.
Collecting M2Crypto==0.25.1
Using cached M2Crypto-0.25.1.tar.gz
Requirement already satisfied: typing in ./site-packages (from M2Crypto==0.25.1)
Building wheels for collected packages: M2Crypto
Running setup.py bdist_wheel for M2Crypto ... error
Complete output from command /home/udara/Projects/Dev/moota/ENV/new_env/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-NIhR7v/M2Crypto/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/tmptqERYXpip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
copying M2Crypto/util.py -> build/lib.linux-x86_64-2.7/M2Crypto
-----
-----
copying M2Crypto/PGP/PublicKey.py -> build/lib.linux-x86_64-2.7/M2Crypto/PGP
running build_ext
building 'M2Crypto.__m2crypto' extension
swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
swig -python -D__x86_64__ -I/usr/include/python2.7 -I/usr/include -I/usr/include/openssl -includeall -modern -builtin -outdir build/lib.linux-x86_64-2.7/M2Crypto -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
/usr/include/sys/cdefs.h:175: Warning 305: Bad constant value (ignored).
/usr/include/bits/wchar.h:38: Warning 490: Fragment 'SWIG_From_wchar_t' not found.
/usr/include/stdint.h:274: Warning 490: Fragment 'SWIG_From_wchar_t' not found.
SWIG/_bio.i:64: Warning 454: Setting a pointer/reference variable may leak memory.
-----
-----
SWIG/_engine.i:168: Warning 454: Setting a pointer/reference variable may leak memory.
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/SWIG
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -I/usr/include -I/usr/include/openssl -I/tmp/pip-build-NIhR7v/M2Crypto/SWIG -c SWIG/_m2crypto_wrap.c -o build/temp.linux-x86_64-2.7/SWIG/_m2crypto_wrap.o -DTHREADING
SWIG/_m2crypto_wrap.c:4185:35: error: ‘CRYPTO_NUM_LOCKS’ undeclared here (not in a function); did you mean ‘CRYPTO_UNLOCK’?
static PyThread_type_lock lock_cs[CRYPTO_NUM_LOCKS];
^~~~~~~~~~~~~~~~
CRYPTO_UNLOCK
SWIG/_m2crypto_wrap.c: In function ‘lib_init’:
SWIG/_m2crypto_wrap.c:4590:5: warning: implicit declaration of function ‘SSLeay_add_all_algorithms’; did you mean ‘SSLeay_add_ssl_algorithms’? [-Wimplicit-function-declaration]
SSLeay_add_all_algorithms();
^~~~~~~~~~~~~~~~~~~~~~~~~
SSLeay_add_ssl_algorithms
SWIG/_m2crypto_wrap.c: In function ‘bn_rand’:
SWIG/_m2crypto_wrap.c:5029:12: error: storage size of ‘rnd’ isn’t known
BIGNUM rnd;
^~~
SWIG/_m2crypto_wrap.c:5033:5: warning: implicit declaration of function ‘BN_init’; did you mean ‘bio_init’? [-Wimplicit-function-declaration]
BN_init(&rnd);
^~~~~~~
bio_init
SWIG/_m2crypto_wrap.c:5029:12: warning: unused variable ‘rnd’ [-Wunused-variable]
BIGNUM rnd;
^~~
SWIG/_m2crypto_wrap.c: In function ‘bn_rand_range’:
SWIG/_m2crypto_wrap.c:5058:12: error: storage size of ‘rnd’ isn’t known
BIGNUM rnd;
^~~
SWIG/_m2crypto_wrap.c:5058:12: warning: unused variable ‘rnd’ [-Wunused-variable]
SWIG/_m2crypto_wrap.c: In function ‘rand_pseudo_bytes’:
SWIG/_m2crypto_wrap.c:5209:5: warning: ‘RAND_pseudo_bytes’ is deprecated [-Wdeprecated-declarations]
ret = RAND_pseudo_bytes(blob, n);
^~~
In file included from /usr/include/openssl/opensslconf.h:42:0,
from /usr/include/openssl/crypto.h:32,
from /usr/include/openssl/bio.h:20,
from /usr/include/openssl/err.h:21,
from SWIG/_m2crypto_wrap.c:3828:
/usr/include/openssl/rand.h:47:1: note: declared here
DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
Try using compat-openssl10-devel:
sudo dnf install compat-openssl10-devel --allowerasing
You may have to remove open-ssl if this conflicts with it. You can reinstall open-ssl after installing M2Crypto
Related
I tried to install spams using PiP command but i get this error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-zI4__D/spams/setup.py", line 121, in <module>
with open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f:
TypeError: 'encoding' is an invalid keyword argument for this function
So, i download the zipped file of spams, and i modified the setup.py file to prevent the encoding keyword problem, and when i install the library i get this error:
warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with " \
^
/usr/bin/ld: cannot find -lblas
/usr/bin/ld: cannot find -llapack
collect2: error: ld returned 1 exit status
error: Command "g++ -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-2.7/spams_wrap/spams_wrap.o -L/usr/local/lib64 -L/usr/local/lib -L/usr/lib64 -L/usr/lib -L/usr/lib/ -L/usr/lib64 -lstdc++ -lblas -llapack -lpython2.7 -o build/lib.linux-x86_64-2.7/_spams_wrap.so -fopenmp" failed with exit status 1
When i try "pip install spams==2.6.1", i get this error:
error: Command "gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_ FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOUR CE -fPIC -fwrapv -fPIC -I. -Ispams/linalg -Ispams/prox -Ispams/decomp -Ispams/di ctLearn -I/home/aabdelli/.local/lib/python2.7/site-packages/numpy/core/include - I/usr/include/python2.7 -I/usr/local/include -I/usr/include -I/usr/include/pytho n2.7 -c spams_wrap.cpp -o build/temp.linux-x86_64-2.7/spams_wrap.o -DNDEBUG -DUS E_BLAS_LIB -std=c++11 -fPIC -fopenmp -Wunused-variable -m64" failed with exit st atus 1
----------------------------------------
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip- build-8cd3Ds/spams/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file __).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip- OH2Naf-record/install-record.txt --single-version-externally-managed --compile - -user --prefix=" failed with error code 1 in /tmp/pip-build-8cd3Ds/spams/
First upgrade pip:
pip install -U pip setuptools
SPAMS' setup.py imports numpy before installing it so first you have to install numpy:
pip install numpy
SPAMS requires BLAS and LAPACK. You need to install the libraries for Fedora. See https://fedoraproject.org/wiki/PackagingDrafts/BLAS_LAPACK. Try
yum install openblas lapack
Then go with SPAMS:
pip install spams==2.6.1
I've been studying darkflow from the following link;
https://github.com/thtrieu/darkflow
on Ubuntu 20.04
I thought there was a problem in my flow file, so I tried to rebuild the build file by the following code
dyi#D-FIP7VAE:~/Tiny-YOLO-voc-traffic-sign-detection$ python3.7 setup.py build_ext --inplace<br/>
and this is what i got.
setup.py:6: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
running build_ext
building 'darkflow.cython_utils.nms' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fdebug-prefix-map=/build/python3.7-ZE4Yn0/python3.7-3.7.10=. -fstack-protector-strong -Wformat -Werror=format-security -g -fdebug-prefix-map=/build/python3.7-ZE4Yn0/python3.7-3.7.10=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/dyi/.local/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c darkflow/cython_utils/nms.c -o build/temp.linux-x86_64-3.7/darkflow/cython_utils/nms.o
darkflow/cython_utils/nms.c:29:10: fatal error: Python.h: No such file or directory
29 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
so I tried this
sudo apt-get install python3-dev
But this didn't work, and I get the same error over and over.
Can anybody find the reason why..?
You can try :
sudo apt install libpython3.7-dev
I tried to install a pygrib package. in python 2.
I install all required package. (https://jswhit.github.io/pygrib/docs/pygrib-module.html)
I command pip installs pygrib. but it has an error.
I can't find an error in the error script. there are many warnings. but I don't think that's no problem that doesn't install.
how can fix this error?
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-KuwhgZ/pygrib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-KuwhgZ/pygrib/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-TKG3Ld --python-tag cp27
cwd: /tmp/pip-install-KuwhgZ/pygrib/
Complete output (38 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying ncepgrib2.py -> build/lib.linux-x86_64-2.7
running build_ext
skipping 'pygrib.c' Cython extension (up-to-date)
building 'pygrib' extension
creating build/temp.linux-x86_64-2.7
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/local/lib/python2.7/dist-packages/numpy/core/include -Ig2clib_src -I/usr/include/python2.7 -c pygrib.c -o build/temp.linux-x86_64-2.7/pygrib.o
In file included from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1822:0,
from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
from pygrib.c:613:
/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with " \
^
pygrib.c: In function '__pyx_pf_6pygrib_11gribmessage_16keys':
pygrib.c:13996:18: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
__pyx_v_name = grib_keys_iterator_get_name(__pyx_v_gi);
^
pygrib.c: In function '__pyx_pf_6pygrib_11gribmessage_18_read_only_keys':
pygrib.c:14427:18: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
__pyx_v_name = grib_keys_iterator_get_name(__pyx_v_gi);
^
pygrib.c: In function '__pyx_pf_6pygrib_11gribmessage_30tostring':
pygrib.c:18559:53: warning: passing argument 2 of 'grib_get_message' from incompatible pointer type [-Wincompatible-pointer-types]
__pyx_v_err = grib_get_message(__pyx_v_self->_gh, (&__pyx_v_message), (&__pyx_v_size));
^
In file included from pygrib.c:614:0:
/usr/include/grib_api.h:554:5: note: expected 'const void **' but argument is of type 'void **'
int grib_get_message(grib_handle* h ,const void** message, size_t *message_length);
^
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/pygrib.o -leccodes -o build/lib.linux-x86_64-2.7/pygrib.so
/usr/bin/ld: cannot find -leccodes
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pygrib
Running setup.py clean for pygrib
Failed to build pygrib
Installing collected packages: pygrib
Running setup.py install for pygrib ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-KuwhgZ/pygrib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-KuwhgZ/pygrib/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-NTYS3Y/install-record.txt --single-version-externally-managed --compile
cwd: /tmp/pip-install-KuwhgZ/pygrib/
Complete output (38 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying ncepgrib2.py -> build/lib.linux-x86_64-2.7
running build_ext
skipping 'pygrib.c' Cython extension (up-to-date)
building 'pygrib' extension
creating build/temp.linux-x86_64-2.7
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/local/lib/python2.7/dist-packages/numpy/core/include -Ig2clib_src -I/usr/include/python2.7 -c pygrib.c -o build/temp.linux-x86_64-2.7/pygrib.o
In file included from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1822:0,
from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
from pygrib.c:613:
/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with " \
^
pygrib.c: In function '__pyx_pf_6pygrib_11gribmessage_16keys':
pygrib.c:13996:18: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
__pyx_v_name = grib_keys_iterator_get_name(__pyx_v_gi);
^
pygrib.c: In function '__pyx_pf_6pygrib_11gribmessage_18_read_only_keys':
pygrib.c:14427:18: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
__pyx_v_name = grib_keys_iterator_get_name(__pyx_v_gi);
^
pygrib.c: In function '__pyx_pf_6pygrib_11gribmessage_30tostring':
pygrib.c:18559:53: warning: passing argument 2 of 'grib_get_message' from incompatible pointer type [-Wincompatible-pointer-types]
__pyx_v_err = grib_get_message(__pyx_v_self->_gh, (&__pyx_v_message), (&__pyx_v_size));
^
In file included from pygrib.c:614:0:
/usr/include/grib_api.h:554:5: note: expected 'const void **' but argument is of type 'void **'
int grib_get_message(grib_handle* h ,const void** message, size_t *message_length);
^
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/pygrib.o -leccodes -o build/lib.linux-x86_64-2.7/pygrib.so
/usr/bin/ld: cannot find -leccodes
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-KuwhgZ/pygrib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-KuwhgZ/pygrib/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-NTYS3Y/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
The operant part is cannot find -leccodes, which means it cant find the library libeccodes.so
To install it, you want to do
sudo apt install libeccodes-dev
The latest versions of pygrib, since version 2.0.2, require usage of an ECMWF package called ecCodes which replaces grib-api. Your gcc exit code is saying that you are missing "-leccodes' compile flag.
ecCodes can be found here: https://confluence.ecmwf.int/display/ECC/ecCodes+Home
And here is where grib-api is announced to be replaced by ecCodes: https://confluence.ecmwf.int/display/GRIB/Home
Installing the ecCodes package should provide the gcc flag "-leccodes'
I have OS
Red Hat Enterprise Linux Server release 7.4 (Maipo)
and python
Python 2.7.13 :: Anaconda 4.4.0 (64-bit)
Tried to install lib sasl
sudo pip install sasl
Collecting sasl
Downloading http://repo.com/api/pypi/pypi/packages/8e/2c/45dae93d666aea8492678499e0999269b4e55f1829b1e4de5b8204706ad9/sasl-0.2.1.tar.gz
Collecting six (from sasl)
Downloading http://repo.com/api/pypi/pypi/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Installing collected packages: six, sasl
building 'sasl.saslwrapper' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/sasl
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Isasl -I/usr/include/python2.7 -c sasl/saslwrapper.cpp -o build/temp.linux-x86_64-2.7/sasl/saslwrapper.o
In file included from sasl/saslwrapper.cpp:254:0:
sasl/saslwrapper.h:22:23: fatal error: sasl/sasl.h: No such file or directory
#include <sasl/sasl.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-Ym7ZOA/sasl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-_8ahws-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-Ym7ZOA/sasl/
How solve this problem?
if you are on AWS EC2/EMR or CentOS, sudo yum install cyrus-sasl-devel
From this issue, it seems that you need the libsasl2.
You can install libsasl2 by using the command :-
sudo apt-get install libsasl2-dev
I'm trying to get matplotlib-1.4.0 installed on CentOS 6.5 with Python 2.7.8. I've tried installing with pip and from source. I initially got an error message stating I needed a newer version of Freetype2, which I then installed (version 2.5.3) to /usr/local/bin, /usr/local/include, and /usr/local/lib. The older version of Freetype2 (2.3.11) is in /usr/bin, /usr/include/freetype2/freetype, and /usr/lib.
Now when I try installing matplotlib (python setup.py build) it looks like the include paths are all pointing to the wrong (old) version of Freetype2, and I can't figure out how to change the appropriate paths to point to the newer version of Freetype2. The actual error message is below, and is pretty messy. I couldn't find much about his error online, but I can see that the wrong Freetype2 path so I'm guessing that's what causing the issue. Any tips?
Found tips on other threads about adding /usr/include/freetype symlink to point to /usr/local/include/freetype2, but that didn't help.
building 'matplotlib.ft2font' extension
gcc -pthread -fno-strict-aliasing -O3 -m64 -mfpmath=sse -msse2 -mtune=generic -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/local/python2/2.7.8/x86_64/gcc46/nonet/lib/python2.7/site-packages/numpy/core/include -I/usr/include/freetype2 -I/usr/local/include -I/usr/include -I. -Iextern -I/usr/local/python2/2.7.8/x86_64/gcc46/nonet/include/python2.7 -c src/ft2font.cpp -o build/temp.linux-x86_64-2.7/src/ft2font.o
In file included from /usr/local/python2/2.7.8/x86_64/gcc46/nonet/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1761:0,
from /usr/local/python2/2.7.8/x86_64/gcc46/nonet/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
from src/file_compat.h:7,
from src/ft2font.cpp:7:
/usr/local/python2/2.7.8/x86_64/gcc46/nonet/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
In file included from src/ft2font.cpp:7:0:
src/file_compat.h:31:0: warning: "npy_fseek" redefined [enabled by default]
/usr/local/python2/2.7.8/x86_64/gcc46/nonet/lib/python2.7/site-packages/numpy/core/include/numpy/npy_common.h:86:0: note: this is the location of the previous definition
src/file_compat.h:32:0: warning: "npy_ftell" redefined [enabled by default]
/usr/local/python2/2.7.8/x86_64/gcc46/nonet/lib/python2.7/site-packages/numpy/core/include/numpy/npy_common.h:91:0: note: this is the location of the previous definition
src/ft2font.cpp: In member function ‘Py::Object FT2Image::py_write_bitmap(const Py::Tuple&)’:
src/ft2font.cpp:184:15: warning: unused variable ‘offset’ [-Wunused-variable]
gcc -pthread -fno-strict-aliasing -O3 -m64 -mfpmath=sse -msse2 -mtune=generic -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/local/python2/2.7.8/x86_64/gcc46/nonet/lib/python2.7/site-packages/numpy/core/include -I/usr/include/freetype2 -I/usr/local/include -I/usr/include -I. -Iextern -I/usr/local/python2/2.7.8/x86_64/gcc46/nonet/include/python2.7 -c src/mplutils.cpp -o build/temp.linux-x86_64-2.7/src/mplutils.o
In file included from /usr/local/python2/2.7.8/x86_64/gcc46/nonet/include/python2.7/Python.h:8:0,
from src/mplutils.h:18,
from src/mplutils.cpp:6:
/usr/local/python2/2.7.8/x86_64/gcc46/nonet/include/python2.7/pyconfig.h:1182:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:162:0: note: this is the location of the previous definition
/usr/local/python2/2.7.8/x86_64/gcc46/nonet/include/python2.7/pyconfig.h:1204:0: warning: "_XOPEN_SOURCE" redefined [enabled by default]
/usr/include/features.h:164:0: note: this is the location of the previous definition
gcc -pthread -fno-strict-aliasing -O3 -m64 -mfpmath=sse -msse2 -mtune=generic -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/local/python2/2.7.8/x86_64/gcc46/nonet/lib/python2.7/site-packages/numpy/core/include -I/usr/include/freetype2 -I/usr/local/include -I/usr/include -I. -Iextern -I/usr/local/python2/2.7.8/x86_64/gcc46/nonet/include/python2.7 -c extern/CXX/cxxsupport.cxx -o build/temp.linux-x86_64-2.7/extern/CXX/cxxsupport.o
gcc -pthread -fno-strict-aliasing -O3 -m64 -mfpmath=sse -msse2 -mtune=generic -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/local/python2/2.7.8/x86_64/gcc46/nonet/lib/python2.7/site-packages/numpy/core/include -I/usr/include/freetype2 -I/usr/local/include -I/usr/include -I. -Iextern -I/usr/local/python2/2.7.8/x86_64/gcc46/nonet/include/python2.7 -c extern/CXX/cxx_extensions.cxx -o build/temp.linux-x86_64-2.7/extern/CXX/cxx_extensions.o
gcc -pthread -fno-strict-aliasing -O3 -m64 -mfpmath=sse -msse2 -mtune=generic -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/local/python2/2.7.8/x86_64/gcc46/nonet/lib/python2.7/site-packages/numpy/core/include -I/usr/include/freetype2 -I/usr/local/include -I/usr/include -I. -Iextern -I/usr/local/python2/2.7.8/x86_64/gcc46/nonet/include/python2.7 -c extern/CXX/IndirectPythonInterface.cxx -o build/temp.linux-x86_64-2.7/extern/CXX/IndirectPythonInterface.o
gcc -pthread -fno-strict-aliasing -O3 -m64 -mfpmath=sse -msse2 -mtune=generic -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/local/python2/2.7.8/x86_64/gcc46/nonet/lib/python2.7/site-packages/numpy/core/include -I/usr/include/freetype2 -I/usr/local/include -I/usr/include -I. -Iextern -I/usr/local/python2/2.7.8/x86_64/gcc46/nonet/include/python2.7 -c extern/CXX/cxxextensions.c -o build/temp.linux-x86_64-2.7/extern/CXX/cxxextensions.o
g++ -pthread -shared build/temp.linux-x86_64-2.7/src/ft2font.o build/temp.linux-x86_64-2.7/src/mplutils.o build/temp.linux-x86_64-2.7/extern/CXX/cxxsupport.o build/temp.linux-x86_64-2.7/extern/CXX/cxx_extensions.o build/temp.linux-x86_64-2.7/extern/CXX/IndirectPythonInterface.o build/temp.linux-x86_64-2.7/extern/CXX/cxxextensions.o -L/usr/local/lib -L/usr/local/lib64 -L/usr/lib -L/usr/lib64 -L/usr/local/python2/2.7.8/x86_64/gcc46/nonet/lib -lfreetype -lstdc++ -lm -lpython2.7 -o build/lib.linux-x86_64-2.7/matplotlib/ft2font.so
/usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpython2.7.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
error: command 'g++' failed with exit status 1
Although I'm using python-2.6 I just bodged a way through the exact same freetype error: essentially you can simply download the matplotlib python archive and edit the requirement for freetype-2.4 to freetype-2.3. This was all done in a virtualenv naturally.
get a copy of the current latest matplotlib
pip install --download . matplotlib==1.4.0
untar the result
tar -xzvf matplotlib-1.4.0.tar.gz
edit the explicit requirement for freetype from 2.4 to 2.3 (line 945)
vi matplotlib-1.4.0/setupext.py
min_version='2.4', version=version)
recreate the archive
tar -czvf matplotlib-1.4.0.tar.gz
install the requirements
pip install numpy
pip install geojson==1.0.6
Install your modified local archive, and watch as it compiles
pip install --verbose matplotlib-1.4.0.tar.gz
I finally had time to return to this and it had nothing to do with Freetype. The issue was the wrong version of libpython2.7 being picked up during the build. Specifically in this line:
g++ -pthread -shared build/temp.linux-x86_64-2.7/src/ft2font.o build/temp.linux-x86_64-2.7/src/mplutils.o build/temp.linux-x86_64-2.7/extern/CXX/cxxsupport.o build/temp.linux-x86_64-2.7/extern/CXX/cxx_extensions.o build/temp.linux-x86_64-2.7/extern/CXX/IndirectPythonInterface.o build/temp.linux-x86_64-2.7/extern/CXX/cxxextensions.o -L/usr/local/lib -L/usr/local/lib64 -L/usr/lib -L/usr/lib64 -L/usr/local/python2/2.7.8/x86_64/gcc46/nonet/lib -lfreetype -lstdc++ -lm -lpython2.7 -o build/lib.linux-x86_64-2.7/matplotlib/ft2font.so
The first -L directory is /usr/local/lib which contained a different version of the python library (libpython2.7.a) than the one I should have been compiling against. I moved this file temporarily and the build was then successful (it found the correct version in /usr/local/python2/2.7.8/x86_64/gcc46/nonet/lib).
I'm not exactly sure where the python lib in /usr/local/lib originated from. If it's the system version then this could be considered a bug in the matplotlib build script.
I also have this problem when compiling the matplotlib-1.4.3 from source code. After this error, I simply export LDFLAGS="/home/ubuntu/softwares/python-2.7.11/lib", then python setup.py install. The error is gone and I can install the matplotlib successfully.
In case you want to install the most recent version of matplotlib compatible with Python 2.6 on CentOS 6 (currently 6.9 when I wrote this), here's how I did.
Logged as root, type:
sudo yum install -y epel-release
sudo yum install -y python-pip
sudo yum install -y gcc gcc-c++ python-argparse python-devel freetype-devel libpng-devel
pip install --upgrade pip
pip install numpy==1.11.3 # latest version working with Python 2.6
pip install --upgrade distribute # required by matplotlib 1.4
pip install -I setuptools # "distribute" installation will remove setuptools, so we need to reinstall it
pip install matplotlib==1.4.3 # latest version working with Python 2.6