Trying to install pip package fastavro==0.23.4 on linux rhel 7.8 but getting error:
creating build/temp.linux-x86_64-3.6/fastavro
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python3.6m -c fastavro/_read.c -o build/temp.linux-x86_64-3.6/fastavro/_read.o
fastavro/_read.c:4:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-p3u2ii2c/fastavro/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-57h05ysx-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-p3u2ii2c/fastavro/
I already have python3 devel packages:
yum list installed|grep -i devel|grep -i python
python-devel.x86_64 2.7.5-88.el7 #rhui-rhel-7-server-rhui-rpms
rh-python36-python-devel.x86_64 3.6.9-2.el7 #rhui-rhel-server-rhui-rhscl-7-rpms
rh-python38-python-devel.x86_64 3.8.0-15.el7 #rhui-rhel-server-rhui-rhscl-7-rpms
How can I resolve this ?
Fixed this issue by manually downloading package: "python3-devel-3.6.8-13.el7.x86_64.rpm" on my rhel machine, installing it using yum and running the pyhton3 pip install again.
Related
This question already has answers here:
fatal error: Python.h: No such file or directory
(35 answers)
Closed 2 years ago.
I've below pip installed in my system
$ pip --version
pip 19.3.1 from /usr/lib/python3.8/site-packages/pip (python 3.8)
python version installed in my system is -
$ python --version
Python 3.8.3
I'm trying to install python-language-server and encountered below error -
Running setup.py install for ujson ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-yoqmgayp/ujson/setup.py'"'"'; file='"'"'/tmp/pip-install-yoqmgayp/ujson/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-record-h4azsb93/install-record.txt --single-version-externally-managed --compile
cwd: /tmp/pip-install-yoqmgayp/ujson/
Complete output (16 lines):
Warning: 'classifiers' should be a list, got type 'filter'
running install
running build
running build_ext
building 'ujson' extension
creating build
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/python
creating build/temp.linux-x86_64-3.8/lib
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I./python -I./lib -I/usr/include/python3.8 -c ./python/ujson.c -o build/temp.linux-x86_64-3.8/./python/ujson.o -D_GNU_SOURCE
In file included from ./python/ujson.c:39:
./python/py_defines.h:39:10: fatal error: Python.h: No such file or directory
39 | #include
| ^~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-yoqmgayp/ujson/setup.py'"'"'; file='"'"'/tmp/pip-install-yoqmgayp/ujson/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-record-h4azsb93/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
Below is my OS details -
$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: Fedora
Description: Fedora release 32 (Thirty Two)
Release: 32
Codename: ThirtyTwo
How can I fix this error?
If you read the word message, it tells you what is wrong
./python/py_defines.h:39:10: fatal error: Python.h: No such file or directory
It says it can't find the header file. Ask dnf about what provides it:
sudo dnf provides '*/Python.h'
Then install that package (sudo dnf install ...) and retry your original command.
when I try to pip3 install tslearn on my ElementaryOS (similar to ubuntu) machine I get this error
building 'tslearn.cycc' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/tslearn
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/bruno/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c tslearn/cycc.c -o build/temp.linux-x86_64-3.6/tslearn/cycc.o
/usr/lib/gcc/x86_64-linux-gnu/7/cc1: error while loading shared libraries: libisl.so.19: cannot open shared object file: No such file or directory
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-5p7o5dn8/tslearn/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-tqrjth8y-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-5p7o5dn8/tslearn/
I've tried the solutions on this thread but nothing works. Any ideas? Thanks
In the end I fixed it by installing libisl, then going into the install location, locating libisl.so, and creating a symlink to point libisl.so.19 to it - by doing ln -s libisl.so libisl.so.19
I'm trying to install GDAL with python.But it failed with error.
The command I use is pip install GDAL.
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I/usr/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-2.7/extensions/gdal_wrap.o -std=c++11 -I/usr/include/gdal
extensions/gdal_wrap.cpp:3177:27: fatal error: cpl_vsi_error.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
and
----------------------------------------
Failed building wheel for GDAL
Running setup.py clean for GDAL
Failed to build GDAL
Installing collected packages: GDAL
Running setup.py install for GDAL ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-_spRXy/GDAL/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-NxpUaO-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying gdal.py -> build/lib.linux-x86_64-2.7
...
creating build/temp.linux-x86_64-2.7/extensions
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I/usr/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-2.7/extensions/gdal_wrap.o -std=c++11 -I/usr/include/gdal
extensions/gdal_wrap.cpp:3177:27: fatal error: cpl_vsi_error.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-_spRXy/GDAL/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-NxpUaO-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-_spRXy/GDAL/
I've already tried sudo apt-get install build-essential, but stil the same error occurs.
Here is the answer I found that worked:
"you might have to change the gdal version to the version installed on your host. So I had to do this since I have gdal==1.11.2 on my host:"
pip install gdal==1.11.2 --global-option=build_ext --global-option="-I/usr/include/gdal/"
Where the 1.11.2 should be updated to your gdal_version, which can be found in the line # define GDAL_RELEASE_NAME of the /usr/include/gdal/gdal_version.h file (at least on my system running Kubuntu).
Link to original github page with this answer from Basaks, mentioned in the comment above by Craicerjack.
hello guys i tried to install a python module called gmpy2 with pip install gmpy2 but error occurs during wheel building
running install
running build
running build_ext
building 'gmpy2' extension
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/src
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-
prototypes -g -fdebug-prefix-map=/build/python3.6-LpWKty/python3.6-
3.6.5~rc1=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-
protector-strong -Wformat -Werror=format-security -Wdate-time -
D_FORTIFY_SOURCE=2 -fPIC -DWITHMPFR -DWITHMPC -
I/usr/include/python3.6m -c src/gmpy2.c -o build/temp.linux-x86_64-
3.6/src/gmpy2.o
In file included from src/gmpy2.c:426:0:
src/gmpy.h:252:12: fatal error: mpfr.h: No such file or directory
# include "mpfr.h"
^~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
`
`
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools,
tokenize;__file__='/tmp/pip-build-
onv0x975/gmpy2/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-izolloyr-record/install-record.txt --single-version-
externally-managed --compile" failed with error code 1 in /tmp/pip-
build-onv0x975/gmpy2/
I tried both pip and pip3
You need to download MPFR source code and compile it. See installation manual: https://gmpy2.readthedocs.io/en/latest/intro.html#installation
I tried to install seccomplite package with pip. instead I got these errors. Please help.
Collecting seccomplite
Using cached seccomplite-0.1.0a3.tar.gz
Installing collected packages: seccomplite
Running setup.py install for seccomplite ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-HRGD9U/seccomplite/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-JqYhgy-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
building 'seccomplite' extension
creating build
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DMODULE_NAME="seccomplite" -DMAJOR_VERSION="0" -DMINOR_VERSION="1" -DDEVELOP_VERSION="0a3" -DMODULE_DESCRIPTION="lightweight libseccomp2 python bridge" -I/usr/include/python2.7 -c filter.c -o build/temp.linux-x86_64-2.7/filter.o
gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-HRGD9U/seccomplite/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-JqYhgy-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-HRGD9U/seccomplite/