Can't install spams on python 2.7 (Os: Fedora) - python

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

Related

Using pip to install package in AWS

I am new to using Python packages, and I am trying to install a package called RSeQC into a Linux AWS instance.
I started by running:
sudo yum install python3-pip
then running:
sudo yum install python3-devel
and Finally:
sudo pip3 install RSeQC
However, I get the following long error:
compilation terminated.
In file included from libBigWig/bwWrite.c:6:0:
libBigWig/bigWig.h:4:10: fatal error: zlib.h: No such file or directory
#include <zlib.h>
^~~~~~~~
compilation terminated.
error: Command "gcc -pthread -Wno-unused-result -Wsign-compare -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 -DNOCURL -DWITHNUMPY -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -IlibBigWig -I/usr/include/python3.7m -I/usr/local/lib64/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c pyBigWig.c -o build/temp.linux-x86_64-3.7/pyBigWig.o" failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-
kv90ovvh/pyBigWig/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-smel45e_-record/install-record.txt --single-version-
externally-managed --compile" failed with error code 1 in /tmp/pip-build-kv90ovvh/pyBigWig/
Would greatly appreciate any advice in debugging this as I am stumped. Thanks in advance!

problem installing mysqlclient in rhel python3.6

I'm trying to install apache-airflow[mysql]. Its failing when trying to install the mysqlclient dependency. I'm using rhel7. I have the python-devel and mysql-devel packages installed.
I first tried installing using rh-python36. On reading some issues that it could be with the python environment I compiled another version from source. I also reinstalled mysql.
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 -I/opt/rh/rh-mysql80/root/usr/include/mysql -I/u01/airflow-build-1.0/venv/include -I/usr/local/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.7/MySQLdb/_mysql.o -m64
gcc -pthread -shared build/temp.linux-x86_64-3.7/MySQLdb/_mysql.o -L/opt/rh/rh-mysql80/root/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lrt -lssl -lcrypto -ldl -o build/lib.linux-x86_64-3.7/MySQLdb/_mysql.cpython-37m-x86_64-linux-gnu.so
/usr/bin/ld: cannot find -lmysqlclient
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
----------------------------------------

Airflow extra Packages failed to install due to mysqlclient

I have instaled basic version of Airflow which uses Sqlite as metastore. Now i am trying to install other Packages.
I tried the below Packages but failed with mysqlclient issue.
pip install apache-airflow[devel]
Error message with compile statement as below,
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall
-Wstrict-prototypes -fPIC -Dversion_info=(1,3,14,'final',0) -D__version__=1.3.14 -I/usr/include/mysql -I/opt/python-2.7.15/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -DUNIV_LINUX -DUNIV_LINUX
_mysql.c:29:19: error: mysql.h: No such file or directory
_mysql.c:30:26: error: mysqld_error.h: No such file or directory
_mysql.c:48:20: error: errmsg.h: No such file or directory
_mysql.c:67: error: expected specifier-qualifier-list before ‘MYSQL’
Final Failure Command in log:
Command "/home/usr/Airflow_Workspace/install/bin/python -u -c "import
setuptools,
tokenize;file='/tmp/pip-install-yeFo2f/mysqlclient/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-Bw_HED/install-record.txt --single-version-externally-managed --compile --install-headers /home/usr/Airflow_Workspace/install/include/site/python2.7/mysqlclient"
failed with error code 1 in /tmp/pip-install-yeFo2f/mysqlclient/
I tried installing many dependency for python but still not resolved. Could someone help me what exactly I am missing.
If you're on Ubuntu/Debian, you need the libmysqlclient-dev system package first.
sudo apt install libmysqlclient-dev

Command 'gcc' failed when trying to pip install mysql-python

I'm trying to install mysql-python on my VM which is running CentOS 7.
When I try to do so, I get the following error:
building '_mysql' extension
creating build/temp.linux-x86_64-2.7
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 -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -m64
_mysql.c:44:23: fatal error: my_config.h: No such file or directory
#include "my_config.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-qn5NTO/mysql-python/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-yi1zuo/
Steps I've tried:
sudo yum -y install python-devel libxslt-devel libffi-devel openssl-devel
sudo yum -y install gcc gcc-c++ kernel-devel mysql-devel
Still isn't working!

sasl/saslwrapper.h:22:23: fatal error: sasl/sasl.h: No such file or directory

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

Categories

Resources