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.

headless displays on remote server with port-forwarding

See original GitHub issue

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

github_iconTop GitHub Comments

1reaction
JiaweiZhuangcommented, Apr 19, 2019

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:

  • The Pangeo community are somewhat struggling with the data model for unstructured grids (pangeo-data/pangeo#356). VTK seems to have very powerful unstructured-grid-related APIs (plotting, slicing, subsetting) that we can learn from (I am speaking of the Xarray community here).
  • On the other hand, I think Xarray has the right data model for multi-variable datasets (the Dataset vs DataArray abstraction). For vtki, a non-ideal feature to me is that switching between variables in a vtk.vtkDataSet requires a somewhat implicit set_active_scalar() call. Following Xarray’s data model, a dataset['variable_name'] call will extract a single variable while keeping the metadata (e.g. grid coordinates that can be used for plotting). In vtki, 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 as dataset['variable_name'].plot(), like in Xarray.
1reaction
banesullivancommented, Apr 18, 2019

Ah, cool! We may have a number of users that would like that. Thanks for sharing!

Read more comments on GitHub >

github_iconTop 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 >

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