pip install pubnub throws 'gcc' failed error - python

I am trying to install pubnub libraries and I get the error when I do pip install pubnub
Compiling support for Intel AES instructions
building 'Crypto.Hash._MD2' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DLTC_NO_ASM -DHAVE_CPUID_H -Isrc/ -I/usr/include/python2.7 -c src/MD2.c -o build/temp.linux-x86_64-2.7/src/MD2.o
gcc -pthread -shared build/temp.linux-x86_64-2.7/src/MD2.o -L/usr/lib64 -lpython2.7 -o build/lib.linux-x86_64-2.7/Crypto/Hash/_MD2.so
/usr/bin/ld: cannot find -lpython2.7
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
These are the steps I followed
curl -O https://bootstrap.pypa.io/get-pip.py
sudo python27 get-pip.py
sudo yum install git
git clone https://github.com/pubnub/python && cd python/python
sudo update-alternatives --config python
sudo yum install python-devel
sudo yum install gcc
Thanks

You need to install Python's header files. How you do that will depend on your operating system.
On Debian or Ubuntu, for example, something like
sudo apt-get install python-dev
should do it.
On Fedora / CentOS / Red Hat, try
sudo yum install python-devel

The solution for this, I had to follow these steps
ld -lpython2.7 --verbose
attempt to open /usr/x86_64-amazon-linux/lib64/libpython2.7.so failed
attempt to open /usr/x86_64-amazon-linux/lib64/libpython2.7.a failed
attempt to open /usr/local/lib64/libpython2.7.so failed
attempt to open /usr/local/lib64/libpython2.7.a failed
attempt to open /lib64/libpython2.7.so failed
attempt to open /lib64/libpython2.7.a failed
attempt to open /usr/lib64/libpython2.7.so failed
attempt to open /usr/lib64/libpython2.7.a failed
attempt to open /usr/x86_64-amazon-linux/lib/libpython2.7.so failed
attempt to open /usr/x86_64-amazon-linux/lib/libpython2.7.a failed
attempt to open /usr/lib64/libpython2.7.so failed
attempt to open /usr/lib64/libpython2.7.a failed
attempt to open /usr/local/lib/libpython2.7.so failed
attempt to open /usr/local/lib/libpython2.7.a failed
attempt to open /lib/libpython2.7.so failed
attempt to open /lib/libpython2.7.a failed
attempt to open /usr/lib/libpython2.7.so failed
attempt to open /usr/lib/libpython2.7.a failed
Check ldconfig softlink for python and find out what its pointing to
ldconfig -p | grep python2.7
libpython2.7.so.1.0 (libc6,x86-64) => /usr/lib64/libpython2.7.so.1.0
This shows that it was looking for a wrong softlink and I changed the soft link like this
sudo ln -s /usr/lib64/libpython2.7.so.1.0 /usr/lib64/libpython2.7.so
and then had to run pip like this
sudo /usr/local/bin/pip install pubnub -- Location of pip installed
Worked Pretty Good

Related

fatal error: 'fst/types.h' file not found

I'm trying to install openfst like so:
wget http://www.openfst.org/twiki/pub/FST/FstDownload/openfst-1.8.2.tar.gz
tar zxvf openfst-1.8.2.tar.gz
cd openfst-1.8.2
./configure --enable-python
make
sudo make install
but during the Python installation step, I get:
Making install in python
/bin/sh ../../../libtool --tag=CXX --mode=compile g++ -std=c++17 -fno-exceptions -Wno-deprecated-declarations -DHAVE_CONFIG_H -I./../../include -I/Users/colin/opt/miniconda3/envs/logos/include/python3.8 -fexceptions -g -O2 -MT pywrapfst_la-pywrapfst.lo -MD -MP -MF .deps/pywrapfst_la-pywrapfst.Tpo -c -o pywrapfst_la-pywrapfst.lo `test -f 'pywrapfst.cpp' || echo './'`pywrapfst.cpp
libtool: compile: g++ -std=c++17 -fno-exceptions -Wno-deprecated-declarations -DHAVE_CONFIG_H -I./../../include -I/Users/colin/opt/miniconda3/envs/logos/include/python3.8 -fexceptions -g -O2 -MT pywrapfst_la-pywrapfst.lo -MD -MP -MF .deps/pywrapfst_la-pywrapfst.Tpo -c pywrapfst.cpp -fno-common -DPIC -o .libs/pywrapfst_la-pywrapfst.o
pywrapfst.cpp:643:10: fatal error: 'fst/types.h' file not found
#include <fst/types.h>
^~~~~~~~~~~~~
1 error generated.
I don't really understand why, given that seemingly we just installed the necessary fst components?
Is this an issue with the conda installation or something else?
I'm using Miniconda with conda version 4.13.0
Any pointers would be appreciated!
I think the problem is the openfst itself:
OpenFst no longer produces a fst/types.h
If you just want to use wrapped python or not a C++ dev, you should use anaconda package: OpenFST anaconda as #kotatsuyaki suggest. Or you can install from source with version 1.7.x

