Skip to content

Instantly share code, notes, and snippets.

@amoudgl
Last active July 4, 2023 11:27
Show Gist options
  • Save amoudgl/011ed6273547c9312d4f834416ab1d0c to your computer and use it in GitHub Desktop.
Save amoudgl/011ed6273547c9312d4f834416ab1d0c to your computer and use it in GitHub Desktop.
Setup Visdom on Remote Server

Setup Visdom on Remote Server

Install visdom on your local system and remote server.

pip3 install visdom

On remote server, do:

ssh -N -f -L localhost:8097:localhost:8097 username@localsystemip

Set the same port in your python plotting script which you used in the port forwarding step above (8097 here).

Plotting script example [demo.py]:

import visdom
import numpy as np
cfg = {"server": "localhost",
       "port": 8097}
vis = visdom.Visdom('http://' + cfg["server"], port = cfg["port"])
vis.text('Hello Visdom!')
image = np.random.randint(0, 255, (3, 256, 256), dtype=np.uint8)
vis.image(image)

Run plotting script on remote server.

no_proxy=localhost python3 demo.py

Note for Ada: As of now, visdom only works if you have your proxy unset on Ada server. Either unset proxy with export http_proxy= or use no_proxy=localhost before your python command.

Run visdom server on local machine.

visdom

View your plots locally at http://localhost:8097.

@DakotaFan
Copy link

Hi there I can not use Visdom on the hpc cluster, and error message states that the Connection is refused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment