针对unix的psutil-pip安装问题



如何复制问题:

  • 进入unix
  • 创建虚拟环境:python3 -m venv venv_dummy
  • 进入虚拟环境:source venv_dummy/bin/activate
  • pip安装psutil:pip install psutil

主机信息:

  • 类unix内核(Linux Mariner(。更多信息:https://github.com/microsoft/CBL-Mariner
  • pip版本:21.3.1
  • Python版本:3.7.10

错误:

```
Running setup.py install for psutil ... error
ERROR: Command errored out with exit status 1:
command: /home/ddummy/venv_dummy/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-f428vle2/psutil_c32bd82932444031aaff9983e3255a51/setup.py'"'"'; __file__='"'"'/tmp/pip-install-f428vle2/psutil_c32bd82932444031aaff9983e3255a51/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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-z3uzjnld/install-record.txt --single-version-externally-managed --compile --install-headers /home/ddummy/venv_dummy/include/site/python3.7/psutil
cwd: /tmp/pip-install-f428vle2/psutil_c32bd82932444031aaff9983e3255a51/
Complete output (46 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-aarch64-3.7
creating build/lib.linux-aarch64-3.7/psutil
copying psutil/_psosx.py -> build/lib.linux-aarch64-3.7/psutil
copying psutil/_pssunos.py -> build/lib.linux-aarch64-3.7/psutil
copying psutil/_pslinux.py -> build/lib.linux-aarch64-3.7/psutil
copying psutil/_psaix.py -> build/lib.linux-aarch64-3.7/psutil
copying psutil/__init__.py -> build/lib.linux-aarch64-3.7/psutil
copying psutil/_psposix.py -> build/lib.linux-aarch64-3.7/psutil
copying psutil/_common.py -> build/lib.linux-aarch64-3.7/psutil
copying psutil/_compat.py -> build/lib.linux-aarch64-3.7/psutil
copying psutil/_psbsd.py -> build/lib.linux-aarch64-3.7/psutil
copying psutil/_pswindows.py -> build/lib.linux-aarch64-3.7/psutil
creating build/lib.linux-aarch64-3.7/psutil/tests
copying psutil/tests/runner.py -> build/lib.linux-aarch64-3.7/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.linux-aarch64-3.7/psutil/tests
copying psutil/tests/__main__.py -> build/lib.linux-aarch64-3.7/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.linux-aarch64-3.7/psutil/tests
copying psutil/tests/test_process.py -> build/lib.linux-aarch64-3.7/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.linux-aarch64-3.7/psutil/tests
copying psutil/tests/__init__.py -> build/lib.linux-aarch64-3.7/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.linux-aarch64-3.7/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.linux-aarch64-3.7/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.linux-aarch64-3.7/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.linux-aarch64-3.7/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.linux-aarch64-3.7/psutil/tests
copying psutil/tests/test_memleaks.py -> build/lib.linux-aarch64-3.7/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.linux-aarch64-3.7/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.linux-aarch64-3.7/psutil/tests
copying psutil/tests/test_testutils.py -> build/lib.linux-aarch64-3.7/psutil/tests
copying psutil/tests/test_system.py -> build/lib.linux-aarch64-3.7/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.linux-aarch64-3.7/psutil/tests
running build_ext
building 'psutil._psutil_linux' extension
creating build/temp.linux-aarch64-3.7
creating build/temp.linux-aarch64-3.7/psutil
aarch64-unknown-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/mariner/default-hardened-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -DOPENSSL_NO_SSL3 -DOPENSSL_NO_SSL2 -DOPENSSL_NO_COMP -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/mariner/default-hardened-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -DOPENSSL_NO_SSL3 -DOPENSSL_NO_SSL2 -DOPENSSL_NO_COMP -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/mariner/default-hardened-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=580 -DPSUTIL_LINUX=1 -I/home/ddummy/venv_dummy/include -I/usr/include/python3.7m -c psutil/_psutil_common.c -o build/temp.linux-aarch64-3.7/psutil/_psutil_common.o
aarch64-unknown-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/mariner/default-hardened-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -DOPENSSL_NO_SSL3 -DOPENSSL_NO_SSL2 -DOPENSSL_NO_COMP -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/mariner/default-hardened-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -DOPENSSL_NO_SSL3 -DOPENSSL_NO_SSL2 -DOPENSSL_NO_COMP -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/mariner/default-hardened-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=580 -DPSUTIL_LINUX=1 -I/home/ddummy/venv_dummy/include -I/usr/include/python3.7m -c psutil/_psutil_posix.c -o build/temp.linux-aarch64-3.7/psutil/_psutil_posix.o
aarch64-unknown-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/mariner/default-hardened-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -DOPENSSL_NO_SSL3 -DOPENSSL_NO_SSL2 -DOPENSSL_NO_COMP -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/mariner/default-hardened-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -DOPENSSL_NO_SSL3 -DOPENSSL_NO_SSL2 -DOPENSSL_NO_COMP -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/mariner/default-hardened-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=580 -DPSUTIL_LINUX=1 -I/home/ddummy/venv_dummy/include -I/usr/include/python3.7m -c psutil/_psutil_linux.c -o build/temp.linux-aarch64-3.7/psutil/_psutil_linux.o
aarch64-unknown-linux-gnu-gcc -pthread -shared -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/mariner/default-hardened-ld -Wl,-dT,/usr/src/mariner/BUILD/module_info.ld -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/mariner/default-hardened-ld -Wl,-dT,/usr/src/mariner/BUILD/module_info.ld build/temp.linux-aarch64-3.7/psutil/_psutil_common.o build/temp.linux-aarch64-3.7/psutil/_psutil_posix.o build/temp.linux-aarch64-3.7/psutil/_psutil_linux.o -L/usr/lib -lpython3.7m -o build/lib.linux-aarch64-3.7/psutil/_psutil_linux.cpython-37m-aarch64-linux-gnu.so
/usr/bin/ld: cannot open linker script file /usr/src/mariner/BUILD/module_info.ld: No such file or directory
collect2: error: ld returned 1 exit status
error: command 'aarch64-unknown-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/ddummy/venv_dummy/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-f428vle2/psutil_c32bd82932444031aaff9983e3255a51/setup.py'"'"'; __file__='"'"'/tmp/pip-install-f428vle2/psutil_c32bd82932444031aaff9983e3255a51/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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-z3uzjnld/install-record.txt --single-version-externally-managed --compile --install-headers /home/ddummy/venv_dummy/include/site/python3.7/psutil Check the logs for full command output.

迄今为止所做的研究和工作:

  • 遵循本次讨论中的说明:https://github.com/giampaolo/psutil/issues/1143
  • 检查系统中是否正确安装了python3-devel
> sudo yum search python3 | grep -i dev
python3-devel : The libraries and header files needed for Python development.
python3-py : Python development support library
python3-devel : The libraries and header files needed for Python development.
python3-py : Python development support library
python3-tools : A collection of development tools included with Python.
python3-devel : The libraries and header files needed for Python development.
python3-devel : The libraries and header files needed for Python development.
python3-devel : The libraries and header files needed for Python development.
python3-devel : The libraries and header files needed for Python development.
python3-devel : The libraries and header files needed for Python development.
python3-devel : The libraries and header files needed for Python development.
python3-devel : The libraries and header files needed for Python development.
python3-py : Python development support library
python3-rbd : Python 3 libraries for the RADOS block device
python3-rbd : Python 3 libraries for the RADOS block device
python3-rbd : Python 3 libraries for the RADOS block device
python3-tools : A collection of development tools included with Python.
python3-tools : A collection of development tools included with Python.
python3-tools : A collection of development tools included with Python.
python3-tools : A collection of development tools included with Python.
python3-tools : A collection of development tools included with Python.
python3-tools : A collection of development tools included with Python.
python3-tools : A collection of development tools included with Python.
python3-pybind11 : Development headers for pybind11
  • 尝试安装以下内容,但没有成功:
> sudo yum install python36-devel.x86_64
No package python36-devel.x86_64 available
  • 尝试安装以下内容,但未成功:
> sudo yum install python3.7-dev
No package python3.7-dev available
  • 尝试了以下操作:
>sudo yum install -y gcc gcc-c++ libgcc platform-python-devel
Package gcc is already installed.
Package libgcc is already installed.
No package gcc-c++ available
No package platform-python-devel available
Error(1011) : No matching packages

经过大量研究,我发现了这个问题。当我运行以下程序时,安装成功了:

sudo venv_dummy/bin/pip3 install psutil 

dlitster在帖子中对此进行了讨论https://github.com/giampaolo/psutil/issues/1143

最新更新