gcc Internal error on lxml installation CentOS - python

I am having some trouble installing lxml on CentOS-6. I have tried the solutions of some similar questions like, pip install lxml error or Setup.py: install lxml with Python2.6 on CentOS but these did not work. How to install it correctly?
after issuing,
pip install lxml
The log is like this,
Downloading/unpacking lxml
Running setup.py egg_info for package lxml
/usr/lib64/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.4.0.
Building without Cython.
Using build configuration of libxslt 1.1.26
Building against libxml2/libxslt in the following directory: /usr/lib64
Installing collected packages: lxml
Running setup.py install for lxml
/usr/lib64/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.4.0.
Building without Cython.
Using build configuration of libxslt 1.1.26
Building against libxml2/libxslt in the following directory: /usr/lib64
building 'lxml.etree' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/libxml2 -I/tmp/pip-build-root/lxml/src/lxml/includes -I/usr/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.6/src/lxml/lxml.etree.o -w
gcc: Internal error: Killed (program cc1)
Please submit a full bug report.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
error: command 'gcc' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-root/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-07a07D-record/install-record.txt --single-version-externally-managed:
/usr/lib64/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.4.0.
Building without Cython.
Using build configuration of libxslt 1.1.26
Building against libxml2/libxslt in the following directory: /usr/lib64
running install
running build
running build_py
copying src/lxml/includes/lxml-version.h -> build/lib.linux-x86_64-2.6/lxml/includes
running build_ext
building 'lxml.etree' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/libxml2 -I/tmp/pip-build-root/lxml/src/lxml/includes -I/usr/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.6/src/lxml/lxml.etree.o -w
gcc: Internal error: Killed (program cc1)
Please submit a full bug report.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-root/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-07a07D-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-root/lxml
Storing complete log in /root/.pip/pip.log
Traceback in pip.log:
Exception information:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/pip/basecommand.py", line 139, in main
status = self.run(options, args)
File "/usr/lib/python2.6/site-packages/pip/commands/install.py", line 271, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/usr/lib/python2.6/site-packages/pip/req.py", line 1185, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/usr/lib/python2.6/site-packages/pip/req.py", line 592, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File "/usr/lib/python2.6/site-packages/pip/util.py", line 662, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-root/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-cAMY23-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-root/lxml
I am using Python 2.6.6 on CentOS release 6.5.

During fresh environment setups/package installation the most common issues one may face are as follows:
gcc is not installed - a C compiler is needed for building Python packages as the core is C.
$sudo yum install gcc
'error: command 'gcc' failed with exit status 1' happens when the header files (#include ) is not found i.e. the dependencies are not installed
Solution: install the system level dependencies (development packages)
$sudo yum install libxml2-devel libxml++-devel libxslt-devel
while in your case, 'gcc: Internal error: Killed (program cc1)' can't be the above possibilities, the dependencies are there, as not some 'not found' error for any missing header files, or any other syntax level error.
What has happened (probably), the gcc compiler crashed. There's a fair amount of possibility it's a memory problem i.e. low memory.
Though you haven't mentioned whether you have setup a VM or a native installation - usually we allocate limited memory while setting up VM. If you're using VM the possible way out here is to increase the allocated memory for the CentOS VM, or free some memory by closing any unnecessary running programs and services.
P.S. I had the same problem while installing lxml, and resolved it with more memory.

Related

Failed building wheel for trm.pgplot

I am working on Ubuntu 18.04 and Python 3.6 and getting the following error while installing the package:
I am trying normal pip installation:
pip3 install . --user
and getting the following error message:
Processing /home/chinmay/trm-pgplot
Building wheels for collected packages: trm.pgplot
Running setup.py bdist_wheel for trm.pgplot ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools,
tokenize;file='/tmp/pip-b_8sag87-build/setup.py';f=getattr(tokenize,
'open', open)(file);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d
/tmp/tmp6x5jsk6hpip-wheel- --python-tag cp36:
running bdist_wheel
running build
running build_py
package init file 'trm/init.py' not found (or not a regular file)
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/trm
creating build/lib.linux-x86_64-3.6/trm/pgplot
copying trm/pgplot/init.py -> build/lib.linux-x86_64-3.6/trm/pgplot
running build_ext
building 'trm.pgplot._pgplot' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/trm
creating build/temp.linux-x86_64-3.6/trm/pgplot
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 -DMAJOR_VERSION=0 -DMINOR_VERSION=1 -I/home/chinmay/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/local/pgplot/ -I/usr/include/python3.6m -c trm/pgplot/_pgplot.c -o build/temp.linux-x86_64-3.6/trm/pgplot/_pgplot.o
In file included from /home/chinmay/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1822:0,
from /home/chinmay/.local/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /home/chinmay/.local/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from trm/pgplot/_pgplot.c:791:
/home/chinmay/.local/lib/python3.6/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]
#warning "Using deprecated NumPy API, disable it with "
^~~~~~~
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.6/trm/pgplot/_pgplot.o -L/usr/X11R6/lib
-L/opt/local/lib -L/usr/local/pgplot/ -lcpgplot -lpgplot -lX11 -lm -lgfortran -lpng -lz -o build/lib.linux-x86_64-3.6/trm/pgplot/_pgplot.cpython-36m-x86_64-linux-gnu.so
/usr/bin/ld: /usr/local/pgplot//libpgplot.a(xwdriv.o): relocation R_X86_64_PC32 against symbol `stderr##GLIBC_2.2.5' can not
be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
try this: apt-get install libjpeg-dev zlib1g-dev
then try this: pip3 install Pillow (it worked for me)
also try updating the setup tools by: sudo pip install -U setuptools
You need c++ compiler
sudo apt install g++

python application dependency fastavro

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.

Mac OS: Catalina: unable to execute 'gcc': No such file or directory

MAC OS Catalina(10.15.1) seems to have created some problems for building code that uses gcc. I am trying to build a python application which is running into the following error.
Running setup.py install for pdftotext: started
Running setup.py install for pdftotext: finished with status 'error'
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yzaiz97e/pdftotext/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-67h0h5_9-record/install-record.txt --single-version-externally-managed --compile:
WARNING: pkg-config not found--guessing at poppler version.
If the build fails, install pkg-config and try again.
/usr/lib64/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
running install
running build
running build_ext
building 'pdftotext' extension
creating build
creating build/temp.linux-x86_64-3.7
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 -DPOPPLER_CPP_AT_LEAST_0_30_0=1 -I/usr/include/python3.7m -c pdftotext.cpp -o build/temp.linux-x86_64-3.7/pdftotext.o -Wall
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
gcc is definitely installed on the system but somehow not visible to pip installer.
which gcc
/usr/bin/gcc
packaging % gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.8)
Target: x86_64-apple-darwin19.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
Any help to debug the issue would be appreciated.

pip install module error

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

python.h not found when trying to install gevent-socketio

here is my error when I try to install gevent-socketio
Installing collected packages: gevent, greenlet
Running setup.py install for gevent
building 'gevent.core' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes >-fPIC -DLIBEV_EMBED=1 -DEV_COMMON= -DEV_CHECK_ENABLE=0 -DEV_CLEANUP_ENABLE=0 >-DEV_EMBED_ENABLE=0 -DEV_PERIODIC_ENABLE=0 -Ibuild/temp.linux-x86_64-2.7/libev -Ilibev >-I/usr/include/python2.7 -c gevent/gevent.core.c -o build/temp.linux-x86_64-2.7/gevent/gevent.core.o
gevent/gevent.core.c:17:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools;file='/var/www/bleu/build/gevent/setup.py';exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" install --single-version-externally-managed --record /tmp/pip-_kv6Fy-record/install-record.txt:
running install
running build
running build_py
running build_ext
building 'gevent.core' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC > -DLIBEV_EMBED=1 -DEV_COMMON= -DEV_CHECK_ENABLE=0 -DEV_CLEANUP_ENABLE=0 -DEV_EMBED_ENABLE=0 -DEV_PERIODIC_ENABLE=0 -Ibuild/temp.linux-x86_64-2.7/libev -Ilibev -I/usr/include/python2.7 -c gevent/gevent.core.c -o build/temp.linux-x86_64-2.7/gevent/gevent.core.o
gevent/gevent.core.c:17:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
Have you an idea how i can fix this?
Install the Development Package(s):
CentOS/RHEL::
yum install python-devel
Debian/Ubuntu:
apt-get install python-dev

Categories