installing cx_freeze on ubuntu

i have kubuntu 15.10 with python2.7 and python 3.4m installed
if i install cxfreeze with sudo apt-get cx_freeze it is installed with no issues but the problem is when i compile my python modules the are compiled for python2.7 not python 3
So i am trying to build cx_freeze from source and i am facing this error when i run sudo python3 setup.py build
here's the error
adding base module named weakref
running build
running build_py
running build_ext
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict
prototypes -g -fstack-protector-strong -Wformat -Werror=format
security -D_FORTIFY_SOURCE=2 -fPIC -Ibuild/temp.linux-x86_64-3.4
I/usr/include/python3.4m -c source/bases/Console.c -o
build/temp.linux-x86_64-3.4/source/bases/Console.o
x86_64-linux-gnu-gcc -pthread build/temp.linux-x86_64
3.4/source/bases/Console.o -L/usr/lib/python3.4/config-3.4m-x86_64
linux-gnu -lpython3.4 -o build/lib.linux-x86_64
3.4/cx_Freeze/bases/Console -Xlinker -export-dynamic -Wl,-O1 -Wl,
Bsymbolic-functions -lpthread -ldl -lutil -lm -lrt -lexpat -L/usr/lib
-lz -lexpat -s
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1'
Install zlib1g-dev :
sudo apt install zlib1g-dev
then install cx_freeze for python:
pip install cx_freeze
I've tried that on Ubuntu 18.04 and Python 3.6 and worked.
I had exactly the same problem. As suggested in this answer you just need to install the dependencies first:
pip3 install zlib1g-dev
Then sudo python3 setup.py build

'gcc' failed during pandas build on AWS Elastic Beanstalk

Getting the following error when trying to install Pandas (0.16.0), which is in my requirements.txt file, on AWS Elastic Beanstalk EC2 instance:
building 'pandas.msgpack' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -D__LITTLE_ENDIAN__=1 -Ipandas/src/klib -Ipandas/src -I/opt/python/run/venv/local/lib/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c pandas/msgpack.cpp -o build/temp.linux-x86_64-2.7/pandas/msgpack.o
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command 'gcc' failed with exit status 1
I'm running on 64bit Amazon Linux 2015.03 v1.3.0 running Python 2.7 and previously ran into this same error on a t1.micro instance, which was resolved when I change to a m3.medium, but I'm running an m3.xlarge so can't be a memory issue.
I have also ensured that gcc is installed as a package in .ebextensions/00_gcc.config:
packages:
yum:
gcc: []
gcc-c++: []
For pandas being compiled on Elastic Beanstalk, make sure to have both packages: gcc-c++ and python-devel
packages:
yum:
gcc-c++: []
python-devel: []
Install python-dev
sudo apt-get install python-dev
For python3
sudo apt-get install python3-dev
on ec2 instances if you run into gcc error; try this
sudo yum install gcc python-setuptools python-devel postgresql-devel
sudo su -
sudo pip install
I had to upgrade amazon's EC2 pip. You can do this by editing the .config file in .ebextensions:
sh
commands:
00_update_pip:
command: "/opt/python/run/venv/bin/pip install --upgrade pip"
I solved this issue by ssh'ing in to the EBS machine and updating pip
pip install -U pip

Not able to install lxml verison 3.3.5 in ubuntu

I am using openpyxl python package in my application. I am getting the following message when using the same.
/usr/local/lib/python2.7/dist-packages/openpyxl/init.py:31:
UserWarning: The installed version of lxml is too old to be used with
openpyxl
warnings.warn("The installed version of lxml is too old to be used with openpyxl")
Openpyxl requires lxml version 3.2.5 or above, and the version in my machine is 3.2.0. When I try to upgrade lxml to the latest version ie
3.3.5, it is getting interrupted with the following message.
i686-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 -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-i686-2.7/src/lxml/lxml.etree.o -lxslt -lexslt -lxml2 -lz -lm -o build/lib.linux-i686-2.7/lxml/etree.so
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
error: command 'i686-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Rolling back uninstall of lxml
Replacing /usr/lib/python2.7/dist-packages/lxml
Replacing /usr/lib/python2.7/dist-packages/lxml-3.2.0.egg-info
Cleaning up...
Removing temporary dir /tmp/pip_build_root...
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip_build_root/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ov0PUy-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip_build_root/lxml
I need help in resolving the issue.
PS:- I have already installed lxml dependent packages python-dev, libxml2-dev and libxslt1-dev in my machine.
sudo pip install --upgrade lxml
On Ubuntu (and other Debian derivatives), before you build some piece of software, ensure that its build dependencies are installed. Using your example, run this:
sudo apt-get build-dep python-lxml
That is likely going to require a whole bunch of packages, one of which is zlib1g-dev, as mentioned.
I think what you're missing is zlib1g-dev.
sudo apt-get install zlib1g-dev
Running above command will solve the issue.

