setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

662,975

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 ...

Share:
662,975
Madura Dissanayake
Author by

Madura Dissanayake

Updated on December 15, 2021

Comments

  • Madura Dissanayake
    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
    Shashank over 9 years
    i 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
    Shane Reustle about 9 years
    Yeah, one of these packages might fix it but it would be nice to know which one particularly
  • 8bitjunkie
    8bitjunkie over 8 years
    This did not solve the problem for me: Reading state information... Done python-dev is already the newest version.
  • Alfabravo
    Alfabravo over 8 years
    build-essential and python-dev were enough in my case.
  • reggie
    reggie over 8 years
    Downvoted for not answering the question. Why do I have to install qt4-docs to fix this problem?
  • vinayrks
    vinayrks about 8 years
    build-essential and python-dev is enough for my
  • ggnoredo
    ggnoredo about 8 years
    should i use python3- for all packages if i want to run on python 3.5.1?
  • Antoine Brunel
    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
    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
    XelharK almost 8 years
    The only ones that are necessary are actually build-essential and python-dev
  • XiR_
    XiR_ almost 8 years
    Just 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
    Ajeet Shah almost 8 years
    And for python2:sudo apt-get install python-lxml
  • nikhil komawar
    nikhil komawar almost 8 years
    I 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
    Cybersupernova over 7 years
    sudo apt-get install python-dev solves the problem
  • Dário
    Dário over 7 years
    Not only this solution helped me fix my ffi.h missing dependency but also helped fixing other missing dependencies. Thanks!
  • Esteban
    Esteban over 7 years
    Me too. The accepted answer seems a little excessive.
  • Kenly
    Kenly over 7 years
    Odoo don't depend on python-numpy.
  • viddik13
    viddik13 over 7 years
    Helped for python 3
  • Laxmikant
    Laxmikant over 7 years
    I had tried with build-essential and python-dev but it did not work then finally I just copied full line sudo 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
    DanMossa over 7 years
    This worked for me as well without having to download a bunch from the accepted answer
  • Dodgie
    Dodgie over 7 years
    @ShaneReustle The very last one, actually. Hah
  • shadyyx
    shadyyx over 7 years
    This one worked for me. I had all python and build packages from previous answers, I was missing these lib* packages. THANKS!
  • Muhammad Hassan
    Muhammad Hassan over 7 years
    This is the only solution worked for me in Ubuntu 16.04
  • Phyticist
    Phyticist over 7 years
    I have solved my psycopg2 problem by installing postgresql-devel package on CentOS.
  • Or Duan
    Or Duan about 7 years
    As a side note, I just used sudo apt-get install python3.6-dev and it also worked.
  • Mr_Spock
    Mr_Spock almost 7 years
    Definitely worked for me: Ubuntu 16.04 64-bit; zshell + tmux
  • Pobe
    Pobe almost 7 years
    This is usually this library that is missing when I install cryptography package in python.
  • SteveJ
    SteveJ over 6 years
    Boy 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
    jefferson.macedo over 6 years
    The installation of "python-dev" helped me. I'm installing yara through pip install. Thank you!
  • ivanleoncz
    ivanleoncz about 6 years
    For sure, this compiler error presented on the question, is very relative. My case, for example, was just like yours: I was installing bcrypt via pip3, and the output was quite huge and observing the first messages from pip3 install bcrypt, I realized that libffi-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
    Karan about 6 years
    sudo apt-get install python3.6-dev solved for me . because i updated to 3.6
  • Paulie
    Paulie about 6 years
    Answer 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
    Radovan Svedic about 6 years
    Solution for Python 2.7 WORKED for Python 2.7.6 on Ubuntu 14.04.1 LTS. Perfect!
  • claudod
    claudod almost 6 years
    This 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
    kRazzy R almost 6 years
    E: Unable to locate package lxml I get the following. :(
  • ecolell
    ecolell almost 6 years
    Or executing sudo apt-get install python3-dev.
  • Jay Modi
    Jay Modi over 5 years
    On 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
    Jay Modi over 5 years
    macOS solution for oursql installation problems: askubuntu.com/questions/663919/…
  • Paulie
    Paulie over 5 years
    Thanks 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
    SolitaryReaper over 5 years
    For python3.x use the command $sudo apt-get install python3.x-dev
  • Samuel Dauzon
    Samuel Dauzon over 5 years
    I use additionally apt-get install build-essential to solve my problem.
  • yunus
    yunus over 5 years
    Usually this Happens when we dont use environment
  • xaos_xv
    xaos_xv over 5 years
    Worked on void linux.
  • Anas Tiour
    Anas Tiour about 5 years
    This will most likely work on clean systems, but in my case all I was missing was the 3 packages: libldap2-dev, libpq-dev and libsasl2-dev
  • Kushan Gunasekera
    Kushan Gunasekera almost 5 years
    @kRazzyR try to run sudo apt-get install python-lxml command
  • Anthony Collins
    Anthony Collins almost 5 years
    Helped for python 3.7
  • nnov
    nnov over 4 years
    if you are using ubuntu, you also need to install build-essential. check this answer: stackoverflow.com/a/54534118/3453776
  • nnov
    nnov over 4 years
    in ubuntu you only need build-essential and python-dev, in linux mint only python-dev
  • nnov
    nnov over 4 years
    i 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
    Artisan over 4 years
    libssl-dev did it for me
  • Jeetendra Pujari
    Jeetendra Pujari about 4 years
    This really helped. I was missing file called pcrecpp.h. And the package I had to install was libpcre3-dev.
  • Furqan Hashim
    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
    Paulie about 4 years
    @FurqanHashim My solution isn't to fix odoo-server, it's a fix for the actual error.
  • Malachi Bazar
    Malachi Bazar about 4 years
    Worked for Ubuntu 19.10 with Python 3.7
  • ambigus9
    ambigus9 almost 4 years
    Perfect!! Solved!
  • Elinaldo Monteiro
    Elinaldo Monteiro almost 4 years
    I'm using the Python3.8 sudo apt-get install python3.8-dev
  • Lord ST
    Lord ST almost 4 years
    just for adding more info, this error solved for me by answers from this QA -> [stackoverflow.com/q/34819221/4417806]
  • The Dodo
    The Dodo almost 4 years
    For ubuntu server 20.04, build-essential and python-dev did the job.
  • obotezat
    obotezat almost 4 years
    needed apt-get install python3.x-dev for python 3.7
  • dexXxed
    dexXxed over 3 years
    $ sudo apt-get install python3.x-dev worked for python3.7
  • Sohaib Asif
    Sohaib Asif over 3 years
    Worked for Ubuntu 20.04 with Python 2.7
  • Ursin Brunner
    Ursin Brunner over 3 years
    With every new version of python I land here again :-)
  • Aymen Alsaadi
    Aymen Alsaadi over 3 years
    You only need sudo apt-get install build-essential and sudo apt-get install python3.*-dev
  • Ajay Kumar
    Ajay Kumar over 3 years
    Thanks.....this works for me ....for specific python version
  • StuckInPhDNoMore
    StuckInPhDNoMore over 3 years
    I had already installed python3.x-dev but still had problems, but Samuel's suggestion of sudo apt-get install build-essential worked perfectly
  • Joseph Zhou
    Joseph Zhou over 3 years
    build-essential solved the problem for me.
  • bileleleuch
    bileleleuch about 3 years
    Thank you it worked for 20.04 with python 3.8
  • Saeed
    Saeed about 3 years
    sudo apt-get install python3.9-dev works like a charm :)
  • automationleg
    automationleg almost 3 years
    python3.7-dev package helped me. All the others not really. Only after I installed this one it worked.
  • hafiz031
    hafiz031 almost 3 years
    Mentioning 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
    Sal Borrelli almost 3 years
    It 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 and gcc was enough in my case.
  • Amir Shabani
    Amir Shabani almost 3 years
    This worked for me. Ubuntu 18.04, Python 3.9.6.
  • Mark Anthony Libres
    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
    tno2007 almost 3 years
    It 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
    HeadzzZ almost 3 years
    sudo apt-get install python3.8-dev works perfectly on my Linux board. The other commands cannot. Thank you~
  • Eric
    Eric over 2 years
    This was the same issue I was facing i.e. "an error specific to the sql.h header file" and this solution worked!
  • William
    William over 2 years
    worked for me. I install a specific old Python version (3.7) and needed to install further dependencies
  • Esben Eickhardt
    Esben Eickhardt over 2 years
    So clean that is it not even reasonable! Thanks!
  • Mahadev Gouda
    Mahadev Gouda over 2 years
    Yes i had the same issue , this worked fine for me
  • almanegra
    almanegra about 2 years
    Yep that was the only thing I needed too!
  • Vikash Choudhary
    Vikash Choudhary about 2 years
    For 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
    Blupon almost 2 years
    I only needed to install libpq-dev in my case (Ubuntu 20.04 with Python 3.8). Encountered the error while trying to pip install psycopg2.