psutil: windows 10 - python 3.11.0 - error installing psutil

While I am trying to install psutil on windows 10 with python 3.11.0, I getting the following error Could you direct me to how to resolve it

` __building ‘psutil._psutil_windows’ extension error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools”: https://visualstudio.microsoft.com/visual-cpp-build-tools/ [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for psutil Failed to build psutil ERROR: Could not build wheels for psutil, which is required to install pyproject.toml-based projects__ `

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 16
  • Comments: 19 (3 by maintainers)

Commits related to this issue

Most upvoted comments

If there are no special needs, you can install the old version first and wait for the update. pip install psutil==5.9.3 works for me.

This should now be fixed. Please confirm.

~/svn/psutil {master}$ python3 -m twine upload dist/psutil-5.9.4-cp36-abi3-win32.whl  dist/psutil-5.9.4-cp36-abi3-win_amd64.whl 
Uploading distributions to https://upload.pypi.org/legacy/
Uploading psutil-5.9.4-cp36-abi3-win32.whl
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 275.0/275.0 kB • 00:00 • 780.9 kB/s
Uploading psutil-5.9.4-cp36-abi3-win_amd64.whl
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 280.3/280.3 kB • 00:00 • 25.7 MB/s

View at:
https://pypi.org/project/psutil/5.9.4/

hello, I still got this error, on arm64, ubuntu18.04, python3.9. I have tried both 5.9.4 and 5.9.3.

gcc is 7.5.0, need to upgrade to higher version ?

      copying psutil/tests/test_unicode.py -> build/lib.linux-aarch64-cpython-39/psutil/tests
      copying psutil/tests/test_windows.py -> build/lib.linux-aarch64-cpython-39/psutil/tests
      running build_ext
      building 'psutil._psutil_linux' extension
      creating build/temp.linux-aarch64-cpython-39
      creating build/temp.linux-aarch64-cpython-39/psutil
      gcc -pthread -B /opt/conda/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -n1 .2-a+fp16+rcpc+dotprod+crypto -isystem /opt/conda/include -I/opt/conda/include -fPIC -O2 -n1 .2-a+fp16+rcpc+dotprod+crypto -isystem /opt/conda/include -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=593 -DPSUTIL_LINUX=1 -I/opt/conda/include/python3.9 -c psutil/_psutil_common.c -o build/temp.linux-aarch64-cpython-39/psutil/_psutil_common.o
      gcc: error: .2-a+fp16+rcpc+dotprod+crypto: No such file or directory
      gcc: error: .2-a+fp16+rcpc+dotprod+crypto: No such file or directory
      gcc: error: unrecognized command line option ‘-n1’; did you mean ‘-n’?
      gcc: error: unrecognized command line option ‘-n1’; did you mean ‘-n’?
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for psutil
Failed to build psutil
ERROR: Could not build wheels for psutil, which is required to install pyproject.toml-based projects

I should have this fixed today. Hang tight.

same error in linux aarch64

