Faile to run ``gpustat --debug'': pynvml.NVMLError_LibraryNotFound: NVML Shared Library Not Found
See original GitHub issueHi,
On Ubuntu 20.04 with Python 3.8.3, I failed to run gpustat --debug, as shown below:
$ gpustat --debug
Error on querying NVIDIA devices. Use --debug flag for details
Traceback (most recent call last):
File "/home/werner/.pyenv/versions/3.8.3/envs/socks5-haproxy/lib/python3.8/site-packages/pynvml.py", line 644, in _LoadNvmlLibrary
nvmlLib = CDLL("libnvidia-ml.so.1")
File "/home/werner/.pyenv/versions/3.8.3/lib/python3.8/ctypes/__init__.py", line 373, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libnvidia-ml.so.1: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/werner/.pyenv/versions/3.8.3/envs/socks5-haproxy/lib/python3.8/site-packages/gpustat/__main__.py", line 19, in print_gpustat
gpu_stats = GPUStatCollection.new_query()
File "/home/werner/.pyenv/versions/3.8.3/envs/socks5-haproxy/lib/python3.8/site-packages/gpustat/core.py", line 281, in new_query
N.nvmlInit()
File "/home/werner/.pyenv/versions/3.8.3/envs/socks5-haproxy/lib/python3.8/site-packages/pynvml.py", line 608, in nvmlInit
_LoadNvmlLibrary()
File "/home/werner/.pyenv/versions/3.8.3/envs/socks5-haproxy/lib/python3.8/site-packages/pynvml.py", line 646, in _LoadNvmlLibrary
_nvmlCheckReturn(NVML_ERROR_LIBRARY_NOT_FOUND)
File "/home/werner/.pyenv/versions/3.8.3/envs/socks5-haproxy/lib/python3.8/site-packages/pynvml.py", line 310, in _nvmlCheckReturn
raise NVMLError(ret)
pynvml.NVMLError_LibraryNotFound: NVML Shared Library Not Found
Issue Analytics
- State:
- Created 3 years ago
- Comments:18 (4 by maintainers)
Top Results From Across the Web
NVML Shared Library Not Found" in bitbucket-pipelines
I am trying to execute the following bitbucket-pipelines config: clone: depth: full options: max-time: 4 # maximum minutes to run the tests ...
Read more >NVML Shared Library Not Found - Part 1 (2019) - Fast.ai forums
I am trying to execute this code snipped from the tutorial from pynvml import * nvmlInit() handle = nvmlDeviceGetHandleByIndex(0) info ...
Read more >解决pynvml 报错NVML Shared Library Not Found / WinError 126
在Windows中调用 pynvml.nvmlInit() 时出错:. 错误信息:. File "E:\Program_Files\Annoconda\lib\site-packages\pynvml\nvml.
Read more >Cannot dynamically load a shared library containing both ...
We are currently working on making the GPU-enabled version of an application dynamically loadable from Python, which implies bundling ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This was my solution hope it helps someone:
pynvml ask for nvml.dll on "C:\Program Files\NVIDIA Corporation\NVSMI" and "C:\Windows\System32", but the new installer puts the file in “C:\Windows\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_aXXXXXXXXXXXXXX”, just copy the dll from “FileRepostory” to the “Program Files” location.
If there is no “NVSMI” folder inside “C:\Program Files\NVIDIA Corporation” make one and just put the dll inside
The nvml.dll on system32 is 596kb, the file inside “FileRepostory” is 1051kb, if there is a nvml.dll inside “Program Files” but is the 596kb version, just replace it for the 1051kb one.
Make sure right click and copy the file and not just hold and move, it will take the original file from “File Repository” and you will not have privileges to copy back or undo the file move.
You can solve this issue as belows: