giampaolo / psutil

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

[Windows11] Unable to install psutil on pypy 3.9.18 with MSVC 14.38.33130 - Error LNK2001 #2337

Closed nikfio closed 11 months ago

nikfio commented 11 months ago

Summary

Description

Hello everyone,

I have psutil 5.9.6 as a dependence in my project. I can't build it and install it due to a LNK2001 linking error followed by a LNK1120 fatal error.

Here I report the ending ouput by running pip wheel --no-cache-dir --use-pep517 "psutil (==5.9.6)" :

"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=596 -DPSUTIL_WINDOWS=1 -D_WIN32_WINNT=0x0602 -D_AVAIL_WINVER_=0x0602 -D_CRT_SECURE_NO_WARNINGS -DPSAPI_VERSION=1 -IC:\Users\fiora\AppData\Local\pypoetry\Cache\virtualenvs\forex-prediction-RLn2OR0V-py3.9\include -IC:\tools\miniforgepypy3\include -IC:\tools\miniforgepypy3\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" /Tcpsutil/arch/windows\wmi.c /Fobuild\temp.win-amd64-pypy39\Release\psutil/arch/windows\wmi.obj
      wmi.c
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\bin\HostX86\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\fiora\AppData\Local\pypoetry\Cache\virtualenvs\forex-prediction-RLn2OR0V-py3.9\libs /LIBPATH:C:\tools\miniforgepypy3\libs /LIBPATH:C:\tools\miniforgepypy3 /LIBPATH:C:\Users\fiora\AppData\Local\pypoetry\Cache\virtualenvs\forex-prediction-RLn2OR0V-py3.9\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621.0\\um\x64" psapi.lib kernel32.lib advapi32.lib shell32.lib netapi32.lib ws2_32.lib PowrProf.lib pdh.lib /EXPORT:PyInit__psutil_windows build\temp.win-amd64-pypy39\Release\psutil/_psutil_common.obj build\temp.win-amd64-pypy39\Release\psutil/_psutil_windows.obj build\temp.win-amd64-pypy39\Release\psutil/arch/windows\cpu.obj build\temp.win-amd64-pypy39\Release\psutil/arch/windows\disk.obj build\temp.win-amd64-pypy39\Release\psutil/arch/windows\mem.obj build\temp.win-amd64-pypy39\Release\psutil/arch/windows\net.obj build\temp.win-amd64-pypy39\Release\psutil/arch/windows\proc.obj build\temp.win-amd64-pypy39\Release\psutil/arch/windows\proc_handles.obj build\temp.win-amd64-pypy39\Release\psutil/arch/windows\proc_info.obj build\temp.win-amd64-pypy39\Release\psutil/arch/windows\proc_utils.obj build\temp.win-amd64-pypy39\Release\psutil/arch/windows\security.obj build\temp.win-amd64-pypy39\Release\psutil/arch/windows\sensors.obj build\temp.win-amd64-pypy39\Release\psutil/arch/windows\services.obj build\temp.win-amd64-pypy39\Release\psutil/arch/windows\socks.obj build\temp.win-amd64-pypy39\Release\psutil/arch/windows\sys.obj build\temp.win-amd64-pypy39\Release\psutil/arch/windows\wmi.obj /OUT:build\lib.win-amd64-pypy39\psutil\_psutil_windows.pypy39-pp73-win_amd64.pyd /IMPLIB:build\temp.win-amd64-pypy39\Release\psutil\_psutil_windows.pypy39-pp73-win_amd64.lib
         Creando biblioteca build\temp.win-amd64-pypy39\Release\psutil\_psutil_windows.pypy39-pp73-win_amd64.lib y objeto build\temp.win-amd64-pypy39\Release\psutil\_psutil_windows.pypy39-pp73-win_amd64.exp
      disk.obj : error LNK2001: s\xa1mbolo externo PyErr_SetExcFromWindowsErrWithFilenameObject sin resolver
      build\lib.win-amd64-pypy39\psutil\_psutil_windows.pypy39-pp73-win_amd64.pyd : fatal error LNK1120: 1 externos sin resolver
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX86\\x64\\link.exe' failed with exit code 1120

Do you guys have any suggestion or anything to try?

A related and already closed issue would be https://github.com/giampaolo/psutil/issues/1571#issue-483832698.

I would add also that install psutil 5.9.5 runs smoothly. Test completed with pip wheel --no-cache-dir --use-pep517 "psutil (==5.9.5)"

Thanks, Nicola

ben9923 commented 11 months ago

PyPy has some missing PyErr functions, causing build to fail.

A workaround for this will be included in psutil 5.9.7, and a proper fix for this issue will be included in PyPy 7.3.14.

Until one of those is out, you could try a PyPy nightly build which already includes a fix, or installing psutil from latest source (pip install git+https://github.com/giampaolo/psutil)

See #2325

giampaolo commented 11 months ago

psutil 5.9.7 is released. Closing.

nikfio commented 11 months ago

thakn you guys for the new release.

Anyways, also trying the latest PyPy nightly build solved the problem.