question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Faile to run ``gpustat --debug'': pynvml.NVMLError_LibraryNotFound: NVML Shared Library Not Found

See original GitHub issue

Hi,

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:closed
  • Created 3 years ago
  • Comments:18 (4 by maintainers)

github_iconTop GitHub Comments

19reactions
garcolazocommented, Jan 3, 2021

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.

3reactions
jungwon-choicommented, Jul 23, 2021

You can solve this issue as belows:

  1. Search “nvml.dll” file in “C:\Windows\System32\DriverStore\FileRepository”
  2. Copy “nvml.dll” file to “C:\Program Files\NVIDIA Corporation\NVSMI” (Make NVSMI folder if not in there by yourself)
  3. Done
Read more comments on GitHub >

github_iconTop 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 >
gpustat - PyPI
An utility to monitor NVIDIA GPU status and usage.
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found