[GH-ISSUE #161] [BUG][Upstream] failed to get SWAP status on Windows with performance counter disabled #101

Closed
opened 2026-05-05 03:25:31 -06:00 by gitea-mirror · 2 comments
Owner

Originally created by @Ariloum on GitHub (Apr 18, 2025).
Original GitHub issue: https://github.com/XuehaiPan/nvitop/issues/161

Originally assigned to: @XuehaiPan on GitHub.

Required prerequisites

  • I have read the documentation https://nvitop.readthedocs.io.
  • I have searched the Issue Tracker that this hasn't already been reported. (comment there if it has.)
  • I have tried the latest version of nvitop in a new isolated virtual environment.

What version of nvitop are you using?

1.4.2

Operating system and version

Windows 10x64 22H2

NVIDIA driver version

Nvidia Studio 572.83

NVIDIA-SMI

nvidia-smi
Fri Apr 18 15:07:59 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 572.83                 Driver Version: 572.83         CUDA Version: 12.8     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                  Driver-Model | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 5090      WDDM  |   00000000:01:00.0  On |                  N/A |
| 30%   35C    P0             54W /  575W |   25080MiB /  32607MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A            6480    C+G   ...a\Roaming\Spotify\Spotify.exe      N/A      |
|    0   N/A  N/A            8912      C   ...grams\LM Studio\LM Studio.exe      N/A      |
|    0   N/A  N/A           14476    C+G   C:\Windows\explorer.exe               N/A      |
|    0   N/A  N/A           16852    C+G   ...cord\app-1.0.9188\Discord.exe      N/A      |
|    0   N/A  N/A           17140    C+G   ...h_cw5n1h2txyewy\SearchApp.exe      N/A      |
|    0   N/A  N/A           18812    C+G   ...ntrolPanel\SystemSettings.exe      N/A      |
|    0   N/A  N/A           22952    C+G   ...a Thunderbird\thunderbird.exe      N/A      |
|    0   N/A  N/A           23472    C+G   ...5n1h2txyewy\TextInputHost.exe      N/A      |
|    0   N/A  N/A           24360    C+G   ...Telegram Desktop\Telegram.exe      N/A      |
|    0   N/A  N/A           24468    C+G   ...8bbwe\PhoneExperienceHost.exe      N/A      |
|    0   N/A  N/A           24864    C+G   ....0.3179.73\msedgewebview2.exe      N/A      |
|    0   N/A  N/A           26348    C+G   ...m\106.0.4.0\GoogleDriveFS.exe      N/A      |
|    0   N/A  N/A           27252    C+G   ...4__cv1g1gvanyjgm\WhatsApp.exe      N/A      |
|    0   N/A  N/A           27288    C+G   ...temwide\SoundID Reference.exe      N/A      |
|    0   N/A  N/A           29308    C+G   ...ams\deezer-desktop\Deezer.exe      N/A      |
|    0   N/A  N/A           30684    C+G   ...r\frontend\Docker Desktop.exe      N/A      |
|    0   N/A  N/A           32928    C+G   ...lare WARP\Cloudflare WARP.exe      N/A      |
|    0   N/A  N/A           41096    C+G   ...er\Application\chromecent.exe      N/A      |
|    0   N/A  N/A           44160    C+G   ...86)\Battle.net\Battle.net.exe      N/A      |
|    0   N/A  N/A           47940    C+G   ...xyewy\ShellExperienceHost.exe      N/A      |
|    0   N/A  N/A           51772    C+G   ...grams\LM Studio\LM Studio.exe      N/A      |
|    0   N/A  N/A           54716    C+G   ...n534cwy3pjxzj\TradingView.exe      N/A      |
|    0   N/A  N/A           60012    C+G   ....jdks\openjdk-21\bin\java.exe      N/A      |
|    0   N/A  N/A           98240      C   ...grams\LM Studio\LM Studio.exe      N/A      |
|    0   N/A  N/A          102032    C+G   ...NVIDIA app\CEF\NVIDIA App.exe      N/A      |
+-----------------------------------------------------------------------------------------+

Python environment

python -m pip freeze
aiofiles==24.1.0
annotated-types==0.7.0
anyio==4.9.0
certifi==2025.1.31
charset-normalizer==3.4.1
click==8.1.8
colorama==0.4.6
cupy-cuda12x==13.4.0
distro==1.9.0
fastapi==0.115.12
fastrlock==0.8.3
ffmpy==0.5.0
filelock==3.17.0
fsspec==2025.2.0
gradio==5.25.2
gradio_client==1.8.0
groovy==0.1.2
h11==0.14.0
httpcore==1.0.8
httpx==0.28.1
httpx-sse==0.4.0
huggingface-hub==0.28.1
idna==3.10
Jinja2==3.1.5
jiter==0.9.0
markdown-it-py==3.0.0
MarkupSafe==3.0.2
mcp==1.6.0
mdurl==0.1.2
mpmath==1.3.0
networkx==3.4.2
numpy==2.2.2
nvidia-ml-py==12.570.86
nvitop==1.4.2
openai==1.75.0
orjson==3.10.16
packaging==24.2
pandas==2.2.3
pillow==11.1.0
psutil==7.0.0
pydantic==2.11.3
pydantic-settings==2.8.1
pydantic_core==2.33.1
pydub==0.25.1
Pygments==2.19.1
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
python-multipart==0.0.20
pytz==2025.2
PyYAML==6.0.2
requests==2.32.3
rich==14.0.0
ruff==0.11.5
safehttpx==0.1.6
safetensors==0.5.2
semantic-version==2.10.0
setuptools==75.8.0
shellingham==1.5.4
six==1.17.0
sniffio==1.3.1
sse-starlette==2.2.1
starlette==0.46.2
sympy==1.13.3
timm==1.0.13
tomlkit==0.13.2
torch==2.8.0.dev20250407+cu128
torchaudio==2.6.0.dev20250408+cu128
torchvision==0.22.0.dev20250408+cu128
tqdm==4.67.1
transliterate==1.10.2
typer==0.15.2
typing-inspection==0.4.0
typing_extensions==4.12.2
tzdata==2025.2
urllib3==2.3.0
uvicorn==0.34.1
websockets==15.0.1
windows-curses==2.4.1

python -c 'import sys; print(sys.version, sys.platform); print("".join(filter(lambda s: any(word in s.lower() for word in ("nvi", "cuda", "nvml", "gpu")), sys.stdin)))'
File "", line 1
'import
^
SyntaxError: unterminated string literal (detected at line 1)

python
Python 3.12.8 (tags/v3.12.8:2dc476b, Dec 3 2024, 19:30:04) [MSC v.1942 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import sys; print(sys.version, sys.platform); print("".join(filter(lambda s: any(word in s.lower() for word in ("nvi", "cuda", "nvml", "gpu")), sys.stdin)))
3.12.8 (tags/v3.12.8:2dc476b, Dec 3 2024, 19:30:04) [MSC v.1942 64 bit (AMD64)] win32

Problem description

I'm getting error while trying to run nvitop.
pip install nvitop <-- runs fine

Steps to Reproduce

The Python snippets (if any):


Command lines:


Traceback

nvitop
Exception in thread host-snapshot-daemon:
Traceback (most recent call last):
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "C:\Python\Lib\threading.py", line 1075, in _bootstrap_inner
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Python\Scripts\nvitop.exe\__main__.py", line 7, in <module>
    self.run()
  File "C:\Python\Lib\threading.py", line 1012, in run
  File "C:\Python\Lib\site-packages\nvitop\cli.py", line 360, in main
    self._target(*self._args, **self._kwargs)
  File "C:\Python\Lib\site-packages\nvitop\tui\screens\main\host.py", line 205, in _snapshot_target
    tui.loop()
  File "C:\Python\Lib\site-packages\nvitop\tui\tui.py", line 196, in loop
    self.take_snapshots()
  File "C:\Python\Lib\site-packages\nvitop\tui\screens\main\host.py", line 178, in take_snapshots
    self.redraw()
  File "C:\Python\Lib\site-packages\nvitop\tui\tui.py", line 186, in redraw
    host.swap_memory()
  File "C:\Python\Lib\site-packages\nvitop\tui\library\history.py", line 286, in wrapped
    self.poke()
    self.last_retval = retval = value = func(*args, **kwargs)
  File "C:\Python\Lib\site-packages\nvitop\tui\tui.py", line 134, in poke
                                        ^^^^^^^^^^^^^^^^^^^^^
    super().poke()
  File "C:\Python\Lib\site-packages\psutil\__init__.py", line 2036, in swap_memory
  File "C:\Python\Lib\site-packages\nvitop\tui\library\displayable.py", line 186, in poke
    displayable.poke()
    return _psplatform.swap_memory()
  File "C:\Python\Lib\site-packages\nvitop\tui\screens\main\__init__.py", line 138, in poke
           ^^^^^^^^^^^^^^^^^^^^^^^^^
    super().poke()
  File "C:\Python\Lib\site-packages\psutil\_pswindows.py", line 234, in swap_memory
  File "C:\Python\Lib\site-packages\nvitop\tui\library\displayable.py", line 186, in poke
    percentswap = cext.swap_percent()
                  ^^^^^^^^^^^^^^^^^^^
    displayable.poke()
RuntimeError: PdhAddEnglishCounterW failed. Performance counters may be disabled.
  File "C:\Python\Lib\site-packages\nvitop\tui\screens\main\host.py", line 250, in poke
    self.take_snapshots()
  File "C:\Python\Lib\site-packages\nvitop\tui\screens\main\host.py", line 178, in take_snapshots
    host.swap_memory()
  File "C:\Python\Lib\site-packages\nvitop\tui\library\history.py", line 286, in wrapped
    self.last_retval = retval = value = func(*args, **kwargs)
                                        ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python\Lib\site-packages\psutil\__init__.py", line 2036, in swap_memory
    return _psplatform.swap_memory()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python\Lib\site-packages\psutil\_pswindows.py", line 234, in swap_memory
    percentswap = cext.swap_percent()
                  ^^^^^^^^^^^^^^^^^^^
RuntimeError: PdhAddEnglishCounterW failed. Performance counters may be disabled.

Logs

Where should I add these params - PYTHONFAULTHANDLER=1 LOGLEVEL=DEBUG nvitop?

Expected behavior

No crashes on launch

Additional context

No response

Originally created by @Ariloum on GitHub (Apr 18, 2025). Original GitHub issue: https://github.com/XuehaiPan/nvitop/issues/161 Originally assigned to: @XuehaiPan on GitHub. ### Required prerequisites - [x] I have read the documentation <https://nvitop.readthedocs.io>. - [x] I have searched the [Issue Tracker](https://github.com/XuehaiPan/nvitop/issues) that this hasn't already been reported. (comment there if it has.) - [x] I have tried the latest version of nvitop in a new isolated virtual environment. ### What version of nvitop are you using? 1.4.2 ### Operating system and version Windows 10x64 22H2 ### NVIDIA driver version Nvidia Studio 572.83 ### NVIDIA-SMI ```text nvidia-smi Fri Apr 18 15:07:59 2025 +-----------------------------------------------------------------------------------------+ | NVIDIA-SMI 572.83 Driver Version: 572.83 CUDA Version: 12.8 | |-----------------------------------------+------------------------+----------------------+ | GPU Name Driver-Model | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+========================+======================| | 0 NVIDIA GeForce RTX 5090 WDDM | 00000000:01:00.0 On | N/A | | 30% 35C P0 54W / 575W | 25080MiB / 32607MiB | 0% Default | | | | N/A | +-----------------------------------------+------------------------+----------------------+ +-----------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=========================================================================================| | 0 N/A N/A 6480 C+G ...a\Roaming\Spotify\Spotify.exe N/A | | 0 N/A N/A 8912 C ...grams\LM Studio\LM Studio.exe N/A | | 0 N/A N/A 14476 C+G C:\Windows\explorer.exe N/A | | 0 N/A N/A 16852 C+G ...cord\app-1.0.9188\Discord.exe N/A | | 0 N/A N/A 17140 C+G ...h_cw5n1h2txyewy\SearchApp.exe N/A | | 0 N/A N/A 18812 C+G ...ntrolPanel\SystemSettings.exe N/A | | 0 N/A N/A 22952 C+G ...a Thunderbird\thunderbird.exe N/A | | 0 N/A N/A 23472 C+G ...5n1h2txyewy\TextInputHost.exe N/A | | 0 N/A N/A 24360 C+G ...Telegram Desktop\Telegram.exe N/A | | 0 N/A N/A 24468 C+G ...8bbwe\PhoneExperienceHost.exe N/A | | 0 N/A N/A 24864 C+G ....0.3179.73\msedgewebview2.exe N/A | | 0 N/A N/A 26348 C+G ...m\106.0.4.0\GoogleDriveFS.exe N/A | | 0 N/A N/A 27252 C+G ...4__cv1g1gvanyjgm\WhatsApp.exe N/A | | 0 N/A N/A 27288 C+G ...temwide\SoundID Reference.exe N/A | | 0 N/A N/A 29308 C+G ...ams\deezer-desktop\Deezer.exe N/A | | 0 N/A N/A 30684 C+G ...r\frontend\Docker Desktop.exe N/A | | 0 N/A N/A 32928 C+G ...lare WARP\Cloudflare WARP.exe N/A | | 0 N/A N/A 41096 C+G ...er\Application\chromecent.exe N/A | | 0 N/A N/A 44160 C+G ...86)\Battle.net\Battle.net.exe N/A | | 0 N/A N/A 47940 C+G ...xyewy\ShellExperienceHost.exe N/A | | 0 N/A N/A 51772 C+G ...grams\LM Studio\LM Studio.exe N/A | | 0 N/A N/A 54716 C+G ...n534cwy3pjxzj\TradingView.exe N/A | | 0 N/A N/A 60012 C+G ....jdks\openjdk-21\bin\java.exe N/A | | 0 N/A N/A 98240 C ...grams\LM Studio\LM Studio.exe N/A | | 0 N/A N/A 102032 C+G ...NVIDIA app\CEF\NVIDIA App.exe N/A | +-----------------------------------------------------------------------------------------+ ``` ### Python environment python -m pip freeze aiofiles==24.1.0 annotated-types==0.7.0 anyio==4.9.0 certifi==2025.1.31 charset-normalizer==3.4.1 click==8.1.8 colorama==0.4.6 cupy-cuda12x==13.4.0 distro==1.9.0 fastapi==0.115.12 fastrlock==0.8.3 ffmpy==0.5.0 filelock==3.17.0 fsspec==2025.2.0 gradio==5.25.2 gradio_client==1.8.0 groovy==0.1.2 h11==0.14.0 httpcore==1.0.8 httpx==0.28.1 httpx-sse==0.4.0 huggingface-hub==0.28.1 idna==3.10 Jinja2==3.1.5 jiter==0.9.0 markdown-it-py==3.0.0 MarkupSafe==3.0.2 mcp==1.6.0 mdurl==0.1.2 mpmath==1.3.0 networkx==3.4.2 numpy==2.2.2 nvidia-ml-py==12.570.86 nvitop==1.4.2 openai==1.75.0 orjson==3.10.16 packaging==24.2 pandas==2.2.3 pillow==11.1.0 psutil==7.0.0 pydantic==2.11.3 pydantic-settings==2.8.1 pydantic_core==2.33.1 pydub==0.25.1 Pygments==2.19.1 python-dateutil==2.9.0.post0 python-dotenv==1.1.0 python-multipart==0.0.20 pytz==2025.2 PyYAML==6.0.2 requests==2.32.3 rich==14.0.0 ruff==0.11.5 safehttpx==0.1.6 safetensors==0.5.2 semantic-version==2.10.0 setuptools==75.8.0 shellingham==1.5.4 six==1.17.0 sniffio==1.3.1 sse-starlette==2.2.1 starlette==0.46.2 sympy==1.13.3 timm==1.0.13 tomlkit==0.13.2 torch==2.8.0.dev20250407+cu128 torchaudio==2.6.0.dev20250408+cu128 torchvision==0.22.0.dev20250408+cu128 tqdm==4.67.1 transliterate==1.10.2 typer==0.15.2 typing-inspection==0.4.0 typing_extensions==4.12.2 tzdata==2025.2 urllib3==2.3.0 uvicorn==0.34.1 websockets==15.0.1 windows-curses==2.4.1 python -c 'import sys; print(sys.version, sys.platform); print("".join(filter(lambda s: any(word in s.lower() for word in ("nvi", "cuda", "nvml", "gpu")), sys.stdin)))' File "<string>", line 1 'import ^ SyntaxError: unterminated string literal (detected at line 1) python Python 3.12.8 (tags/v3.12.8:2dc476b, Dec 3 2024, 19:30:04) [MSC v.1942 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import sys; print(sys.version, sys.platform); print("".join(filter(lambda s: any(word in s.lower() for word in ("nvi", "cuda", "nvml", "gpu")), sys.stdin))) 3.12.8 (tags/v3.12.8:2dc476b, Dec 3 2024, 19:30:04) [MSC v.1942 64 bit (AMD64)] win32 ### Problem description I'm getting error while trying to run nvitop. pip install nvitop <-- runs fine ### Steps to Reproduce The Python snippets (if any): ```python ``` Command lines: ```bash ``` ### Traceback ```pytb nvitop Exception in thread host-snapshot-daemon: Traceback (most recent call last): Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "C:\Python\Lib\threading.py", line 1075, in _bootstrap_inner File "<frozen runpy>", line 88, in _run_code File "C:\Python\Scripts\nvitop.exe\__main__.py", line 7, in <module> self.run() File "C:\Python\Lib\threading.py", line 1012, in run File "C:\Python\Lib\site-packages\nvitop\cli.py", line 360, in main self._target(*self._args, **self._kwargs) File "C:\Python\Lib\site-packages\nvitop\tui\screens\main\host.py", line 205, in _snapshot_target tui.loop() File "C:\Python\Lib\site-packages\nvitop\tui\tui.py", line 196, in loop self.take_snapshots() File "C:\Python\Lib\site-packages\nvitop\tui\screens\main\host.py", line 178, in take_snapshots self.redraw() File "C:\Python\Lib\site-packages\nvitop\tui\tui.py", line 186, in redraw host.swap_memory() File "C:\Python\Lib\site-packages\nvitop\tui\library\history.py", line 286, in wrapped self.poke() self.last_retval = retval = value = func(*args, **kwargs) File "C:\Python\Lib\site-packages\nvitop\tui\tui.py", line 134, in poke ^^^^^^^^^^^^^^^^^^^^^ super().poke() File "C:\Python\Lib\site-packages\psutil\__init__.py", line 2036, in swap_memory File "C:\Python\Lib\site-packages\nvitop\tui\library\displayable.py", line 186, in poke displayable.poke() return _psplatform.swap_memory() File "C:\Python\Lib\site-packages\nvitop\tui\screens\main\__init__.py", line 138, in poke ^^^^^^^^^^^^^^^^^^^^^^^^^ super().poke() File "C:\Python\Lib\site-packages\psutil\_pswindows.py", line 234, in swap_memory File "C:\Python\Lib\site-packages\nvitop\tui\library\displayable.py", line 186, in poke percentswap = cext.swap_percent() ^^^^^^^^^^^^^^^^^^^ displayable.poke() RuntimeError: PdhAddEnglishCounterW failed. Performance counters may be disabled. File "C:\Python\Lib\site-packages\nvitop\tui\screens\main\host.py", line 250, in poke self.take_snapshots() File "C:\Python\Lib\site-packages\nvitop\tui\screens\main\host.py", line 178, in take_snapshots host.swap_memory() File "C:\Python\Lib\site-packages\nvitop\tui\library\history.py", line 286, in wrapped self.last_retval = retval = value = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Python\Lib\site-packages\psutil\__init__.py", line 2036, in swap_memory return _psplatform.swap_memory() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python\Lib\site-packages\psutil\_pswindows.py", line 234, in swap_memory percentswap = cext.swap_percent() ^^^^^^^^^^^^^^^^^^^ RuntimeError: PdhAddEnglishCounterW failed. Performance counters may be disabled. ``` ### Logs ```text Where should I add these params - PYTHONFAULTHANDLER=1 LOGLEVEL=DEBUG nvitop? ``` ### Expected behavior No crashes on launch ### Additional context _No response_
gitea-mirror 2026-05-05 03:25:31 -06:00
Author
Owner

@Ariloum commented on GitHub (Apr 18, 2025):

I guess it's because my Perfomance Counters are disabled, I found that windows were abusing some of my SSD and was doing heavy writes with tons of gigabytes.. Thus I classified this as unwanted/bugged/sabotaged and triggered that off.

Why did nvitop needs these counters? I can see my GPU/CPU stats with CUDA/memory usage and so on in all other monitoring programs..

<!-- gh-comment-id:2815968960 --> @Ariloum commented on GitHub (Apr 18, 2025): I guess it's because my Perfomance Counters are disabled, I found that windows were abusing some of my SSD and was doing heavy writes with tons of gigabytes.. Thus I classified this as unwanted/bugged/sabotaged and triggered that off. Why did nvitop needs these counters? I can see my GPU/CPU stats with CUDA/memory usage and so on in all other monitoring programs..
Author
Owner

@XuehaiPan commented on GitHub (Apr 19, 2025):

Why did nvitop needs these counters?

@Ariloum nvitop calls psutil APIs to retrieve system metrics. I think you should file this issue to psutil upstream instead.

<!-- gh-comment-id:2816722492 --> @XuehaiPan commented on GitHub (Apr 19, 2025): > Why did nvitop needs these counters? @Ariloum `nvitop` calls `psutil` APIs to retrieve system metrics. I think you should file this issue to `psutil` upstream instead.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/nvitop#101
No description provided.