command 'x86_64-linux-gnu-gcc' failed with exit status 1
Asked Answered
R

5

54

I tried to install "scholarly" package, but I keep receiving this error:

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/_openssl.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/_openssl.o
build/temp.linux-x86_64-2.7/_openssl.c:434:30: fatal error: openssl/opensslv.h: No such file or directory
compilation terminated.

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


Command "/usr/bin/python -u -c "import setuptools,tokenize;__file__='/tmp/pip-build-0OXGEx/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-EdgZGB-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-0OXGEx/cryptography/

Already tried the solutions in the following post, but it didnt work:

pip install lxml error

Reprove answered 5/1, 2017 at 19:13 Comment(4)
What command are you running?Sarto
You are missing files from the ssl dev package: sudo apt-get update && sudo apt-get install libssl-dev to get them. There likely will be other dependencies.Interventionist
pip install scholarly @SartoReprove
didnt work @InterventionistReprove
K
126

I had the same problem. This one helped me:

sudo apt-get install build-essential libssl-dev libffi-dev python3-dev

If you are using python2, try to replace python3-dev with python-dev

Khotan answered 9/3, 2017 at 8:45 Comment(9)
Just FYI: I had the exact same issue & installing libssl-dev by itself was sufficient to fix this for me. It's usually a good idea to get python-dev from apt. That said: if you're using Anaconda or some other python-environment-engine, pay attention that you don't mess up your $PATH by installing python-dev.Desertion
@Dana Friedlander: It resolved my issue. Cool.. Thanks !!Andriaandriana
a small comment about python3-dev was helpful for me. Thank you!Hills
Thanks, I had the same problem installing psutil, this solved it for python3Garek
run sudo apt update if you are facing this on a serverCamshaft
That "use python3 instead of python" was really helpful :)Iffy
this did not helpSpindlelegs
And, you can also give pip a go : python3 -m pip install pip --upgradeTillis
Didn't solve it for me, trying to install psycopg2Amylose
G
10

In a newly created python 3.6, virtual environment and trying to run my setup.py of my module, the following command solved the error,

sudo apt-get install python3.6-dev

For me the error was,

... Python.h: No such file or directory
18 | #include "Python.h"
  |          ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

The remaining packages build-essential libssl-dev libffi-dev there were already installed from a previous time.

Goren answered 12/5, 2021 at 16:13 Comment(1)
This solved the issue for me. My error was the same but occurred when I was installing pyvoronoi module for a pdf parser.Painless
D
5

Install lib32ncurses5-dev:

sudo apt-get install lib32ncurses5-dev
Desired answered 10/10, 2017 at 19:47 Comment(0)
E
3

In my case the exception was:

Exception:

#include <snappy-c.h>
          ^~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit
status 1

And I solved it by installing these libraries:

sudo apt-get install libsnappy-dev

pip3 install python-snappy

Here is a great explanation about the cause of the exception and how we can get rid of that.

Elliottellipse answered 29/1, 2020 at 11:8 Comment(0)
B
0

I had this problem when installing !pip install google-colab outside of Google Colab, on another platform, but still inside a Jupyter Notebook of course. The fix was not to install it at all since no other platform than Google Colab can install the google-colab module.

This is the long !pip install google-colab error output, it ends with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1:

Defaulting to user installation because normal site-packages is not writeable
Collecting google-colab
  Using cached google_colab-1.0.0-py2.py3-none-any.whl
Collecting google-auth~=1.4.0 (from google-colab)
  Using cached google_auth-1.4.2-py2.py3-none-any.whl (64 kB)
Requirement already satisfied: ipykernel~=4.6.0 in /srv/home/tester/.local/lib/python3.8/site-packages (from google-colab) (4.6.1)
Requirement already satisfied: ipython~=5.5.0 in /srv/home/tester/.local/lib/python3.8/site-packages (from google-colab) (5.5.0)
Collecting notebook~=5.2.0 (from google-colab)
  Using cached notebook-5.2.2-py2.py3-none-any.whl (8.0 MB)
Requirement already satisfied: six~=1.12.0 in /srv/home/tester/.local/lib/python3.8/site-packages (from google-colab) (1.12.0)
Collecting pandas~=0.24.0 (from google-colab)
  Using cached pandas-0.24.2.tar.gz (11.8 MB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: portpicker~=1.2.0 in /srv/home/tester/.local/lib/python3.8/site-packages (from google-colab) (1.2.0)
...
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /usr/local/lib/python3.8/dist-packages (from packaging->nbconvert->notebook~=5.2.0->google-colab) (2.4.7)
Building wheels for collected packages: pandas
  Building wheel for pandas (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [2070 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.8
      creating build/lib.linux-x86_64-3.8/pandas
      copying pandas/__init__.py -> build/lib.linux-x86_64-3.8/pandas
      copying pandas/_version.py -> build/lib.linux-x86_64-3.8/pandas
      copying pandas/testing.py -> build/lib.linux-x86_64-3.8/pandas
      copying pandas/conftest.py -> build/lib.linux-x86_64-3.8/pandas
      creating build/lib.linux-x86_64-3.8/pandas/_libs
      copying pandas/_libs/__init__.py -> build/lib.linux-x86_64-3.8/pandas/_libs
      creating build/lib.linux-x86_64-3.8/pandas/io
      copying pandas/io/excel.py -> build/lib.linux-x86_64-3.8/pandas/io
      copying pandas/io/api.py -> build/lib.linux-x86_64-3.8/pandas/io
      copying pandas/io/html.py -> build/lib.linux-x86_64-3.8/pandas/io
      copying pandas/io/pytables.py -> build/lib.linux-x86_64-3.8/pandas/io
      copying pandas/io/feather_format.py -> build/lib.linux-x86_64-3.8/pandas/io
      copying pandas/io/__init__.py -> build/lib.linux-x86_64-3.8/pandas/io
      copying pandas/io/s3.py -> build/lib.linux-x86_64-3.8/pandas/io
...
      creating build/lib.linux-x86_64-3.8/pandas/api/types
      copying pandas/api/types/__init__.py -> build/lib.linux-x86_64-3.8/pandas/api/types
...
      pandas/_libs/interval.c:112435:41: warning: comparison of integer expressions of different signedness: ‘__pyx_t_5numpy_uint64_t’ {aka ‘long unsigned int’} and ‘__pyx_t_5numpy_int64_t’ {aka ‘long int’} [-Wsign-compare]
      112435 |         __pyx_t_14 = ((!((__pyx_v_point < (*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ (__pyx_v_values.data + __pyx_t_12 * __pyx_v_values.strides[0]) )))) != 0)) != 0);
...
      pandas/_libs/src/parser/tokenizer.c: In function ‘_tokenize_helper’:
      pandas/_libs/src/parser/tokenizer.c:1369:47: warning: comparison of integer expressions of different signedness: ‘int64_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
       1369 |         if (!all && self->lines - start_lines >= nrows) break;
            |                                               ^~
      In file included from /usr/include/string.h:495,
                       from pandas/_libs/src/parser/tokenizer.h:18,
                       from pandas/_libs/src/parser/tokenizer.c:20:
      In function ‘strncpy’,
          inlined from ‘append_warning’ at pandas/_libs/src/parser/tokenizer.c:435:13,
          inlined from ‘end_line’ at pandas/_libs/src/parser/tokenizer.c:506:17:
      /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
        106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
            |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      pandas/_libs/src/parser/tokenizer.c: In function ‘end_line’:
...
        189 | static PyDateTime_CAPI *PyDateTimeAPI = NULL;
            |                         ^~~~~~~~~~~~~
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./pandas/_libs/tslibs -Ipandas/_libs/tslibs -Ipandas/_libs/tslibs/src -I/srv/home/tester/.local/lib/python3.8/site-packages/numpy/core/include -I/usr/include/python3.8 -c pandas/_libs/tslibs/src/datetime/np_datetime_strings.c -o build/temp.linux-x86_64-3.8/pandas/_libs/tslibs/src/datetime/np_datetime_strings.o -Wno-unused-function
...
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Ipandas/_libs/src/ujson/python -Ipandas/_libs/src/ujson/lib -Ipandas/_libs/src/datetime -I/srv/home/tester/.local/lib/python3.8/site-packages/numpy/core/include -I/usr/include/python3.8 -c pandas/_libs/src/ujson/python/objToJSON.c -o build/temp.linux-x86_64-3.8/pandas/_libs/src/ujson/python/objToJSON.o -D_GNU_SOURCE -Wno-unused-function
      In file included from /srv/home/tester/.local/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1960,
                       from /srv/home/tester/.local/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                       from /srv/home/tester/.local/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:5,
                       from pandas/_libs/src/ujson/python/objToJSON.c:44:
      /srv/home/tester/.local/lib/python3.8/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
         17 | #warning "Using deprecated NumPy API, disable it with " \
            |  ^~~~~~~
      pandas/_libs/src/ujson/python/objToJSON.c: In function ‘initObjToJSON’:
      pandas/_libs/src/ujson/python/objToJSON.c:194:12: error: ‘NUMPY_IMPORT_ARRAY_RETVAL’ undeclared (first use in this function)
        194 |     return NUMPY_IMPORT_ARRAY_RETVAL;
            |            ^~~~~~~~~~~~~~~~~~~~~~~~~
      pandas/_libs/src/ujson/python/objToJSON.c:194:12: note: each undeclared identifier is reported only once for each function it appears in
      pandas/_libs/src/ujson/python/objToJSON.c:195:1: warning: control reaches end of non-void function [-Wreturn-type]
        195 | }
            | ^
      error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pandas
  Running setup.py clean for pandas

Failed to build pandas
ERROR: Could not build wheels for pandas, which is required to install pyproject.toml-based projects
Bo answered 18/12, 2023 at 21:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.