Platform
Bug description
Upon trying to install psutil on above OS the process fails that the wheel can not be built.
Results
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: /home/travis/build/smarthomeNG/smarthome/.tox/py38/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-c8s4e8kc/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-c8s4e8kc/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-skq_v0us
cwd: /tmp/pip-install-c8s4e8kc/psutil/
Complete output (47 lines):
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/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_pswindows.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/__init__.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_compat.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_psosx.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_psaix.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_pslinux.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_pssunos.py -> build/lib.linux-x86_64-3.8/psutil
creating build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_system.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/__init__.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/runner.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/__main__.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_process.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-3.8/psutil/tests
running build_ext
building 'psutil._psutil_linux' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/psutil
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=570 -DPSUTIL_LINUX=1 -I/home/travis/build/smarthomeNG/smarthome/.tox/py38/include -I/opt/python/3.8.1/include/python3.8 -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.8/psutil/_psutil_common.o
In file included from /usr/include/x86_64-linux-gnu/sys/stat.h:446,
from /opt/python/3.8.1/include/python3.8/pyport.h:245,
from /opt/python/3.8.1/include/python3.8/Python.h:63,
from psutil/_psutil_common.c:9:
/usr/lib/gcc/x86_64-linux-gnu/9/include-fixed/bits/statx.h:38:25: error: missing binary operator before token "("
38 | #if __glibc_has_include ("__linux__/stat.h")
| ^
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for psutil
Running setup.py clean for psutil
The former output is a cutout from here
Wow! No idea what that is. Looks like Ubuntu messed something up...
Hm. It seems as if Travis Build System uses gcc (Ubuntu 9.2.1-28ubuntu1) 9.2.1 20200203
whereas a normal desktop installation with updates has gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)
aboard.
Maybe if I can find a way to upgrade gcc prior to build the wheel I can test if this is the evil's root.
Seems as if this is the same here: https://github.com/steinbergmedia/vst3sdk/issues/55
So the cause seems not to lie somewhere in psutil
I've managed it to update the gcc as described above with adding
before_install:
- sudo apt-get update
- sudo apt-get install gcc --only-upgrade
to the corresponding .travis.yml
Similar problem: Ubuntu 20.04 lts, python3.8.2:
Defaulting to user installation because normal site-packages is not writeable
Collecting psutil
Using cached psutil-5.7.0.tar.gz (449 kB)
Building wheels for collected packages: psutil
Building wheel for psutil (setup.py) ... 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-_6f8i3f3/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_6f8i3f3/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-j9o77k7n
cwd: /tmp/pip-install-_6f8i3f3/psutil/
Complete output (44 lines):
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/psutil
copying psutil/_pslinux.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_compat.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_pswindows.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_pssunos.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/__init__.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_psosx.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_psaix.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-3.8/psutil
creating build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/runner.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/__init__.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_process.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_system.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/__main__.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-3.8/psutil/tests
running build_ext
building 'psutil._psutil_linux' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/psutil
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 -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=570 -DPSUTIL_LINUX=1 -I/usr/include/python3.8 -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.8/psutil/_psutil_common.o
psutil/_psutil_common.c:9:10: fatal error: Python.h: No such file or directory
9 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' 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: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_6f8i3f3/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_6f8i3f3/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-flfphxr3/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/strange/.local/include/python3.8/psutil
cwd: /tmp/pip-install-_6f8i3f3/psutil/
Complete output (44 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/psutil
copying psutil/_pslinux.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_compat.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_pswindows.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_pssunos.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/__init__.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_psosx.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_psaix.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-3.8/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-3.8/psutil
creating build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/runner.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/__init__.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_process.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_system.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/__main__.py -> build/lib.linux-x86_64-3.8/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-3.8/psutil/tests
running build_ext
building 'psutil._psutil_linux' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/psutil
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 -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=570 -DPSUTIL_LINUX=1 -I/usr/include/python3.8 -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.8/psutil/_psutil_common.o
psutil/_psutil_common.c:9:10: fatal error: Python.h: No such file or directory
9 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-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-_6f8i3f3/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_6f8i3f3/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-flfphxr3/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/strange/.local/include/python3.8/psutil Check the logs for full command output.
Try installing or upgrading pip3
sudo apt-get install python3-pip
This worked for me .
@j-tesla You need to install python3-dev
for psutils
to compile. That's what will let C code interface to python (which is what gcc complains about: no Python.h to work with).
This means that building psutils
on Ubuntu 20.04 has a dependency to python-dev
, I'm not sure if that can/should be automated.
@fleutot thanks
Resolved
Most helpful comment
Try installing or upgrading pip3
sudo apt-get install python3-pip
This worked for me .