Installing SciPy version 0.11 in Ubuntu with apt-get [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Installing SciPy with pip
I want to install a new version of SciPy which is 0.11.0 and the current version which I have is 0.9.0.
It is installed by this command:
sudo apt-get install python-scipy
I have tried installing 0.11.0 from sources, but I could not.
Is there already an apt-get for 0.11.0?
EDIT 1
Following is the error when I build from source or do an easy install.
Setup script exited with error: Command "/usr/bin/g77 -g -Wall -g -Wall -shared
build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/_fftpackmodule.o
build/temp.linux-x86_64-2.7/scipy/fftpack/src/zfft.o build/temp.linux-x86_64-
2.7/scipy/fftpack/src/drfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/zrfft.o
build/temp.linux-x86_64-2.7/scipy/fftpack/src/zfftnd.o build/temp.linux-x86_64-
2.7/build/src.linux-x86_64-2.7/scipy/fftpack/src/dct.o build/temp.linux-x86_64-
2.7/build/src.linux-x86_64-2.7/fortranobject.o -Lbuild/temp.linux-x86_64-2.7 -
ldfftpack -lfftpack -lg2c -o build/lib.linux-x86_64-2.7/scipy/fftpack/_fftpack.so"
failed with exit status 1
/usr/lib/pymodules/python2.7/numpy/distutils/misc_util.py:251: RuntimeWarning: Parent
module 'numpy.distutils' not found while handling absolute import
from numpy.distutils import log
EDIT 2
That issue has been resolved, and the error is now the following.
gcc: build/src.linux-x86_64-2.7/scipy/fftpack/_fftpackmodule.c
/usr/bin/g77 -g -Wall -g -Wall -shared build/temp.linux-x86_64-2.7/build/src.linux-
x86_64-2.7/scipy/fftpack/_fftpackmodule.o build/temp.linux-x86_64-
2.7/scipy/fftpack/src/zfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/drfft.o
build/temp.linux-x86_64-2.7/scipy/fftpack/src/zrfft.o build/temp.linux-x86_64-
2.7/scipy/fftpack/src/zfftnd.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-
2.7/scipy/fftpack/src/dct.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-
2.7/scipy/fftpack/src/dst.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-
2.7/fortranobject.o -Lbuild/temp.linux-x86_64-2.7 -ldfftpack -lfftpack -lg2c -o
build/lib.linux-x86_64-2.7/scipy/fftpack/_fftpack.so
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
error: Command "/usr/bin/g77 -g -Wall -g -Wall -shared build/temp.linux-x86_64-
2.7/build/src.linux-x86_64-2.7/scipy/fftpack/_fftpackmodule.o build/temp.linux-
x86_64-2.7/scipy/fftpack/src/zfft.o build/temp.linux-x86_64-
2.7/scipy/fftpack/src/drfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/zrfft.o
build/temp.linux-x86_64-2.7/scipy/fftpack/src/zfftnd.o build/temp.linux-x86_64-
2.7/build/src.linux-x86_64-2.7/scipy/fftpack/src/dct.o build/temp.linux-x86_64-
2.7/build/src.linux-x86_64-2.7/scipy/fftpack/src/dst.o build/temp.linux-x86_64-
2.7/build/src.linux-x86_64-2.7/fortranobject.o -Lbuild/temp.linux-x86_64-2.7 -
ldfftpack -lfftpack -lg2c -o build/lib.linux-x86_64-2.7/scipy/fftpack/_fftpack.so"
failed with exit status 1
EDIT 3
I have asked this question [here], but the issue is not solved yet.
Any thoughts?
If you have all the basic prerequisites installed as described in the INSTALL.txt file, it should be fairly straightforward by doing a:
sudo python setupy.py install
from within the directory where you extracted the scipy0.11.0 tarball. This should make the library inside your current default Python version.
You can check whether you have the prerequisites by just running:
sudo apt-get install python python-dev libatlas3-base-dev gcc gfortran g++
as explained again in the INSTALL.TXT.

Categories

Resources