Elton Overs
Elton Overs

Reputation: 1

PIP Cannot Install psutil

below are my specs

My PC is running Windows 11 V. 21H2. I am using Python 3.10. I use Pycharm 2021.2.3. I am using PIP 21.3.1 to install python libraries. To the best of my knowledge, everything is up to date.

I'm using the pip install psutil funtion in the terminal. I was able to initialize the install and begin the download, but it failed with a lot of errors.

I then tried to run cmd /k pip install --no-binary :all: psutil per recomendation of the python website. Still no luck, eact same errors.

The install beings very normal.

Collecting psutil
Using cached psutil-5.8.0.tar.gz (470 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Using legacy 'setup.py install' for psutil, since package 'wheel' is not installed.
Installing collected packages: psutil
Running setup.py install for psutil: started
Running setup.py install for psutil: finished with status 'error' 

However, it runs into an error and spits this out.


ERROR: Command errored out with exit status 1:
 command: 'C:\Users\elton\AppData\Local\Programs\Python\Python310\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\elton\\AppData\\Local\\Temp\\pip-install-fi8xi6rq\\psutil_87b30645105b42978bc30b4b75398dbe\\setup.py'"'"'; __file__='"'"'C:\\Users\\elton\\AppData\\Local\\Temp\\pip-install-fi8xi6rq\\psutil_87b30645105b42978bc30b4b75398dbe\\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('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\elton\AppData\Local\Temp\pip-record-cr321z3l\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\elton\AppData\Local\Programs\Python\Python310\Include\psutil'
     cwd: C:\Users\elton\AppData\Local\Temp\pip-install-fi8xi6rq\psutil_87b30645105b42978bc30b4b75398dbe\
Complete output (40 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.10
creating build\lib.win-amd64-3.10\psutil
copying psutil\_common.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_compat.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_psaix.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_psbsd.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_pslinux.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_psosx.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_psposix.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_pssunos.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_pswindows.py -> build\lib.win-amd64-3.10\psutil
copying psutil\__init__.py -> build\lib.win-amd64-3.10\psutil
creating build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\runner.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_aix.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_bsd.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_connections.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_contracts.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_linux.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_memleaks.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_misc.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_osx.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_posix.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_process.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_sunos.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_system.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_testutils.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_unicode.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_windows.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\__init__.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\__main__.py -> build\lib.win-amd64-3.10\psutil\tests
warning: build_py: byte-compiling is disabled, skipping.

running build_ext
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/
--------------------------------------- 

I checked my installed versions of Microsoft Visual C++ and my most recent version is 14.0.23506.0. This leads me to believe that I'm up to date.

Then I receive another error


Command errored out with exit status 1: 
'C:\Users\elton\AppData\Local\Programs\Python\Python310\python.exe' -u -c 'import io, 
os, sys, setuptools, tokenize; sys.argv[0] = 
'"'"'C:\\Users\\elton\\AppData\\Local\\Temp\\pip-install- 
fi8xi6rq\\psutil_87b30645105b42978bc30b4b75398dbe\\setup.py'"'"'; 
__file__='"'"'C:\\Users\\elton\\AppData\\Local\\Temp\\pip-install- 
fi8xi6rq\\psutil_87b30645105b42978bc30b4b75398dbe\\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('"'"'\r\n'"'"', 
'"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 
'C:\Users\elton\AppData\Local\Temp\pip-record-cr321z3l\install-record.txt' --single- 
version-externally-managed --compile --install-headers 
'C:\Users\elton\AppData\Local\Programs\Python\Python310\Include\psutil' Check the logs 
for full command output. 

I check the C:\Users\elton\AppData\Local\Programs\Python\Python310\Include\psutil file location to find the log but it is not there.

I have checked multiple sources looking for answers about the Visual C++ and I see that its common for people to have this error when multiple versions of python installed but I only have one version installed.

Any help would be greatly appreciated.

Upvotes: 0

Views: 1613

Answers (1)

EFats
EFats

Reputation: 11

This worked for me: https://blog.hqcodeshop.fi/archives/499-Python-Windows-Pip-requiring-Build-Tools-for-Visual-Studio.html Get the 2017 version of the build tools then explicitly ask to install that specific version "MSVC v140 - VS 2015 C++ build tools (v14.00)" of the build tools under "Individual Components".

I'm not sure if it must be from the 2017 version. I would hope that any version which has that version of build tools should work, but given all the failed answers, maybe it has to be exactly that one.

Upvotes: 1

Related Questions