[GH-ISSUE #97] [BUG] ERROR: Failed to initialize curses (curs_set() returned ERR) in tmux environment #58

Closed
opened 2026-05-05 03:23:59 -06:00 by gitea-mirror · 5 comments
Owner

Originally created by @slacklife on GitHub (Sep 22, 2023).
Original GitHub issue: https://github.com/XuehaiPan/nvitop/issues/97

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.3.0

Operating system and version

Ubuntu 18.04.5 LTS

NVIDIA driver version

470.103.01

NVIDIA-SMI

│   1 2721979 C     N/A  8231MiB   0   N/A   N/A   N/A  No Such Process                            │
                                                                                                      ├──────────────────────────────────────────────────────────────────────────────────────────────────┤
                                                                                                                                                                                                          │   2 1819872 C     N/A 67.46GiB  97   N/A   N/A   N/A  No Such Process                            │
                                                       │   2 2721979 C     N/A  8231MiB   0   N/A   N/A   N/A  No Such Process                            │
                                                                                                                                                           ├──────────────────────────────────────────────────────────────────────────────────────────────────┤
        │   3 1819873 C     N/A 61.67GiB  98   N/A   N/A   N/A  No Such Process                            │
                                                                                                            │   3 2721979 C     N/A  7185MiB   0   N/A   N/A   N/A  No Such Process                            │
                                                                                                                                                                                                                ╘══════════════════════════════════════════════════════════════════════════════════════════════════╛
                                                             ERROR: Failed to initialize `curses` (curs_set() returned ERR)

Python environment

gpustat==1.1.1
nvidia-cublas-cu11==11.10.3.66
nvidia-cuda-cupti-cu11==11.7.101
nvidia-cuda-nvrtc-cu11==11.7.99
nvidia-cuda-runtime-cu11==11.7.99
nvidia-cudnn-cu11==8.5.0.96
nvidia-cufft-cu11==10.9.0.58
nvidia-curand-cu11==10.2.10.91
nvidia-cusolver-cu11==11.4.0.1
nvidia-cusparse-cu11==11.7.4.91
nvidia-htop==1.0.5
nvidia-ml-py==12.535.108
nvidia-nccl-cu11==2.14.3
nvidia-nvtx-cu11==11.7.91
py3nvml==0.2.7

Problem description

It works in normal shell.
However, it fails in tmux 3.1 environment.
It report ERROR: Failed to initialize `curses` (curs_set() returned ERR)

I have tried the solution here.

sudo apt install python3-dev python3-pip
/usr/bin/python3`` -m pip install --user nvitop
~/.local/bin/nvitop

But it produced the same issue, no matter in the conda environment or not.
It only differs when using tmux or not.

Steps to Reproduce

The Python snippets (if any):


Command lines:

nvitop

Traceback

No response

Logs

No response

Expected behavior

No response

Additional context

No response

Originally created by @slacklife on GitHub (Sep 22, 2023). Original GitHub issue: https://github.com/XuehaiPan/nvitop/issues/97 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.) - [ ] I have tried the latest version of nvitop in a new isolated virtual environment. ### What version of nvitop are you using? 1.3.0 ### Operating system and version Ubuntu 18.04.5 LTS ### NVIDIA driver version 470.103.01 ### NVIDIA-SMI ```text │ 1 2721979 C N/A 8231MiB 0 N/A N/A N/A No Such Process │ ├──────────────────────────────────────────────────────────────────────────────────────────────────┤ │ 2 1819872 C N/A 67.46GiB 97 N/A N/A N/A No Such Process │ │ 2 2721979 C N/A 8231MiB 0 N/A N/A N/A No Such Process │ ├──────────────────────────────────────────────────────────────────────────────────────────────────┤ │ 3 1819873 C N/A 61.67GiB 98 N/A N/A N/A No Such Process │ │ 3 2721979 C N/A 7185MiB 0 N/A N/A N/A No Such Process │ ╘══════════════════════════════════════════════════════════════════════════════════════════════════╛ ERROR: Failed to initialize `curses` (curs_set() returned ERR) ``` ### Python environment gpustat==1.1.1 nvidia-cublas-cu11==11.10.3.66 nvidia-cuda-cupti-cu11==11.7.101 nvidia-cuda-nvrtc-cu11==11.7.99 nvidia-cuda-runtime-cu11==11.7.99 nvidia-cudnn-cu11==8.5.0.96 nvidia-cufft-cu11==10.9.0.58 nvidia-curand-cu11==10.2.10.91 nvidia-cusolver-cu11==11.4.0.1 nvidia-cusparse-cu11==11.7.4.91 nvidia-htop==1.0.5 nvidia-ml-py==12.535.108 nvidia-nccl-cu11==2.14.3 nvidia-nvtx-cu11==11.7.91 py3nvml==0.2.7 ### Problem description It works in normal shell. However, it fails in tmux 3.1 environment. It report ``ERROR: Failed to initialize `curses` (curs_set() returned ERR)`` I have tried the solution [here](https://github.com/XuehaiPan/nvitop/issues/16). > sudo apt install python3-dev python3-pip > /usr/bin/python3`` -m pip install --user nvitop > ~/.local/bin/nvitop But it produced the same issue, no matter in the conda environment or not. It only differs when using tmux or not. ### Steps to Reproduce The Python snippets (if any): ```python ``` Command lines: ```bash nvitop ``` ### Traceback _No response_ ### Logs _No response_ ### Expected behavior _No response_ ### Additional context _No response_
gitea-mirror 2026-05-05 03:23:59 -06:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@XuehaiPan commented on GitHub (Sep 22, 2023):

It works in normal shell.
However, it fails in tmux 3.1 environment.
It report ERROR: Failed to initialize `curses` (curs_set() returned ERR)

It only differs when using tmux or not.

Hi @slacklife, can you try to set:

set -g default-terminal "tmux-256color"
set -g utf8 on

in your tmux.conf? Then you need to reload your tmux configuration.

<!-- gh-comment-id:1731214878 --> @XuehaiPan commented on GitHub (Sep 22, 2023): > It works in normal shell. > However, it fails in tmux 3.1 environment. > It report ``ERROR: Failed to initialize `curses` (curs_set() returned ERR)`` > It only differs when using tmux or not. Hi @slacklife, can you try to set: ``` set -g default-terminal "tmux-256color" set -g utf8 on ``` in your `tmux.conf`? Then you need to reload your tmux configuration.
Author
Owner

@slacklife commented on GitHub (Sep 22, 2023):

Thanks for your comment, but it didn't work.
set -g utf8 on is for an old version of tmux. They were set in a way so they don't error in newer versions. Please refer to here

set -g default-terminal "tmux-256color" is my default setting in my .tmux.conf

Are there any other solutions to solve my problem?

<!-- gh-comment-id:1731234170 --> @slacklife commented on GitHub (Sep 22, 2023): Thanks for your comment, but it didn't work. `set -g utf8 on` is for an old version of tmux. They were set in a way so they don't error in newer versions. Please refer to [here](https://github.com/tmux-plugins/tmux-sensible/issues/58) `set -g default-terminal "tmux-256color"` is my default setting in my .tmux.conf Are there any other solutions to solve my problem?
Author
Owner

@XuehaiPan commented on GitHub (Sep 22, 2023):

@slacklife Do you set your TERM environment variable correctly in your tmux shell? For example:

export TERM="xterm-256color"
export LC_ALL="en_US.UTF-8"
<!-- gh-comment-id:1731278279 --> @XuehaiPan commented on GitHub (Sep 22, 2023): @slacklife Do you set your `TERM` environment variable correctly in your tmux shell? For example: ```bash export TERM="xterm-256color" export LC_ALL="en_US.UTF-8" ```
Author
Owner

@slacklife commented on GitHub (Sep 22, 2023):

It works magically! Many thanks!
Nvitop is a great tool!

<!-- gh-comment-id:1731280766 --> @slacklife commented on GitHub (Sep 22, 2023): It works magically! Many thanks! Nvitop is a great tool!
Author
Owner

@XuehaiPan commented on GitHub (Sep 22, 2023):

It works magically!

Glad to hear that. You could put these in your shell profile (e.g., ~/.bashrc, ~/.zshrc) to automatically set these variables on startup.

export TERM="xterm-256color"
export LC_ALL="en_US.UTF-8"
<!-- gh-comment-id:1731286207 --> @XuehaiPan commented on GitHub (Sep 22, 2023): > It works magically! Glad to hear that. You could put these in your shell profile (e.g., `~/.bashrc`, `~/.zshrc`) to automatically set these variables on startup. ```bash export TERM="xterm-256color" export LC_ALL="en_US.UTF-8" ```
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#58
No description provided.