Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: command 'gcc' failed with exit status 1 on CentOS

I'm trying to install lxml package on CentOS using sudo pip install lxml and its throwing this error right at the end:

error:

error: command 'gcc' failed with exit status 1

---------------------------------------

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-PjviBq-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-root/lxml
Storing complete log in /root/.pip/pip.log

[hg@user-centos-1 ~]$ error: command 'gcc' failed with exit status 1
bash: error:: command not found
like image 603
Simple-Solution Avatar asked Nov 13 '13 14:11

Simple-Solution


7 Answers

" error: command 'gcc' failed with exit status 1 ". the installation failed because of missing python-devel and some dependencies.

the best way to correct gcc problem:

You need to reinstall gcc , gcc-c++ and dependencies.

For python 2.7

$ sudo yum -y install gcc gcc-c++ kernel-devel
$ sudo yum -y install python-devel libxslt-devel libffi-devel openssl-devel
$ pip install "your python packet"

For python 3.4

$ sudo apt-get install python3-dev
$ pip install "your python packet"

Hope this will help.

like image 183
Coko Tracy Musaza Avatar answered Oct 05 '22 10:10

Coko Tracy Musaza


Is gcc installed?

sudo yum install gcc
like image 27
Alex Harvey Avatar answered Oct 05 '22 09:10

Alex Harvey


I bet you have to install libxml2-devel or libxml++-devel or even python-devel. But it is only a wild guess, not seeing the actual error from the log file. But it seems gcc is missing either a header file or a library file.

like image 29
damienfrancois Avatar answered Oct 05 '22 09:10

damienfrancois


sudo yum install python36 python36-devel python36-libs python36-tools

if using python36, this is the best path for set up. Corrected this error for me on an aws ec2 instance

like image 35
Jacob Solawetz Avatar answered Oct 05 '22 09:10

Jacob Solawetz


yum install gcc-c++

It works for:

  • aws ec2 (aws linux)
  • centos
    • 8
    • GCP

Fix “gcc: error trying to exec ‘cc1plus’: execvp: No such file or directory” in Fedora

like image 23
Xianhong Xu Avatar answered Oct 05 '22 11:10

Xianhong Xu


How i solved

# yum update
# yum install -y https://centos7.iuscommunity.org/ius-release.rpm
# yum install -y python36u python36u-libs python36u-devel python36u-pip
# pip3.6 install pipenv

I hope it will help Someone to resolve "gcc" issue.

like image 22
Rahul Saini Avatar answered Oct 05 '22 11:10

Rahul Saini


pip install -U pip
pip install -U cython
like image 28
Daniel Cieśliński Avatar answered Oct 05 '22 09:10

Daniel Cieśliński