'gcc' failed during pandas build on AWS Elastic Beanstalk - python

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

Related

Errors when installing MySQL-python package after mysql-connector-c got upgraded

Previously, my installation works normally, since it uses pip's cache directory. But when I installed a brew package, brew automatically removed mysql-connector-c, and added mysql-client 8.0.19 instead. From that moment, my application can't connect to the DB anymore:
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen([venv_location]/lib/python2.7/site-packages/_mysql.so, 2):
Library not loaded: /usr/local/opt/mysql-connector-c/lib/libmysqlclient.18.dylib
Referenced from: [venv_location]/lib/python2.7/site-packages/_mysql.so Reason: image not found.
It seems that the MySQL-python package still points to the old mysql-connector-c. I decided to reinstall the package without using the cache:
pip install MySQL-python==1.2.5 --no-cache-dir
But I got this error instead:
creating build/temp.macosx-10.15-x86_64-2.7
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -iwithsysroot /usr/local/libressl/include -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -I/usr/local/opt/openssl/include -arch x86_64 -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/opt/mysql-client/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.15-x86_64-2.7/_mysql.o
_mysql.c:44:10: fatal error: 'my_config.h' file not found
#include "my_config.h"
^~~~~~~~~~~~~
1 error generated.
error: command 'cc' failed with exit status 1
I have searched for this error, but the answers are usually related to brew install mysql-connector-c, while this package is not available from brew anymore. So how can I handle this exception?
Here is my /usr/local/opt (../Cellar/mysql-client/6.1.11 is invalid since it has been upgraded):
mysql-client -> ../Cellar/mysql-client/8.0.19
mysql-connector-c -> ../Cellar/mysql-client/6.1.11
Should I reinstall the old version of mysql-client to install MySQL-python from cache and keep using the old version? Or is there another way to deal with 'my_config.h' file not found?
This procedure worked for me (I'm adding the mysql-client and the mysql-connector-c removal to it):
brew remove mysql mysql-client mysql-connector-c
brew install mysql#5.7
brew link --force mysql#5.7
pip install mysql-python
I read a post and adjusted the procedure to link things in the /usr/local/bin instead of adding a new route to the PATH variable.
Reference: MacOS: "pip install MySQL-python" returning an error: "_mysql.c:44:10: fatal error: 'my_config.h' file not found"

Cannot install python package confluent-kafka on Mac Sierra

Spent too much time attempting to install confluent-kafka with no luck. I understand there is a librdkafka dependency, but that appears to have installed successfully.
Tried following advice from:
http://docs.confluent.io/3.1.1/installation.html#cpp-client
https://github.com/confluentinc/confluent-kafka-python/issues/6
https://github.com/confluentinc/confluent-kafka-go/issues/39
Results
MyMac1234567:~ joe.user$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.12.3
BuildVersion: 16D32
MyMac1234567:~ joe.user$ brew install openssl
Updating Homebrew...
==> Auto-updated Homebrew!
Updated Homebrew from bb3e509 to 7e5b2fb.
Updated 1 tap (homebrew/core).
==> Updated Formulae
kafka
Warning: openssl is a keg-only and another version is linked to opt.
Use `brew install --force` if you want to install this version
MyMac1234567:~ joe.user$ brew install librdkafka
==> Using the sandbox
==> Downloading https://github.com/edenhill/librdkafka/archive/0.9.1.tar.gz
Already downloaded: /Users/jeff.graham/Library/Caches/Homebrew/librdkafka-0.9.1.tar.gz
==> ./configure --prefix=/usr/local/Cellar/librdkafka/0.9.1
==> make
==> make install
🍺 /usr/local/Cellar/librdkafka/0.9.1: 14 files, 1.3MB, built in 11 seconds
MyMac1234567:~ joe.user$ python -V
Python 2.7.10
MyMac1234567:~ joe.user$ pip -V
pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)
MyMac1234567:~ joe.user$ sudo -H pip install confluent-kafka
Collecting confluent-kafka
Using cached confluent-kafka-0.9.4.tar.gz
Installing collected packages: confluent-kafka
Running setup.py install for confluent-kafka ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-VbLtMr/confluent-kafka/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-iPYPmz-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.12-intel-2.7
creating build/lib.macosx-10.12-intel-2.7/confluent_kafka
copying confluent_kafka/__init__.py -> build/lib.macosx-10.12-intel-2.7/confluent_kafka
creating build/lib.macosx-10.12-intel-2.7/confluent_kafka/avro
copying confluent_kafka/avro/__init__.py -> build/lib.macosx-10.12-intel-2.7/confluent_kafka/avro
copying confluent_kafka/avro/cached_schema_registry_client.py -> build/lib.macosx-10.12-intel-2.7/confluent_kafka/avro
creating build/lib.macosx-10.12-intel-2.7/confluent_kafka/kafkatest
copying confluent_kafka/kafkatest/__init__.py -> build/lib.macosx-10.12-intel-2.7/confluent_kafka/kafkatest
copying confluent_kafka/kafkatest/verifiable_client.py -> build/lib.macosx-10.12-intel-2.7/confluent_kafka/kafkatest
copying confluent_kafka/kafkatest/verifiable_consumer.py -> build/lib.macosx-10.12-intel-2.7/confluent_kafka/kafkatest
copying confluent_kafka/kafkatest/verifiable_producer.py -> build/lib.macosx-10.12-intel-2.7/confluent_kafka/kafkatest
creating build/lib.macosx-10.12-intel-2.7/confluent_kafka/avro/serializer
copying confluent_kafka/avro/serializer/__init__.py -> build/lib.macosx-10.12-intel-2.7/confluent_kafka/avro/serializer
copying confluent_kafka/avro/serializer/message_serializer.py -> build/lib.macosx-10.12-intel-2.7/confluent_kafka/avro/serializer
running build_ext
building 'confluent_kafka.cimpl' extension
creating build/temp.macosx-10.12-intel-2.7
creating build/temp.macosx-10.12-intel-2.7/confluent_kafka
creating build/temp.macosx-10.12-intel-2.7/confluent_kafka/src
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c confluent_kafka/src/confluent_kafka.c -o build/temp.macosx-10.12-intel-2.7/confluent_kafka/src/confluent_kafka.o
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c confluent_kafka/src/Producer.c -o build/temp.macosx-10.12-intel-2.7/confluent_kafka/src/Producer.o
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c confluent_kafka/src/Consumer.c -o build/temp.macosx-10.12-intel-2.7/confluent_kafka/src/Consumer.o
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.12-intel-2.7/confluent_kafka/src/confluent_kafka.o build/temp.macosx-10.12-intel-2.7/confluent_kafka/src/Producer.o build/temp.macosx-10.12-intel-2.7/confluent_kafka/src/Consumer.o -lrdkafka -o build/lib.macosx-10.12-intel-2.7/confluent_kafka/cimpl.so
ld: warning: ignoring file /usr/local/lib/librdkafka.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/librdkafka.dylib
running install_lib
copying build/lib.macosx-10.12-intel-2.7/confluent_kafka/cimpl.so -> /Library/Python/2.7/site-packages/confluent_kafka
running install_data
copying LICENSE -> /System/Library/Frameworks/Python.framework/Versions/2.7/
error: [Errno 1] Operation not permitted: '/System/Library/Frameworks/Python.framework/Versions/2.7/LICENSE'
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-VbLtMr/confluent-kafka/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-iPYPmz-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-VbLtMr/confluent-kafka/
Since El Capitan 10.11, Apple has created a System Integrity Protection(SIP) that does not even allow a super user to change anything in these folders: /System, /bin, /sbin, or /usr (except /usr /local).
Pre requiremets form MacOS El Capitan or newer:
brew install pkg-config
brew upgrade openssl
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
export LDFLAGS=-L/usr/local/opt/openssl/lib
export CPPFLAGS=-I/usr/local/opt/openssl/include
Because of this, I need clone and compile librdkafka by my own, and changed the prefix fom /usr to /usr/local
git clone https://github.com/edenhill/librdkafka.git
cd librdkafka
./configure --clean
./configure --prefix /usr/local
make
sudo make install
Sorry, many things I was doing wrong:
brew doctor
**brew doctor found symlink issues:**
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
freetds
brew link --overwrite --dry-run freetds
Reinstalled librdkafka
brew uninstall librdkafka
brew install librdkafka
Most importantly, found I was following old/outdated/dangerous practice of sudo for pip per here.
https://github.com/ipython/ipython/issues/9523
Used --user instead and we're good.
pip install confluent-kafka --user
Collecting confluent-kafka
Using cached confluent-kafka-0.9.4.tar.gz
Installing collected packages: confluent-kafka
Running setup.py install for confluent-kafka ... done
Successfully installed confluent-kafka-0.9.4
Sorry for posting an issue prematurely. Hopefully this will help someone out.

