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

PythonGccPipOdoo

Python Problem Overview


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?

Python Solutions


Solution 1 - Python

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 2 - Python

> 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 3 - Python

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 4 - Python

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

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

Solution 6 - Python

$ sudo apt-get install gcc
$ sudo apt-get install python-dateutil python-docutils python-feedparser python-gdata python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid python-psycopg2 python-psutil python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-unittest2 python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi

OR TRY THIS:

$ sudo apt-get install libxml2-dev libxslt1-dev

Solution 7 - Python

For me none of above worked. However, I solved problem with installing libssl-dev.

sudo apt-get install libssl-dev

This might work if you have same error message as in my case:

> fatal error: openssl/opensslv.h: No such file or directory ... .... > command 'x86_64-linux-gnu-gcc' failed with exit status 1

Solution 8 - Python

In my case, it was missing package libffi-dev.

What worked:

sudo apt-get install libffi-dev

Solution 9 - Python

In my case following command did the magic

sudo apt-get install gcc python3-dev

if the above command didn't work try following two commands

sudo apt-get install gcc python-dev
  1. this is the case when you want it to install for the python version set as default python in your machine.

Or

sudo apt-get install gcc python3.x-dev

2) where python3.x represent the version number of python installed on your machine.

Solution 10 - Python

on ubuntu 14.04:

sudo apt-file search ffi.h 

returned:

chipmunk-dev: /usr/include/chipmunk/chipmunk_ffi.h
ghc-doc: /usr/share/doc/ghc-doc/html/users_guide/ffi.html
jython-doc: /usr/share/doc/jython-doc/html/javadoc/org/python/modules/jffi/jffi.html
libffi-dev: /usr/include/x86_64-linux-gnu/ffi.h
libffi-dev: /usr/share/doc/libffi6/html/Using-libffi.html
libgirepository1.0-dev: /usr/include/gobject-introspection-1.0/girffi.h
libgirepository1.0-doc: /usr/share/gtk-doc/html/gi/gi-girffi.html
mlton-basis: /usr/lib/mlton/include/basis-ffi.h
pypy-doc: /usr/share/doc/pypy-doc/html/config/objspace.usemodules._ffi.html
pypy-doc: /usr/share/doc/pypy-doc/html/config/objspace.usemodules._rawffi.html
pypy-doc: /usr/share/doc/pypy-doc/html/rffi.html

I chose to install libffi-dev

sudo apt-get install libffi-dev

worked perfectly

Solution 11 - Python

In my case pip was unable to install libraries, I tried solutions given above, but none worked but the below worked for me:

sudo apt upgrade gcc

Solution 12 - Python

Despite being an old question, I'll add my opinion.

I think the right answer depends on the error message of the gcc compiler, something like "Missing xxxx.h"

This might help in some cases:

sudo apt-get install build-essential python-dev

Solution 13 - Python

This was enough for me:

sudo apt-get install build-essential

Solution 14 - Python

In Linux Mint with python3

$ sudo apt install build-essential python3-dev

should be enough

Solution 15 - Python

below answer worked for me, you can try:

sudo apt-get install python3-lxml

Solution 16 - Python

> Error : error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Executing sudo apt-get install python-dev solved the error.

Solution 17 - Python

After upgrade my computer with pip today, and check the other answers here, I can tell you that it could be ANYTHING. You should check error by error, looking for what's the specific library that you need. In my case, these were the libraries that I had to install:

$ sudo apt-get install libssl-dev
$ sudo apt-get install libffi-dev
$ sudo apt-get install libjpeg-dev
$ sudo apt-get install libvirt-dev
$ sudo apt-get install libsqlite3-dev
$ sudo apt-get install libcurl4-openssl-dev
$ sudo apt-get install libxml2-dev libxslt1-dev python-dev

HTH

Solution 18 - Python

This works for me, 12.04, python2.7.6

sudo apt-get install libxml2 libxml2-dev libxslt1-dev
sudo apt-get install lxml

Solution 19 - Python

Using Ubuntu 14.04 LTS with a virtualenv running python 3.5, I had to do:

sudo apt-get install python3.5-dev

The other commands:

sudo apt-get install python-dev
sudo apt-get install python3-dev

Did not help. I think this is because the virtualenv needs to rely on the system-wide python-dev package and it must match the virtualenv's python version. However, using the above commands installs python-dev for python 2.x and the python 3.x that comes with Ubuntu 14.04 which is 3.4, not 3.5.

Solution 20 - Python

Tip: Please do not consider this as an answer. Just to help someone else too.

I had similar issue while installing psycopg2. I installedbuild-essential, python-dev and also libpq-dev but it thrown same error.

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

As I was in hurry in deployment so finally just copied full line from @user3440631's answer.

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. but could not find which package has resolved my issue. Please update the comment if anyone have idea about psycopg2 dependancy package from above command.

Solution 21 - Python

first you need to find out what the actual problem was. what you're seeing is that the C compiler failed but you don't yet know why. scroll up to where you get the original error. in my case, trying to install some packages using pip3, I found:

    Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-4u59c_8b/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-itjeh3va-record/install-record.txt --single-version-externally-managed --compile --user:
    c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory

 #include <ffi.h>

                 ^

compilation terminated.

so in my case I needed to install libffi-dev.

Solution 22 - Python

In my case the command sudo apt-get install unixodbc-dev resolved the issue. I was getting an error specific to the sql.h header file.

Solution 23 - Python

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

Lot of time I got the same error when installing M2Crypto & pygraphviz and installed all the things mention in the approved answer. But this below line solved all my problems with the other packages in approved answer too.

sudo apt-get install libssl-dev swig
sudo apt-get install -y graphviz-dev

This swig package saved my life as the solution for M2Crypto and graphviz-dev for pygraphviz. I hope this will help someone.

Solution 24 - Python

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

sudo easy_install greenlet

sudo easy_install gevent

Solution 25 - Python

For me I had to make sure I was using the correct version of cryptography. pip.freeze had and older version and once I used the latest the problem when away.

Solution 26 - Python

For Centos 7 Use below command to install Python Development Package

Python 2.7 > sudo yum install python-dev

Python 3.4

> sudo yum install python34-devel

Still if your problem not solved then try installing below packages -

> sudo yum install libffi-devel > > sudo yum install openssl-devel

Solution 27 - Python

None of the above answers worked for me when I had the same issue on my Ubuntu 14.04

However, this solved the error:

sudo apt-get install python-numpy libicu-dev

Solution 28 - Python

For me it helped to install libxml2-dev and libxslt1-dev.

sudo apt-get install libxml2-dev

Solution 29 - Python

My stack was like that:

> >                            ^
> >     In file included from /usr/include/openssl/ssl.h:156:0,
> >                      from OpenSSL/crypto/x509.h:17,
> >                      from OpenSSL/crypto/crypto.h:17,
> >                      from OpenSSL/crypto/crl.c:3:
> >     /usr/include/openssl/x509.h:751:15: note: previous declaration of ‘X509_REVOKED_dup’ was here
> >      X509_REVOKED *X509_REVOKED_dup(X509_REVOKED *rev);
> >                    ^
> >     error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
> >     
> >     ----------------------------------------   Rolling back uninstall of > pyOpenSSL Command "/home/marta/env/pb/bin/python -u -c
> "import setuptools,
> > tokenize;__file__='/tmp/pip-build-14ekWY/pyOpenSSL/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-2HERvW-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/marta/env/pb/include/site/python2.7/pyOpenSSL" failed with error
> > code 1 in /tmp/pip-build-14ekWY/pyOpenSSL/

in the same case, please consider the typo (bug) in one of the installation files and edit it manually by changing "X509_REVOKED_dup" to "X509_REVOKED_dupe" (no quotes). I have edited the x509.h file:

> sed -e's/X509_REVOKED_dup/X509_REVOKED_dupe/g' -i > usr/include/openssl/x509.h

and it worked for me, but please consult with the post linked below, as they edited another file:

> sed -e's/X509_REVOKED_dup/X509_REVOKED_dupe/g' -i OpenSSL/crypto/crl.c

https://groups.google.com/forum/#!topic/kivy-users/Qt0jNIOACZc

Solution 30 - Python

