setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Solution 1
Try installing these packages.
sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-pil python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev libssl-dev
sudo easy_install greenlet
sudo easy_install gevent
Solution 2
I encountered the same problem in college having installed Linux Mint for the main project of my final year, the third solution below worked for me.
When encountering this error please note before the error it may say you are missing a package or header file — you should find those and install them and verify if it works (e.g. ssl → libssl).
For Python 2.x use:
sudo apt-get install python-dev
For Python 2.7 use:
sudo apt-get install libffi-dev
For Python 3.x use:
sudo apt-get install python3-dev
or for a specific version of Python 3, replace x
with the minor version in
sudo apt-get install python3.x-dev
Solution 3
Python.h is nothing but a header file. It is used by gcc to build applications. You need to install a package called python-dev. This package includes header files, a static library and development tools for building Python modules, extending the Python interpreter or embedding Python in applications.
enter:
$ sudo apt-get install python-dev
or
# apt-get install python-dev
see http://www.cyberciti.biz/faq/debian-ubuntu-linux-python-h-file-not-found-error-solution/
Solution 4
You need to install these packages:
sudo apt-get install libpq-dev python-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libffi-dev
Solution 5
For Python 3.4 use:
sudo apt-get install python3.4-dev
For Python 3.5 use:
sudo apt-get install python3.5-dev
For Python 3.6 use:
sudo apt-get install python3.6-dev
For Python 3.7 use:
sudo apt-get install python3.7-dev
For Python 3.8 use:
sudo apt-get install python3.8-dev
... and so on ...
Madura Dissanayake
Updated on December 15, 2021Comments
-
Madura Dissanayake over 2 years
When I try to install
odoo-server
, I got the following error:error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Could anyone help me to solve this issue?
-
Shashank over 9 yearsi didn't found any reasonable answer about why this error happen! why we need to install all these packages...if possible then kindly explain "'x86_64-linux-gnu-gcc' failed" to me
-
Shane Reustle about 9 yearsYeah, one of these packages might fix it but it would be nice to know which one particularly
-
8bitjunkie over 8 yearsThis did not solve the problem for me:
Reading state information... Done python-dev is already the newest version.
-
Alfabravo over 8 yearsbuild-essential and python-dev were enough in my case.
-
reggie over 8 yearsDownvoted for not answering the question. Why do I have to install qt4-docs to fix this problem?
-
vinayrks about 8 yearsbuild-essential and python-dev is enough for my
-
ggnoredo about 8 yearsshould i use python3- for all packages if i want to run on python 3.5.1?
-
Antoine Brunel about 8 years@SummerSun If you're using python3, you should use: $sudo apt-get install python3-dev or $ sudo apt-get install python3.4-dev
-
Summer Sun about 8 years@antoinet but i am using python 2.7.4... I have solved this long ago but i don't remember any specific solution
-
XelharK almost 8 yearsThe only ones that are necessary are actually build-essential and python-dev
-
XiR_ almost 8 yearsJust installing this packages on ubuntu 14.4 did the trick for me: >sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-pyre Though this installed "python-dev" as dependency as next solution claims though it might be enough just this package
-
Ajeet Shah almost 8 yearsAnd for python2:
sudo apt-get install python-lxml
-
nikhil komawar almost 8 yearsI have a comment here for python 2 (2.7) that works with sudo apt-get install libffi-dev , I will agree with python3-dev for py34 solution that worked for me.
-
Cybersupernova over 7 years
sudo apt-get install python-dev
solves the problem -
Dário over 7 yearsNot only this solution helped me fix my
ffi.h
missing dependency but also helped fixing other missing dependencies. Thanks! -
Esteban over 7 yearsMe too. The accepted answer seems a little excessive.
-
Kenly over 7 years
Odoo
don't depend onpython-numpy
. -
viddik13 over 7 yearsHelped for python 3
-
Laxmikant over 7 yearsI had tried with
build-essential
andpython-dev
but it did not work then finally I just copied full linesudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev
And It worked like a charm :D -
DanMossa over 7 yearsThis worked for me as well without having to download a bunch from the accepted answer
-
Dodgie over 7 years@ShaneReustle The very last one, actually. Hah
-
shadyyx over 7 yearsThis one worked for me. I had all python and build packages from previous answers, I was missing these lib* packages. THANKS!
-
Muhammad Hassan over 7 yearsThis is the only solution worked for me in Ubuntu 16.04
-
Phyticist over 7 yearsI have solved my psycopg2 problem by installing postgresql-devel package on CentOS.
-
Or Duan about 7 yearsAs a side note, I just used sudo
apt-get install python3.6-dev
and it also worked. -
Mr_Spock almost 7 yearsDefinitely worked for me: Ubuntu 16.04 64-bit; zshell + tmux
-
Pobe almost 7 yearsThis is usually this library that is missing when I install cryptography package in python.
-
SteveJ over 6 yearsBoy that was tough -- I installed everything mentioned above on my system until this one finally fixed it for me. I'm using a virtualenv with python3.6. Thank you for that.
-
jefferson.macedo over 6 yearsThe installation of "python-dev" helped me. I'm installing yara through pip install. Thank you!
-
ivanleoncz about 6 yearsFor sure, this compiler error presented on the question, is very relative. My case, for example, was just like yours: I was installing
bcrypt
viapip3
, and the output was quite huge and observing the first messages frompip3 install bcrypt
, I realized thatlibffi-dev
was the package which was causing all the trouble for the next steps of the installation process. Well observed, friend :). I hope you don't my mind, if I give some cents to your answer, which for me, deserves a better consideration. Regards. -
Karan about 6 yearssudo apt-get install python3.6-dev solved for me . because i updated to 3.6
-
Paulie about 6 yearsAnswer does not give a definitive answer to the question, just asks the user to install a bunch of packages in 'hopes' that one of them fixes your problem.
-
Radovan Svedic about 6 yearsSolution for Python 2.7 WORKED for Python 2.7.6 on Ubuntu 14.04.1 LTS. Perfect!
-
claudod almost 6 yearsThis was the issue for me too. I could tell it from the stdout line "src/pycurl.h:164:28: fatal error: openssl/ssl.h: No such file or directory" printed just before the line questioned in this post "error: command 'x86_64-linux-gnu-gcc' failed with exit status 1"
-
kRazzy R almost 6 years
E: Unable to locate package lxml
I get the following. :( -
ecolell almost 6 yearsOr executing
sudo apt-get install python3-dev
. -
Jay Modi over 5 yearsOn the general note, I later checked the setup.py file of oursql package and found out that it uses mysqld and thus I installed
sudo apt-get install libmysqld-dev
and it worked for me. -
Jay Modi over 5 yearsmacOS solution for oursql installation problems: askubuntu.com/questions/663919/…
-
Paulie over 5 yearsThanks for the comment @Schütze, but this isn't the accepted answer for the question, I'm always happy to help, so you can tell me about your error or you can try the accepted or other solutions, or raise a question on Stackoverflow to solve your problem.
-
SolitaryReaper over 5 yearsFor python3.x use the command $sudo apt-get install python3.x-dev
-
Samuel Dauzon over 5 yearsI use additionally apt-get install build-essential to solve my problem.
-
yunus over 5 yearsUsually this Happens when we dont use environment
-
xaos_xv over 5 yearsWorked on void linux.
-
Anas Tiour about 5 yearsThis will most likely work on clean systems, but in my case all I was missing was the 3 packages:
libldap2-dev
,libpq-dev
andlibsasl2-dev
-
Kushan Gunasekera almost 5 years@kRazzyR try to run
sudo apt-get install python-lxml
command -
Anthony Collins almost 5 yearsHelped for python 3.7
-
nnov over 4 yearsif you are using ubuntu, you also need to install build-essential. check this answer: stackoverflow.com/a/54534118/3453776
-
nnov over 4 yearsin ubuntu you only need build-essential and python-dev, in linux mint only python-dev
-
nnov over 4 yearsi would add that in ubuntu you also have to install build-essential. i've just solved this issue with it. in linux mint i had the same problem and python-dev solved it alone.
-
Artisan over 4 yearslibssl-dev did it for me
-
Jeetendra Pujari about 4 yearsThis really helped. I was missing file called
pcrecpp.h
. And the package I had to install waslibpcre3-dev
. -
Furqan Hashim about 4 years@Paulie how to install in a virtualenv? I've python 3.6 in venv and globally python3.6, it is installed for global python3.6 but can't install for python3.6. Any work around?
-
Paulie about 4 years@FurqanHashim My solution isn't to fix odoo-server, it's a fix for the actual error.
-
Malachi Bazar about 4 yearsWorked for Ubuntu 19.10 with Python 3.7
-
ambigus9 almost 4 yearsPerfect!! Solved!
-
Elinaldo Monteiro almost 4 yearsI'm using the Python3.8
sudo apt-get install python3.8-dev
-
Lord ST almost 4 yearsjust for adding more info, this error solved for me by answers from this QA -> [stackoverflow.com/q/34819221/4417806]
-
The Dodo almost 4 yearsFor ubuntu server 20.04, build-essential and python-dev did the job.
-
obotezat almost 4 yearsneeded
apt-get install python3.x-dev
for python 3.7 -
dexXxed over 3 years
$ sudo apt-get install python3.x-dev
worked forpython3.7
-
Sohaib Asif over 3 yearsWorked for Ubuntu 20.04 with Python 2.7
-
Ursin Brunner over 3 yearsWith every new version of python I land here again :-)
-
Aymen Alsaadi over 3 yearsYou only need
sudo apt-get install build-essential
andsudo apt-get install python3.*-dev
-
Ajay Kumar over 3 yearsThanks.....this works for me ....for specific python version
-
StuckInPhDNoMore over 3 yearsI had already installed
python3.x-dev
but still had problems, but Samuel's suggestion ofsudo apt-get install build-essential
worked perfectly -
Joseph Zhou over 3 yearsbuild-essential solved the problem for me.
-
bileleleuch about 3 yearsThank you it worked for 20.04 with python 3.8
-
Saeed about 3 years
sudo apt-get install python3.9-dev
works like a charm :) -
automationleg almost 3 yearspython3.7-dev package helped me. All the others not really. Only after I installed this one it worked.
-
hafiz031 almost 3 yearsMentioning python version is important, in my case this command installed
python-dev
for python 2.7 which didn't work. But when I mentioned the version like:sudo apt-get install python3.8-dev
this worked (I also had python 3.8 installed in my machine). See @kame's answer. -
Sal Borrelli almost 3 yearsIt might resolve the problem, no doubts about that, but I believe this is certainly not the "minimum" number of packages that achieve the same result. For example, installing
python3-dev
andgcc
was enough in my case. -
Amir Shabani almost 3 yearsThis worked for me. Ubuntu 18.04, Python 3.9.6.
-
Mark Anthony Libres almost 3 years@Shashank same as me i am using ubuntu 20.04 and Pycharm. i dont know why i need to install python3.x-dev to my source where it is already bulitin on pycharm env.
-
tno2007 almost 3 yearsIt is a lot of packages, but everyone's needs will be different. This answer is to ensure you have no issues. It's best too install and test each package, one by one, if your are concerned about too many packages
-
HeadzzZ almost 3 years
sudo apt-get install python3.8-dev
works perfectly on my Linux board. The other commands cannot. Thank you~ -
Eric over 2 yearsThis was the same issue I was facing i.e. "an error specific to the sql.h header file" and this solution worked!
-
William over 2 yearsworked for me. I install a specific old Python version (3.7) and needed to install further dependencies
-
Esben Eickhardt over 2 yearsSo clean that is it not even reasonable! Thanks!
-
Mahadev Gouda over 2 yearsYes i had the same issue , this worked fine for me
-
almanegra about 2 yearsYep that was the only thing I needed too!
-
Vikash Choudhary about 2 yearsFor me, adding the additional package including the mentioned as worked like a charm. "RUN apt-get update && apt-get install -y python3 python3-pip libffi-dev libssl-dev cargo \ && pip3 install typing_extensions pdfminer.six" We're using Docker for one of our services.
-
Blupon almost 2 yearsI only needed to install
libpq-dev
in my case (Ubuntu 20.04 with Python 3.8). Encountered the error while trying topip install psycopg2
.