headless displays on remote server with port-forwarding
See original GitHub issueHow to properly use vtki on remote servers?
On a remote server with port-forwarding (i.e. ssh ... -L 8888:localhost:8888
), the Jupyter kernel always dies when I call plot()
on vtki objects (The kernel appears to have died. It will restart automatically.
) . This happens on both AWS EC2 and a local cluster.
A minimum reproducible code is:
import vtki
from vtki import examples
ds = examples.load_airplane()
ds.plot(use_pane=True) # this kills the kernel
# use_panel=False gives the same error
Similar in ipython
:
In [1]: import vtki
...: from vtki import examples
...: ds = examples.load_airplane()
In [2]: ds.plot()
ERROR:root:bad X server connection. DISPLAY=
Aborted (core dumped)
In principle it should work on remote servers, because the Binder demos are working properly. But Binder is connected directly via HTTP, while on most remote servers people would use SSH+port-forwarding.
Environment setup
I am using EC2 Ubuntu 18.04 LTS (ami-0a313d6098716f372
in us-east-1
). The complete steps to install the packages are:
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p miniconda
echo '. $HOME/miniconda/etc/profile.d/conda.sh' >> ~/.bashrc && source ~/.bashrc
conda create --name vtk python=3.7
conda activate vtk
conda install nodejs # required when importing vtki in Jupyter
pip install jupyter vtki panel
# To avoid "ModuleNotFoundError: No module named 'vtkOpenGLKitPython' " when importing vtk
# https://stackoverflow.com/q/32389599
# https://askubuntu.com/q/629692
sudo apt update && sudo apt install python-qt4 libgl1-mesa-glx
python -c "import vtki" # it should work
The notebook is started with:
ssh ... -L 8888:localhost:8888
conda activate vtk
jupyter notebook --NotebookApp.token='' --no-browser --port=8888
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
headless displays on remote server with port-forwarding #177
But Binder is connected directly via HTTP, while on most remote servers people would use SSH+port-forwarding. Environment setup. I am using EC2 ...
Read more >What are the options for remoting into a headless pc when ...
I have a headless PC on my dads network where port forwarding is not an option(the reason rdp wont work) and team viewer...
Read more >simple headless server - best method of remote control?
Forward a port on your router and you can use it from the internet. Port forwarding allows you to forward something like 22...
Read more >SSH WebGUI forwarding headless server - Syncthing Forum
Syncthing by default listens on port 8384 for GUI access. So at least on the remote system, that's the port you need to...
Read more >How to forward X over SSH to run graphics applications ...
If you run ssh and DISPLAY is not set, it means ssh is not forwarding the X11 ... Server listening on 0.0.0.0 port...
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
No problem! Being a grad student who also does a bunch of geoscience and software development, I’d love to see this sort of software projects taking off.
Not sure how relevant it is, but you might also want to take a look at Xarray (http://xarray.pydata.org) and Pangeo (https://pangeo.io/) that are widely used in cloud environments. There are some important similarities between Xarray and VTK/VTKI – both represent multi-dimensional gridded data; both are used for geoscience but also for other fields, etc. The two packages might be able to learn from each other. For example:
Dataset
vsDataArray
abstraction). Forvtki
, a non-ideal feature to me is that switching between variables in avtk.vtkDataSet
requires a somewhat implicitset_active_scalar()
call. Following Xarray’s data model, adataset['variable_name']
call will extract a single variable while keeping the metadata (e.g. grid coordinates that can be used for plotting). Invtki
,dataset['variable_name']
gives a pure numpy array without metadata. If it can instead track grid coordinates, then plotting a variable will be as simple asdataset['variable_name'].plot()
, like in Xarray.Ah, cool! We may have a number of users that would like that. Thanks for sharing!