I have been trying to install Psutil but consistently facing the following error. I saw that there exist many solutions to this problem using sudo install python3-devel but my server only runs bash commands.
Is there a Bash specific solution / command I could use?
Failed to build psutil
Installing collected packages: psutil
Running setup.py install for psutil ... error
ERROR: Command errored out with exit status 1:
command: /opt/python/3.7.5/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pnv8vynd/psutil/setup.p
y'"'"'; __file__='"'"'/tmp/pip-install-pnv8vynd/psutil/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-4zlijwis/install-record.txt -
-single-version-externally-managed --compile
cwd: /tmp/pip-install-pnv8vynd/psutil/
Complete output (41 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_pswindows.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/__init__.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_pslinux.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_psaix.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_pssunos.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_compat.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_process.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/__main__.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_system.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/runner.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-3.7/psutil/tests
running build_ext
building 'psutil._psutil_linux' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/psutil
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=567 -DPSUTIL_LINUX=1 -DPS
UTIL_ETHTOOL_MISSING_TYPES=1 -I/opt/python/3.7.5/include/python3.7m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.7/psutil/_psutil_commo
n.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
Cleaning up...
ERROR: Command errored out with exit status 1: /opt/python/3.7.5/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pi
p-install-pnv8vynd/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-pnv8vynd/psutil/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-rec
ord-4zlijwis/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
See if you can run this:
#!/bin/bash/
apt-get update # To get the latest package lists
sudo apt-get install gcc python3-dev
apt-get install psutil -y
Related
This question already has an answer here:
Error on "pip install -U channels" command using for otree (Running setup.py bdist_wheel for twisted ... error)
(1 answer)
Closed 1 year ago.
while trying to do
pip install web3
I am always getting the following error
Building wheel for cytoolz (setup.py) ... error ERROR: Command
errored out with exit status 1: command:
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -u -c
'import io, os, sys, setuptools, tokenize; sys.argv[0] =
'"'"'/private/var/folders/gb/5fvn1z1s689bzt7vbll5845c0000gn/T/pip-install-cxwpjegv/cytoolz_88244d2146254468892c582d0b9e33fa/setup.py'"'"';
file='"'"'/private/var/folders/gb/5fvn1z1s689bzt7vbll5845c0000gn/T/pip-install-cxwpjegv/cytoolz_88244d2146254468892c582d0b9e33fa/setup.py'"'"';f
= getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import
setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"',
'"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))'
bdist_wheel -d
/private/var/folders/gb/5fvn1z1s689bzt7vbll5845c0000gn/T/pip-wheel-ljv1jb3k
cwd: /private/var/folders/gb/5fvn1z1s689bzt7vbll5845c0000gn/T/pip-install-cxwpjegv/cytoolz_88244d2146254468892c582d0b9e33fa/
Complete output (56 lines): [1/5] Cythonizing cytoolz/utils.pyx
[2/5] Cythonizing cytoolz/dicttoolz.pyx [3/5] Cythonizing
cytoolz/functoolz.pyx [4/5] Cythonizing cytoolz/itertoolz.pyx
[5/5] Cythonizing cytoolz/recipes.pyx running bdist_wheel running
build running build_py creating build creating
build/lib.macosx-10.9-universal2-3.10 creating
build/lib.macosx-10.9-universal2-3.10/cytoolz copying
cytoolz/compatibility.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz copying
cytoolz/_version.py -> build/lib.macosx-10.9-universal2-3.10/cytoolz
copying cytoolz/init.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz copying
cytoolz/_signatures.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz creating
build/lib.macosx-10.9-universal2-3.10/cytoolz/curried copying
cytoolz/curried/operator.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/curried copying
cytoolz/curried/init.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/curried copying
cytoolz/curried/exceptions.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/curried copying
cytoolz/itertoolz.pyx -> build/lib.macosx-10.9-universal2-3.10/cytoolz
copying cytoolz/dicttoolz.pyx ->
build/lib.macosx-10.9-universal2-3.10/cytoolz copying
cytoolz/functoolz.pyx -> build/lib.macosx-10.9-universal2-3.10/cytoolz
copying cytoolz/recipes.pyx ->
build/lib.macosx-10.9-universal2-3.10/cytoolz copying
cytoolz/utils.pyx -> build/lib.macosx-10.9-universal2-3.10/cytoolz
copying cytoolz/utils.pxd ->
build/lib.macosx-10.9-universal2-3.10/cytoolz copying
cytoolz/init.pxd -> build/lib.macosx-10.9-universal2-3.10/cytoolz
copying cytoolz/recipes.pxd ->
build/lib.macosx-10.9-universal2-3.10/cytoolz copying
cytoolz/functoolz.pxd -> build/lib.macosx-10.9-universal2-3.10/cytoolz
copying cytoolz/dicttoolz.pxd ->
build/lib.macosx-10.9-universal2-3.10/cytoolz copying
cytoolz/cpython.pxd -> build/lib.macosx-10.9-universal2-3.10/cytoolz
copying cytoolz/itertoolz.pxd ->
build/lib.macosx-10.9-universal2-3.10/cytoolz creating
build/lib.macosx-10.9-universal2-3.10/cytoolz/tests copying
cytoolz/tests/test_none_safe.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/tests copying
cytoolz/tests/test_utils.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/tests copying
cytoolz/tests/test_curried.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/tests copying
cytoolz/tests/test_compatibility.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/tests copying
cytoolz/tests/test_embedded_sigs.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/tests copying
cytoolz/tests/test_functoolz.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/tests copying
cytoolz/tests/test_inspect_args.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/tests copying
cytoolz/tests/test_doctests.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/tests copying
cytoolz/tests/test_tlz.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/tests copying
cytoolz/tests/test_signatures.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/tests copying
cytoolz/tests/dev_skip_test.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/tests copying
cytoolz/tests/test_recipes.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/tests copying
cytoolz/tests/test_docstrings.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/tests copying
cytoolz/tests/test_dev_skip_test.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/tests copying
cytoolz/tests/test_dicttoolz.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/tests copying
cytoolz/tests/test_serialization.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/tests copying
cytoolz/tests/test_curried_toolzlike.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/tests copying
cytoolz/tests/test_itertoolz.py ->
build/lib.macosx-10.9-universal2-3.10/cytoolz/tests running
build_ext creating build/temp.macosx-10.9-universal2-3.10 creating
build/temp.macosx-10.9-universal2-3.10/cytoolz clang
-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10
-c cytoolz/dicttoolz.c -o build/temp.macosx-10.9-universal2-3.10/cytoolz/dicttoolz.o xcrun:
error: invalid active developer path
(/Library/Developer/CommandLineTools), missing xcrun at:
/Library/Developer/CommandLineTools/usr/bin/xcrun error: command
'/usr/bin/clang' failed with exit code 1
---------------------------------------- ERROR: Failed building wheel for cytoolz
I have tried to update wheel, installing with sudo, and nothing worked so far,
would love for some help,
thanks
Solution was to install xcode tools using
xcode-select --install
I was trying to access the CPU, Ram and storage details of the EdgeGateway hence wanted to use python and psutil to get the job done
When Trying to install psutil in azure edge python module getting bellow error while building. How I can use psuitl here, I want to measure CPU and Ram details of edge gateway.
tep 4/6 : RUN pip install -r requirements.txt
---> Running in d65864318578
Collecting azure-iot-device~=2.0.0
Downloading azure_iot_device-2.0.1-py2.py3-none-any.whl (271 kB)
Collecting psutil
Downloading psutil-5.7.3.tar.gz (465 kB)
Collecting six<2.0.0,>=1.12.0
Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting requests<3.0.0,>=2.20.0
Downloading requests-2.24.0-py2.py3-none-any.whl (61 kB)
Collecting requests-unixsocket<1.0.0,>=0.1.5
Downloading requests_unixsocket-0.2.0-py2.py3-none-any.whl (11 kB)
Collecting janus<1.0.0,>=0.4.0; python_version >= "3.5"
Downloading janus-0.6.1-py3-none-any.whl (11 kB)
Collecting transitions<1.0.0,>=0.6.8
Downloading transitions-0.8.4-py2.py3-none-any.whl (77 kB)
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>1.21.1; python_version != "3.4"
Downloading urllib3-1.25.11-py2.py3-none-any.whl (127 kB)
Collecting paho-mqtt<2.0.0,>=1.4.0
Downloading paho-mqtt-1.5.1.tar.gz (101 kB)
Collecting certifi>=2017.4.17
Downloading certifi-2020.6.20-py2.py3-none-any.whl (156 kB)
Collecting chardet<4,>=3.0.2
Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting idna<3,>=2.5
Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
Building wheels for collected packages: psutil, paho-mqtt
Building wheel for psutil (setup.py): started
Building wheel for psutil (setup.py): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rde7gv_j/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rde7gv_j/psutil/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/pip-wheel-x3f7r1fq
cwd: /tmp/pip-install-rde7gv_j/psutil/
Complete output (44 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/psutil
copying psutil/_pssunos.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_psaix.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_psosx.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_compat.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_pslinux.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/__init__.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_pswindows.py -> build/lib.linux-x86_64-3.7/psutil
creating build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/__main__.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/runner.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_process.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_memleaks.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_system.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/__init__.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_testutils.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-3.7/psutil/tests
running build_ext
building 'psutil._psutil_linux' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/psutil
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=573 -DPSUTIL_LINUX=1 -DPSUTIL_ETHTOOL_MISSING_TYPES=1 -I/usr/local/include/python3.7m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.7/psutil/_psutil_common.o
unable to execute 'gcc': No such file or directory
C compiler or Python headers are not installed on this system. Try to run:
sudo apt-get install gcc python3-dev
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for psutil
Running setup.py clean for psutil
Building wheel for paho-mqtt (setup.py): started
Building wheel for paho-mqtt (setup.py): finished with status 'done'
Created wheel for paho-mqtt: filename=paho_mqtt-1.5.1-py3-none-any.whl size=61543 sha256=f27a76a9f3b030cdc789284e823441f35b5deb9b4f021f0bad8d8cbc0c324b53
Stored in directory: /root/.cache/pip/wheels/c9/be/2a/883db47312c70ef7ffcaff281f3294e3075f62da075474d4bb
Successfully built paho-mqtt
Failed to build psutil
Installing collected packages: six, certifi, chardet, urllib3, idna, requests, requests-unixsocket, janus, transitions, paho-mqtt, azure-iot-device, psutil
Running setup.py install for psutil: started
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rde7gv_j/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rde7gv_j/psutil/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-ygf_yh8g/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7m/psutil
cwd: /tmp/pip-install-rde7gv_j/psutil/
Complete output (44 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/psutil
copying psutil/_pssunos.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_psaix.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_psosx.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_compat.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_pslinux.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/__init__.py -> build/lib.linux-x86_64-3.7/psutil
copying psutil/_pswindows.py -> build/lib.linux-x86_64-3.7/psutil
creating build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/__main__.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/runner.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_process.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_memleaks.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_system.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/__init__.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_testutils.py -> build/lib.linux-x86_64-3.7/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-3.7/psutil/tests
running build_ext
building 'psutil._psutil_linux' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/psutil
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=573 -DPSUTIL_LINUX=1 -DPSUTIL_ETHTOOL_MISSING_TYPES=1 -I/usr/local/include/python3.7m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.7/psutil/_psutil_common.o
unable to execute 'gcc': No such file or directory
C compiler or Python headers are not installed on this system. Try to run:
sudo apt-get install gcc python3-dev
error: command 'gcc' failed with exit status 1
----------------------------------------
Running setup.py install for psutil: finished with status 'error'
ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rde7gv_j/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rde7gv_j/psutil/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-ygf_yh8g/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7m/psutil Check the logs for full command output.
The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
Context:
Creating a docker image from miniconda3, and installing additional conda and pip packages using conda create env via the dockerfile.
The below is the error that I am getting:
Pip subprocess error:
ERROR: Complete output from command /opt/conda/envs/newenv/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-ouoxn_g_/psutil/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/pip-wheel-gj0mtsb8 --python-tag cp36:
ERROR: running bdist_wheel
The environment.yml contains conda packages and then the pip dependencies. All conda packages comes in fine, but the first Pip installation fails as above.
The Dockerfile is as below:
FROM continuumio/miniconda3
WORKDIR /.
COPY ./environment.yml ./
RUN conda env create -f ./environment.yml
RUN echo "source activate processenv" > ~/.bashrc
ENV PATH /opt/conda/envs/newenv/bin:$PATH
Full error as below:
Pip subprocess error:
ERROR: Complete output from command /opt/conda/envs/newenv/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-ouoxn_g_/psutil/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/pip-wheel-gj0mtsb8 --python-tag cp36:
ERROR: running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_psaix.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/__init__.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_pssunos.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_compat.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_pslinux.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_psosx.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_pswindows.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-3.6/psutil
creating build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_process.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/__init__.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/runner.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_system.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/__main__.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-3.6/psutil/tests
running build_ext
building 'psutil._psutil_linux' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/psutil
gcc -pthread -B /opt/conda/envs/newenv/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=563 -DPSUTIL_LINUX=1 -DPSUTIL_ETHTOOL_MISSING_TYPES=1 -I/opt/conda/envs/processenv/include/python3.6m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.6/psutil/_psutil_common.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for psutil
ERROR: flair 0.4.4 has requirement urllib3<1.25,>=1.20, but you'll have urllib3 1.25.3 which is incompatible.
ERROR: Complete output from command /opt/conda/envs/newenv/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-ouoxn_g_/psutil/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-f2xrpwn0/install-record.txt --single-version-externally-managed --compile:
ERROR: running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_psaix.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/__init__.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_pssunos.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_compat.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_pslinux.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_psosx.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_pswindows.py -> build/lib.linux-x86_64-3.6/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-3.6/psutil
creating build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_process.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/__init__.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/runner.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_system.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/__main__.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-3.6/psutil/tests
running build_ext
building 'psutil._psutil_linux' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/psutil
gcc -pthread -B /opt/conda/envs/newenv/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=563 -DPSUTIL_LINUX=1 -DPSUTIL_ETHTOOL_MISSING_TYPES=1 -I/opt/conda/envs/processenv/include/python3.6m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.6/psutil/_psutil_common.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command "/opt/conda/envs/newenv/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-ouoxn_g_/psutil/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-f2xrpwn0/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-ouoxn_g_/psutil/
CondaEnvException: Pip failed
you have a dependency issue as stated in your error:
ERROR: flair 0.4.4 has requirement urllib3<1.25,>=1.20, but you'll have urllib3 1.25.3 which is incompatible.
you could try adding pip install "urllib3==1.24"
i had to get gcc also installed since miniconda3 does not come with that, i guess. so in the dockerfile gave a apt get for gcc and it worked!
Can someone help me understand why I can't install psutil? I'm on MacOS. I'm a noob so bear with me, but any help would be appreciated. Could it be something to do with the default Python install vs v3 that I installed? I'm new to command line so confused about what is causing the error and how to fix it...
This is the error message I get...
kasey#MacBook-Pro ~ % pip3 install psutil
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Collecting psutil
Downloading psutil-5.7.0.tar.gz (449 kB)
|████████████████████████████████| 449 kB 150 kB/s
Building wheels for collected packages: psutil
Building wheel for psutil (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/setup.py'"'"'; __file__='"'"'/private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/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 /private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-wheel-dsejsf
cwd: /private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/
Complete output (43 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.15-x86_64-2.7
creating build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_pswindows.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_common.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/__init__.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_psosx.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_psbsd.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_psaix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_pslinux.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_compat.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_psposix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_pssunos.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
creating build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/runner.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/__init__.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_process.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_system.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/__main__.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
running build_ext
building 'psutil._psutil_osx' extension
creating build/temp.macosx-10.15-x86_64-2.7
creating build/temp.macosx-10.15-x86_64-2.7/psutil
creating build/temp.macosx-10.15-x86_64-2.7/psutil/arch
creating build/temp.macosx-10.15-x86_64-2.7/psutil/arch/osx
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -iwithsysroot /usr/local/libressl/include -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -pipe -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=570 -DPSUTIL_OSX=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c psutil/_psutil_common.c -o build/temp.macosx-10.15-x86_64-2.7/psutil/_psutil_common.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'cc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for psutil
Running setup.py clean for psutil
Failed to build psutil
Installing collected packages: psutil
Running setup.py install for psutil ... error
ERROR: Command errored out with exit status 1:
command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/setup.py'"'"'; __file__='"'"'/private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-record-O5uazE/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/kasey/Library/Python/2.7/include/python2.7/psutil
cwd: /private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/
Complete output (43 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.15-x86_64-2.7
creating build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_pswindows.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_common.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/__init__.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_psosx.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_psbsd.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_psaix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_pslinux.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_compat.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_psposix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
copying psutil/_pssunos.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
creating build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/runner.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/__init__.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_process.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_system.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
copying psutil/tests/__main__.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
running build_ext
building 'psutil._psutil_osx' extension
creating build/temp.macosx-10.15-x86_64-2.7
creating build/temp.macosx-10.15-x86_64-2.7/psutil
creating build/temp.macosx-10.15-x86_64-2.7/psutil/arch
creating build/temp.macosx-10.15-x86_64-2.7/psutil/arch/osx
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -iwithsysroot /usr/local/libressl/include -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -pipe -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=570 -DPSUTIL_OSX=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c psutil/_psutil_common.c -o build/temp.macosx-10.15-x86_64-2.7/psutil/_psutil_common.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'cc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/setup.py'"'"'; __file__='"'"'/private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-record-O5uazE/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/kasey/Library/Python/2.7/include/python2.7/psutil Check the logs for full command output.
This happens when you have multiple versions installed (as for me, I had python 3.5 along with 3.7 installed), you have to specify a granular version, like so (for 3.7):
sudo apt-get install python3.7-dev -y
Read more:
https://github.com/giampaolo/psutil/issues/1143#issuecomment-334695523
For the same issue on AWS for python3, you will likely need to specify the version more explicitly:
yum install python36-devel.x86_64
Or just search for the right package name:
yum search python | grep -i dev
I am having problems with installing lxml. I have tried the solutions of the relative questions in this site and other sites but could not fix the problem. Need some suggestions/solution on this.
I am providing the full log after executing pip install lxml,
Downloading/unpacking lxml
Downloading lxml-3.3.5.tar.gz (3.5MB): 3.5MB downloaded
Running setup.py (path:/tmp/pip_build_root/lxml/setup.py) egg_info for package lxml
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.3.5.
Building without Cython.
Using build configuration of libxslt 1.1.28
warning: no previously-included files found matching '*.py'
Installing collected packages: lxml
Running setup.py install for lxml
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.3.5.
Building without Cython.
Using build configuration of libxslt 1.1.28
building 'lxml.etree' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/tmp/pip_build_root/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w
x86_64-linux-gnu-gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 4
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-KUq9VD-record/install-record.txt --single-version-externally-managed --compile:
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.3.5.
Building without Cython.
Using build configuration of libxslt 1.1.28
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/lxml
copying src/lxml/pyclasslookup.py -> build/lib.linux-x86_64-2.7/lxml
copying src/lxml/doctestcompare.py -> build/lib.linux-x86_64-2.7/lxml
copying src/lxml/builder.py -> build/lib.linux-x86_64-2.7/lxml
copying src/lxml/cssselect.py -> build/lib.linux-x86_64-2.7/lxml
copying src/lxml/sax.py -> build/lib.linux-x86_64-2.7/lxml
copying src/lxml/_elementpath.py -> build/lib.linux-x86_64-2.7/lxml
copying src/lxml/ElementInclude.py -> build/lib.linux-x86_64-2.7/lxml
copying src/lxml/__init__.py -> build/lib.linux-x86_64-2.7/lxml
copying src/lxml/usedoctest.py -> build/lib.linux-x86_64-2.7/lxml
creating build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/__init__.py -> build/lib.linux-x86_64-2.7/lxml/includes
creating build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/html5parser.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/ElementSoup.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/builder.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/clean.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/_diffcommand.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/diff.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/_html5builder.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/_setmixin.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/defs.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/formfill.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/soupparser.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/__init__.py -> build/lib.linux-x86_64-2.7/lxml/html
copying src/lxml/html/usedoctest.py -> build/lib.linux-x86_64-2.7/lxml/html
creating build/lib.linux-x86_64-2.7/lxml/isoschematron
copying src/lxml/isoschematron/__init__.py -> build/lib.linux-x86_64-2.7/lxml/isoschematron
copying src/lxml/lxml.etree.h -> build/lib.linux-x86_64-2.7/lxml
copying src/lxml/lxml.etree_api.h -> build/lib.linux-x86_64-2.7/lxml
copying src/lxml/includes/config.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/xpath.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/tree.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/dtdvalid.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/xmlparser.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/etreepublic.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/xslt.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/schematron.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/uri.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/c14n.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/xinclude.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/xmlschema.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/xmlerror.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/relaxng.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/htmlparser.pxd -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/etree_defs.h -> build/lib.linux-x86_64-2.7/lxml/includes
copying src/lxml/includes/lxml-version.h -> build/lib.linux-x86_64-2.7/lxml/includes
creating build/lib.linux-x86_64-2.7/lxml/isoschematron/resources
creating build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/rng
copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/rng
creating build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl
creating build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.linux-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
running build_ext
building 'lxml.etree' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
creating build/temp.linux-x86_64-2.7/src/lxml
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/tmp/pip_build_root/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w
x86_64-linux-gnu-gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 4
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-KUq9VD-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/lxml
Storing debug log for failure in /root/.pip/pip.log
Also, the pip.log file looks like this,
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 706, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 697, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-KUq9VD-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/lxml
dmesg | tail command shows output like this,
[1744367.676147] Out of memory: Kill process 25518 (cc1) score 388 or sacrifice child
[1744367.676665] Killed process 25518 (cc1) total-vm:242352kB, anon-rss:200608kB, file-rss:0kB
It's seems like a memory issue. I am taking reference form this question
Possible solution (if you have no ability to increase memory on that machine) is to add swap file.
sudo dd if=/dev/zero of=/swapfile bs=1024 count=524288
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
from https://github.com/pydata/pandas/issues/1880#issuecomment-9920484
This worked for me on smallest digital ocean machine
In this particular case, it has nothing to do with dependencies, it's a memory problem.
I had this problem within a virtualbox VM. My solution was to increase memory allocated to the VM from the default 512Mb to 1024Mb.
Refer to https://stackoverflow.com/a/6504860/261718
Go install some dev packages before pip install lxml
apt-get install libxml2-dev libxslt1-dev python-dev
Using digitalocean smallest machine you can just turn off mysql and apache while compiling using
sudo service apache2 stop
sudo service mysql stop
and after installing lxml turn them on again using this commands with 'start' instead of 'stop'. Works pretty well for me without using swap file
If #Drake answer does not work for you try adding lib1g-dev.
$ sudo apt-get install -y libxml2-dev libxslt1-dev zlib1g-dev