giampaolo / psutil

Cross-platform lib for process and system monitoring in Python
BSD 3-Clause "New" or "Revised" License
10.21k stars 1.38k forks source link

[Windows 11] Unable to install psutil on Python 3.11.10 #2441

Closed viocar closed 1 hour ago

viocar commented 2 hours ago

Summary

Description

I receive an error when attempting to install psutil. Here is the output when I use the pip install psutil -v command:

C:\Users\username\Downloads>pip install psutil -v
Using pip 24.2 from C:\msys64\mingw64\lib\python3.11\site-packages\pip (python 3.11)
Collecting psutil
  Using cached psutil-6.0.0.tar.gz (508 kB)
  Running command pip subprocess to install build dependencies
  Using pip 24.2 from C:\msys64\mingw64\lib\python3.11\site-packages\pip (python 3.11)
  Collecting setuptools>=43
    Obtaining dependency information for setuptools>=43 from https://files.pythonhosted.org/packages/ff/ae/f19306b5a221f6a436d8f2238d5b80925004093fa3edea59835b514d9057/setuptools-75.1.0-py3-none-any.whl.metadata
    Using cached setuptools-75.1.0-py3-none-any.whl.metadata (6.9 kB)
  Collecting wheel
    Obtaining dependency information for wheel from https://files.pythonhosted.org/packages/1b/d1/9babe2ccaecff775992753d8686970b1e2755d21c8a63be73aba7a4e7d77/wheel-0.44.0-py3-none-any.whl.metadata
    Using cached wheel-0.44.0-py3-none-any.whl.metadata (2.3 kB)
  Using cached setuptools-75.1.0-py3-none-any.whl (1.2 MB)
  Using cached wheel-0.44.0-py3-none-any.whl (67 kB)
  Installing collected packages: wheel, setuptools
    Creating C:\Users\username\AppData\Local\Temp\pip-build-env-z1frdxti\overlay\bin
  Successfully installed setuptools-75.1.0 wheel-0.44.0
  Installing build dependencies ... done
  Running command Getting requirements to build wheel
  running egg_info
  writing psutil.egg-info\PKG-INFO
  writing dependency_links to psutil.egg-info\dependency_links.txt
  writing requirements to psutil.egg-info\requires.txt
  writing top-level names to psutil.egg-info\top_level.txt
  reading manifest file 'psutil.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  adding license file 'LICENSE'
  writing manifest file 'psutil.egg-info\SOURCES.txt'
  Getting requirements to build wheel ... done
  Running command Preparing metadata (pyproject.toml)
  running dist_info
  creating C:\Users\username\AppData\Local\Temp\pip-modern-metadata-14jzj2qy\psutil.egg-info
  writing C:\Users\username\AppData\Local\Temp\pip-modern-metadata-14jzj2qy\psutil.egg-info\PKG-INFO
  writing dependency_links to C:\Users\username\AppData\Local\Temp\pip-modern-metadata-14jzj2qy\psutil.egg-info\dependency_links.txt
  writing requirements to C:\Users\username\AppData\Local\Temp\pip-modern-metadata-14jzj2qy\psutil.egg-info\requires.txt
  writing top-level names to C:\Users\username\AppData\Local\Temp\pip-modern-metadata-14jzj2qy\psutil.egg-info\top_level.txt
  writing manifest file 'C:\Users\username\AppData\Local\Temp\pip-modern-metadata-14jzj2qy\psutil.egg-info\SOURCES.txt'
  reading manifest file 'C:\Users\username\AppData\Local\Temp\pip-modern-metadata-14jzj2qy\psutil.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  adding license file 'LICENSE'
  writing manifest file 'C:\Users\username\AppData\Local\Temp\pip-modern-metadata-14jzj2qy\psutil.egg-info\SOURCES.txt'
  creating 'C:\Users\username\AppData\Local\Temp\pip-modern-metadata-14jzj2qy\psutil-6.0.0.dist-info'
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: psutil
  Running command Building wheel for psutil (pyproject.toml)
  running bdist_wheel
  running build
  running build_py
  creating build\lib.mingw_x86_64-cpython-311\psutil
  copying psutil\_common.py -> build\lib.mingw_x86_64-cpython-311\psutil
  copying psutil\_compat.py -> build\lib.mingw_x86_64-cpython-311\psutil
  copying psutil\_psaix.py -> build\lib.mingw_x86_64-cpython-311\psutil
  copying psutil\_psbsd.py -> build\lib.mingw_x86_64-cpython-311\psutil
  copying psutil\_pslinux.py -> build\lib.mingw_x86_64-cpython-311\psutil
  copying psutil\_psosx.py -> build\lib.mingw_x86_64-cpython-311\psutil
  copying psutil\_psposix.py -> build\lib.mingw_x86_64-cpython-311\psutil
  copying psutil\_pssunos.py -> build\lib.mingw_x86_64-cpython-311\psutil
  copying psutil\_pswindows.py -> build\lib.mingw_x86_64-cpython-311\psutil
  copying psutil\__init__.py -> build\lib.mingw_x86_64-cpython-311\psutil
  creating build\lib.mingw_x86_64-cpython-311\psutil\tests
  copying psutil\tests\runner.py -> build\lib.mingw_x86_64-cpython-311\psutil\tests
  copying psutil\tests\test_aix.py -> build\lib.mingw_x86_64-cpython-311\psutil\tests
  copying psutil\tests\test_bsd.py -> build\lib.mingw_x86_64-cpython-311\psutil\tests
  copying psutil\tests\test_connections.py -> build\lib.mingw_x86_64-cpython-311\psutil\tests
  copying psutil\tests\test_contracts.py -> build\lib.mingw_x86_64-cpython-311\psutil\tests
  copying psutil\tests\test_linux.py -> build\lib.mingw_x86_64-cpython-311\psutil\tests
  copying psutil\tests\test_memleaks.py -> build\lib.mingw_x86_64-cpython-311\psutil\tests
  copying psutil\tests\test_misc.py -> build\lib.mingw_x86_64-cpython-311\psutil\tests
  copying psutil\tests\test_osx.py -> build\lib.mingw_x86_64-cpython-311\psutil\tests
  copying psutil\tests\test_posix.py -> build\lib.mingw_x86_64-cpython-311\psutil\tests
  copying psutil\tests\test_process.py -> build\lib.mingw_x86_64-cpython-311\psutil\tests
  copying psutil\tests\test_process_all.py -> build\lib.mingw_x86_64-cpython-311\psutil\tests
  copying psutil\tests\test_sunos.py -> build\lib.mingw_x86_64-cpython-311\psutil\tests
  copying psutil\tests\test_system.py -> build\lib.mingw_x86_64-cpython-311\psutil\tests
  copying psutil\tests\test_testutils.py -> build\lib.mingw_x86_64-cpython-311\psutil\tests
  copying psutil\tests\test_unicode.py -> build\lib.mingw_x86_64-cpython-311\psutil\tests
  copying psutil\tests\test_windows.py -> build\lib.mingw_x86_64-cpython-311\psutil\tests
  copying psutil\tests\__init__.py -> build\lib.mingw_x86_64-cpython-311\psutil\tests
  copying psutil\tests\__main__.py -> build\lib.mingw_x86_64-cpython-311\psutil\tests
  running build_ext
  error: [WinError 2] The system cannot find the file specified
  error: subprocess-exited-with-error

  × Building wheel for psutil (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: 'C:\msys64\mingw64\bin\python.exe' 'C:\msys64\mingw64\lib\python3.11\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py' build_wheel 'C:\Users\username\AppData\Local\Temp\tmp3ttptkfv'
  cwd: C:\Users\username\AppData\Local\Temp\pip-install-2rp8ti5e\psutil_e67cf84ff0ec436ab0e7e8b023224ec2
  Building wheel for psutil (pyproject.toml) ... error
  ERROR: Failed building wheel for psutil
Failed to build psutil
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (psutil)

The error message does not suggest any solution to the problem, so I'm not sure where to go from here.

viocar commented 1 hour ago

Oh, damn it, I figured it out. My mistake. I had to install psutil through msys2, not through pip.