Embedded server in Jupyter notebook with port forwarding

I’m trying to embed my bokeh app in a Jupyter notebook. The following example works fine when Jupyter is running on my local machine (Mac laptop) …

But I typically run Jupyter on another machine (linux desktop) and connect via port forwarding …
ssh -NL 8889:localhost:8889 [email protected]

When I try to run the notebook_embed.ipynb example on my desktop via my laptop, the output doesn’t render. I tried changing the notebook_url argument to the local address and get the following

It’s not clear to me that it will be possible to open a websocket through an SSH tunnel, in general. But I don’t use SSH tunnels regularly, so perhaps they are more capable than I am aware of. Nevertheless, a first action to try is the one given in the error message: setting the environment variable as described, on whatever machine is actually running the notebook kernel.

1 Like