Like Robin Winslow says in a comment :

> I found my solution over here: stackoverflow.com/a/5178444/613540

In my case, my complete error message was :

/usr/bin/ld: cannot find -lz 
collect2: error: ld returned 1 exit status
error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

I was trying to install torrench :

sudo python3 setup.py install

With given stackoverflow link, I solve this issue by :

sudo apt install zlib1g-dev

Note that the following packages were already installed :

libxslt1-dev is already the newest version.
python3-dev is already the newest version.
libxml2-dev is already the newest version.

Hope that will help !

Solution 31 - Python

In my case, it was oursql that was causing the same(generic) error as below.

In file included from oursqlx/oursql.c:236:0:
  oursqlx/compat.h:13:19: fatal error: mysql.h: No such file or directory
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for oursql
  Running setup.py clean for oursql

So, I knew that I need to have libmysqlcppconn-dev package.

sudo apt-get install libmysqlcppconn-dev

And all good!

Solution 32 - Python

This Worked for me:

sudo apt install zlib1g-dev

Solution 33 - Python

In addition to some other helpful answers, if docker-compose brought you here--With your venv set, run:


easy_install docker-compose

Solution 34 - Python

While installing ssdeep i was getting same error Please check actual error can be something else Like i was also getting same but above this error there was an error fuzzy.h no file or directory and then i tried this apt-get -y install libfuzzy-dev

Work like charm

Solution 35 - Python

After installing a lot of libraries, the one that worked for me! was swig:

sudo apt-get install swig

The error arose when installing python's M2Crypto library.

:)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMadura DissanayakeView Question on Stackoverflow
Solution 1 - PythonPaulieView Answer on Stackoverflow
Solution 2 - PythonFredView Answer on Stackoverflow
Solution 3 - PythonMadura DissanayakeView Answer on Stackoverflow
Solution 4 - PythonKenlyView Answer on Stackoverflow
Solution 5 - PythonkameView Answer on Stackoverflow
Solution 6 - Pythonthe-runView Answer on Stackoverflow
Solution 7 - Pythonlinux_fanView Answer on Stackoverflow
Solution 8 - Pythonnikhil komawarView Answer on Stackoverflow
Solution 9 - PythonofficialrahulmandalView Answer on Stackoverflow
Solution 10 - PythonEvyatar SivanView Answer on Stackoverflow
Solution 11 - PythonyunusView Answer on Stackoverflow
Solution 12 - Pythonuser2106495View Answer on Stackoverflow
Solution 13 - PythonEvandro PomattiView Answer on Stackoverflow
Solution 14 - PythonsergiohzlzView Answer on Stackoverflow
Solution 15 - Pythonuser6393832View Answer on Stackoverflow
Solution 16 - PythonSukanya RamamurthyView Answer on Stackoverflow
Solution 17 - PythonMario SView Answer on Stackoverflow
Solution 18 - PythonJesse YanView Answer on Stackoverflow
Solution 19 - PythonCoderGuy123View Answer on Stackoverflow
Solution 20 - PythonLaxmikantView Answer on Stackoverflow
Solution 21 - Pythonjcomeau_ictxView Answer on Stackoverflow
Solution 22 - PythonSteven GView Answer on Stackoverflow
Solution 23 - PythonKushan GunasekeraView Answer on Stackoverflow
Solution 24 - PythonYogesh Nikam PatilView Answer on Stackoverflow
Solution 25 - PythonMorvis13View Answer on Stackoverflow
Solution 26 - PythonRahul SatalView Answer on Stackoverflow
Solution 27 - PythonmusicakcView Answer on Stackoverflow
Solution 28 - PythonPrimozView Answer on Stackoverflow
Solution 29 - PythonfannyView Answer on Stackoverflow
Solution 30 - PythonVeteaView Answer on Stackoverflow
Solution 31 - PythonJay ModiView Answer on Stackoverflow
Solution 32 - PythonRastinView Answer on Stackoverflow
Solution 33 - PythonBicameral MindView Answer on Stackoverflow
Solution 34 - PythonAkshay KumarView Answer on Stackoverflow
Solution 35 - PythonJulio CesarView Answer on Stackoverflow