I've got a problem with using psutil in python project. Psutil is installed, but visual studio still says it's not found. Any ideas why it's not working? I'm using Win 10 and Visual Studio 16.8.1 and python 3.9
Edit: I tried all of these:
Edit 2:
I uninstalled psutil and tried to install it again:
ERROR: Command errored out with exit status 1:
command: 'c:\users\qmotusotus\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\qmotusotus\\AppData\\Local\\Temp\\pip-install-9gi_5la8\\psutil\\setup.py'"'"'; __file__='"'"'C:\\Users\\qmotusotus\\AppData\\Local\\Temp\\pip-install-9gi_5la8\\psutil\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\qmotusotus\AppData\Local\Temp\pip-record-gckzeuh8\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\qmotusotus\appdata\local\programs\python\python39\Include\psutil'
cwd: C:\Users\qmotusotus\AppData\Local\Temp\pip-install-9gi_5la8\psutil\
Complete output (47 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\psutil
copying psutil\_common.py -> build\lib.win-amd64-3.9\psutil
copying psutil\_compat.py -> build\lib.win-amd64-3.9\psutil
copying psutil\_psaix.py -> build\lib.win-amd64-3.9\psutil
copying psutil\_psbsd.py -> build\lib.win-amd64-3.9\psutil
copying psutil\_pslinux.py -> build\lib.win-amd64-3.9\psutil
copying psutil\_psosx.py -> build\lib.win-amd64-3.9\psutil
copying psutil\_psposix.py -> build\lib.win-amd64-3.9\psutil
copying psutil\_pssunos.py -> build\lib.win-amd64-3.9\psutil
copying psutil\_pswindows.py -> build\lib.win-amd64-3.9\psutil
copying psutil\__init__.py -> build\lib.win-amd64-3.9\psutil
creating build\lib.win-amd64-3.9\psutil\tests
copying psutil\tests\runner.py -> build\lib.win-amd64-3.9\psutil\tests
copying psutil\tests\test_aix.py -> build\lib.win-amd64-3.9\psutil\tests
copying psutil\tests\test_bsd.py -> build\lib.win-amd64-3.9\psutil\tests
copying psutil\tests\test_connections.py -> build\lib.win-amd64-3.9\psutil\tests
copying psutil\tests\test_contracts.py -> build\lib.win-amd64-3.9\psutil\tests
copying psutil\tests\test_linux.py -> build\lib.win-amd64-3.9\psutil\tests
copying psutil\tests\test_memleaks.py -> build\lib.win-amd64-3.9\psutil\tests
copying psutil\tests\test_misc.py -> build\lib.win-amd64-3.9\psutil\tests
copying psutil\tests\test_osx.py -> build\lib.win-amd64-3.9\psutil\tests
copying psutil\tests\test_posix.py -> build\lib.win-amd64-3.9\psutil\tests
copying psutil\tests\test_process.py -> build\lib.win-amd64-3.9\psutil\tests
copying psutil\tests\test_sunos.py -> build\lib.win-amd64-3.9\psutil\tests
copying psutil\tests\test_system.py -> build\lib.win-amd64-3.9\psutil\tests
copying psutil\tests\test_testutils.py -> build\lib.win-amd64-3.9\psutil\tests
copying psutil\tests\test_unicode.py -> build\lib.win-amd64-3.9\psutil\tests
copying psutil\tests\test_windows.py -> build\lib.win-amd64-3.9\psutil\tests
copying psutil\tests\__init__.py -> build\lib.win-amd64-3.9\psutil\tests
copying psutil\tests\__main__.py -> build\lib.win-amd64-3.9\psutil\tests
running build_ext
building 'psutil._psutil_windows' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\psutil
creating build\temp.win-amd64-3.9\Release\psutil\arch
creating build\temp.win-amd64-3.9\Release\psutil\arch\windows
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=573 -DPSUTIL_WINDOWS=1 -D_WIN32_WINNT=0x01000 -D_AVAIL_WINVER_=0x01000 -D_CRT_SECURE_NO_WARNINGS -DPSAPI_VERSION=1 -Ic:\users\qmotusotus\appdata\local\programs\python\python39\include -Ic:\users\qmotusotus\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt /Tcpsutil/_psutil_common.c /Fobuild\temp.win-amd64-3.9\Release\psutil/_psutil_common.obj
_psutil_common.c
c:\users\qmotusotus\appdata\local\programs\python\python39\include\pyconfig.h(201): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
VisualStudio is not installed; get it from http://www.visualstudio.com/en-au/news/vs2015-preview-vs
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\qmotusotus\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\qmotusotus\\AppData\\Local\\Temp\\pip-install-9gi_5la8\\psutil\\setup.py'"'"'; __file__='"'"'C:\\Users\\qmotusotus\\AppData\\Local\\Temp\\pip-install-9gi_5la8\\psutil\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\qmotusotus\AppData\Local\Temp\pip-record-gckzeuh8\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\qmotusotus\appdata\local\programs\python\python39\Include\psutil' Check the logs for full command output.
Answer
In Windows command prompt enter:
python -m pip install --upgrade pip
then write:
python -m pip install psutil
and just in case type:
python -m pip install --upgrade psutil
References and Additional Links:
Error : No module named 'psutil'