Repository navigation
Closed
Labels
bugtypebuild-failpsutil doesn't compile or link: missing header, undefined symbol, no C compilerlinuxplatform : Linux specific
Description
Platform
- Linux
- psutil-5.7.3
- Python 3.8
Bug description
Getting this error on linux (elementary OS, based on ubuntu 18.04 LTS) with architecture intel i7-4700MQ CPU @ 2.40
Seems to be related to a missing header file?
Error:
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 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=573 -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
#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.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_dk0cwo0/psutil_968214155e33476e887f69a214c0bc68/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_dk0cwo0/psutil_968214155e33476e887f69a214c0bc68/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-4iuwbcv2/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/user/.local/include/python3.8/psutil Check the logs for full command output.
Metadata
Metadata
Assignees
Labels
bugtypebuild-failpsutil doesn't compile or link: missing header, undefined symbol, no C compilerlinuxplatform : Linux specific
Activity
giampaolo commentedon Dec 19, 2020
See install instructions (+ now we have wheels).
kaczmarj commentedon Dec 25, 2020
@aaronsdevera - python headers can be installed with
apt install python3-dev. Typically, packages that end in-devinclude headers.whomobile commentedon Apr 18, 2024
In case any comes here to fix "#include <Python.h>" not found issue with psutils
you will need to install correct python dev lib for your python.
e.g. one of following