having trouble installing awslogs agent

I'm having issues trying to instal awslogs agent on my ec2 node. When I run this command:
sudo python ./awslogs-agent-setup.py --region us-east-1
it seems to fail at step 2 like this:
Launching interactive setup of CloudWatch Logs agent ...
Step 1 of 5: Installing pip ...DONE
Step 2 of 5: Downloading the latest CloudWatch Logs agent bits ...
Traceback (most recent call last):
File "./awslogs-agent-setup.py", line 1144, in <module>
main()
File "./awslogs-agent-setup.py", line 1140, in main
setup.setup_artifacts()
File "./awslogs-agent-setup.py", line 696, in setup_artifacts
self.install_awslogs_cli()
File "./awslogs-agent-setup.py", line 523, in install_awslogs_cli
subprocess.call([AWSCLI_CMD, 'configure', 'set', 'plugins.cwlogs', 'cwlogs'], env=DEFAULT_ENV)
File "/usr/lib64/python2.7/subprocess.py", line 524, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
what directory or file is it missing?
Amazon Linux 2
The awslogs agent is available now as a yum package https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/QuickStartEC2Instance.html
sudo yum install -y awslogs
sudo systemctl start awslogsd
sudo systemctl enable awslogsd.service
Make sure to change the AWS Region as mentionned in the doc
I solved this by passing the python interpreter to be used:
sudo python ./awslogs-agent-setup.py --region us-east-1 --python=/usr/bin/python3.5
Although this question is a bit old, I'd like to add an answer to it, as I recently run into the same problem, but managed to find a way around it. I was trying to install this in an instance running CentOS 7.
When I run the installation command for the first time, I got exactly the same error log reported by #user2061886. The installer logs to a file with the following path: /var/log/awslogs-agent-setup.log. I tailed the file and found that internally the installer was complaining about not being able to find the file "Python.h":
creating build/temp.linux-x86_64-2.7
checking if libyaml is compilable
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 -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/check_libyaml.c -o build/temp.linux-x86_64-2.7/check_libyaml.o
checking if libyaml is linkable
gcc -pthread build/temp.linux-x86_64-2.7/check_libyaml.o -L/usr/lib64 -lyaml -o build/temp.linux-x86_64-2.7/check_libyaml
building '_yaml' extension
creating build/temp.linux-x86_64-2.7/ext
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 -I/usr/include/python2.7 -c ext/_yaml.c -o build/temp.linux-x86_64-2.7/ext/_yaml.o
ext/_yaml.c:4:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
I couldn't get it working with Python 2.7, so I switched to Python 3.5. To install Python 3.5 in CentOS 7:
yum -y udpate
yum install -y epel-release
yum install -y http://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/ius-
release-1.0-13.ius.centos7.noarch.rpm
yum -y update
yum install -y python35u*
I run again the installer command and got passed the error reported by #user2061886. I could install and configure the CloudWatch Logs Agent. However, soon after I started the service (sudo service awslogs start), I run into a second problem. This time I had to tail the following file to spot the issue: /var/log/awslogs.log. The cloudwatch logs agent was basically complaining about not being able to find the cwlogs package:
Traceback (most recent call last):
File "/var/awslogs/bin/aws", line 27, in <module>
sys.exit(main())
File "/var/awslogs/bin/aws", line 23, in main
return awscli.clidriver.main()
File "/usr/lib/python3.5/site-packages/awscli/clidriver.py", line 55, in main
driver = create_clidriver()
File "/usr/lib/python3.5/site-packages/awscli/clidriver.py", line 64, in create_clidriver
event_hooks=emitter)
File "/usr/lib/python3.5/site-packages/awscli/plugin.py", line 44, in load_plugins
modules = _import_plugins(plugin_mapping)
File "/usr/lib/python3.5/site-packages/awscli/plugin.py", line 58, in _import_plugins
plugins.append(__import__(path))
ImportError: No module named 'cwlogs'
I solved this by installing the package manually with pip:
pip3.5 install awscli-cwlogs.
This got the problem solved!
I had the same problem trying to install on centos docker. Turns out I could do without updating python after installing these packages
python-devel libpython-dev which initscripts cronie
^^Yeah.. I fixed a similar issue with some missing dependencies that were pointed to in the /var/log/awslogs.log
apt-get update && apt-get install -y python-pip libpython-dev
So guys Just figured it OUT!!
File "./awslogs-agent-setup.py", line 520, in install_awslogs_cli
venv_in_path = (subprocess.call(["which", "virtualenv"], stderr=self.log_file, stdout=self.log_file) == 0)
On the above error, you can the "which" command is being used and unfortunately "which" was not installed.
Once installed everything started working.
Cheers!! If it helps anyone.
I know I'm 2+ years late but I wasn't able to find an answer to this.
I was having the same problem and it was because the disk was running out of inodes (I think running out of disk space can cause the same problem) and I solved it running sudo apt-get autoremove
You can check your inodes with df -i
I hope this may help anyone having this problem.

pip install pubnub throws 'gcc' failed error

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

gcc cannot find cc1plus

I'm trying to install the python package pandas on CentOS 6 but I'm having problems with the gcc compiler:
sudo pip install pandas
...
creating build/temp.linux-x86_64-2.7/pandas/msgpack
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/msgpack -Ipandas/src/klib -Ipandas/src -I/opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include -I/opt/rh/python27/root/usr/include/python2.7 -c pandas/msgpack/_packer.cpp -o build/temp.linux-x86_64-2.7/pandas/msgpack/_packer.o -Wno-unused-function
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
Cleaning up...
...
So it appears I need cc1plus, which by reading around requires gcc-g++. But I already have gcc-c++:
sudo yum install gcc-c++
...
Package gcc-c++-4.4.7-16.el6.x86_64 already installed and latest version
Nothing to do
About gcc and cc1plus:
gcc --version
gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
which gcc
/opt/rh/devtoolset-2/root/usr/bin/gcc
locate cc1plus
/usr/libexec/gcc/x86_64-redhat-linux/4.4.4/cc1plus
My own solution below. Does anybody have better ways of addressing the problem?
Solution to my own question:
It seems that cc1plus, although present, is not visible to gcc as it is not on path. So a solution is to link cc1plus to a directory on PATH:
sudo ln -s /usr/libexec/gcc/x86_64-redhat-linux/4.4.4/cc1plus /usr/local/bin/
Now sudo pip install pandas succeeds.
(But why the package manager put cc1plus there in the first place?)

Categories

Resources