(base) root@davinci-mini:/home/HwHiAiUser# pip install --no-binary :all: psutil
DEPRECATION: --no-binary currently disables reading from the cache of locally built wheels. In the future --no-binary will not influence the wheel cache. pip 23.1 will enforce this behaviour change. A possible replacement is to use the --no-cache-dir option. You can use the flag --use-feature=no-binary-enable-wheel-cache to test the upcoming behaviour. Discussion can be found at https://github.com/pypa/pip/issues/11453
Looking in indexes: https://pypi.douban.com/simple
Collecting psutil
  Downloading https://pypi.doubanio.com/packages/de/eb/1c01a34c86ee3b058c556e407ce5b07cb7d186ebe47b3e69d6f152ca5cc5/psutil-5.9.3.tar.gz (483 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 483.6/483.6 kB 3.5 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: psutil
  Building wheel for psutil (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for psutil (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [45 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-aarch64-cpython-39
      creating build/lib.linux-aarch64-cpython-39/psutil
      copying psutil/_psosx.py -> build/lib.linux-aarch64-cpython-39/psutil
      copying psutil/_psposix.py -> build/lib.linux-aarch64-cpython-39/psutil
      copying psutil/_pssunos.py -> build/lib.linux-aarch64-cpython-39/psutil
      copying psutil/_psaix.py -> build/lib.linux-aarch64-cpython-39/psutil
      copying psutil/_pswindows.py -> build/lib.linux-aarch64-cpython-39/psutil
      copying psutil/_pslinux.py -> build/lib.linux-aarch64-cpython-39/psutil
      copying psutil/_common.py -> build/lib.linux-aarch64-cpython-39/psutil
      copying psutil/__init__.py -> build/lib.linux-aarch64-cpython-39/psutil
      copying psutil/_psbsd.py -> build/lib.linux-aarch64-cpython-39/psutil
      copying psutil/_compat.py -> build/lib.linux-aarch64-cpython-39/psutil
      creating build/lib.linux-aarch64-cpython-39/psutil/tests
      copying psutil/tests/test_aix.py -> build/lib.linux-aarch64-cpython-39/psutil/tests
      copying psutil/tests/test_unicode.py -> build/lib.linux-aarch64-cpython-39/psutil/tests
      copying psutil/tests/test_bsd.py -> build/lib.linux-aarch64-cpython-39/psutil/tests
      copying psutil/tests/test_testutils.py -> build/lib.linux-aarch64-cpython-39/psutil/tests
      copying psutil/tests/test_posix.py -> build/lib.linux-aarch64-cpython-39/psutil/tests
      copying psutil/tests/test_contracts.py -> build/lib.linux-aarch64-cpython-39/psutil/tests
      copying psutil/tests/test_memleaks.py -> build/lib.linux-aarch64-cpython-39/psutil/tests
      copying psutil/tests/test_linux.py -> build/lib.linux-aarch64-cpython-39/psutil/tests
      copying psutil/tests/__main__.py -> build/lib.linux-aarch64-cpython-39/psutil/tests
      copying psutil/tests/test_osx.py -> build/lib.linux-aarch64-cpython-39/psutil/tests
      copying psutil/tests/test_process.py -> build/lib.linux-aarch64-cpython-39/psutil/tests
      copying psutil/tests/test_system.py -> build/lib.linux-aarch64-cpython-39/psutil/tests
      copying psutil/tests/test_windows.py -> build/lib.linux-aarch64-cpython-39/psutil/tests
      copying psutil/tests/__init__.py -> build/lib.linux-aarch64-cpython-39/psutil/tests
      copying psutil/tests/test_misc.py -> build/lib.linux-aarch64-cpython-39/psutil/tests
      copying psutil/tests/test_connections.py -> build/lib.linux-aarch64-cpython-39/psutil/tests
      copying psutil/tests/runner.py -> build/lib.linux-aarch64-cpython-39/psutil/tests
      copying psutil/tests/test_sunos.py -> build/lib.linux-aarch64-cpython-39/psutil/tests
      running build_ext
      building 'psutil._psutil_linux' extension
      creating build/temp.linux-aarch64-cpython-39
      creating build/temp.linux-aarch64-cpython-39/psutil
      gcc -pthread -B /usr/local/miniconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -n1 .2-a+fp16+rcpc+dotprod+crypto -isystem /usr/local/miniconda3/include -I/usr/local/miniconda3/include -fPIC -O2 -n1 .2-a+fp16+rcpc+dotprod+crypto -isystem /usr/local/miniconda3/include -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=593 -DPSUTIL_LINUX=1 -I/usr/local/miniconda3/include/python3.9 -c psutil/_psutil_common.c -o build/temp.linux-aarch64-cpython-39/psutil/_psutil_common.o
      gcc: error: .2-a+fp16+rcpc+dotprod+crypto: No such file or directory
      gcc: error: .2-a+fp16+rcpc+dotprod+crypto: No such file or directory
      gcc: error: unrecognized command line option ‘-n1’; did you mean ‘-n’?
      gcc: error: unrecognized command line option ‘-n1’; did you mean ‘-n’?
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for psutil
Failed to build psutil
ERROR: Could not build wheels for psutil, which is required to install pyproject.toml-based projects

same error in Linux Ubuntu 22.04.1 LTS when installing psutil

Duplicates #2163