joouha / euporie

Jupyter notebooks in the terminal
https://euporie.readthedocs.io
MIT License
1.54k stars 36 forks source link

How to connect to hub #62

Closed puppyapple closed 5 months ago

puppyapple commented 1 year ago

After launching a hub in a remote machine, how to connect to the hub locally? I have tried write a config file with ip and port settings, by [euporie-notebook -f=myconfig.json], nothing happens.

joouha commented 1 year ago

Hi,

Euporie hub runs as an SSH server, so you should be able to connect to the remote machine on the configured port using any SSH client.

puppyapple commented 1 year ago

@joouha thanks for the reply! So you mean run hub as a server and use ssh to connect to it. I tried [ssh -p xxxx user@myhost] and in the remote server console I received error like ['Vt100Parser' object has no attribute 'queries']. I think the connection works but some other issues comed out?

image
puppyapple commented 1 year ago

And in fact, what I'm really looking for, is that I could launch euporie-notebook with a .ipynb file locally and select a kernel from a remote server(usually has more powerful cpu and gpu capabilities)

joouha commented 1 year ago

Ah - that AtrributeError looks like a bug. I'll take a look at it when I next can.

It should be possible to connect to a remote kernel over SSH using euporie, but it'd be a bit involved. You'd need to run your kernel on the remote server, forward the ports that the kernel is listening on to the local machine, then provide a connection file to euporie (using the --kernel-connection-file command line option). This article gives a good idea of what would be involved. I haven't tried this though, so there are no guarentees!

However, since euporie is designed to run in the terminal, it would be far simpler to connect to the server using SSH and run euporie there (this is one of euporie's intended use-cases 🙂).

puppyapple commented 1 year ago

@joouha Thank you for the tip! I will give it a try~🙂

puppyapple commented 1 year ago

Ah - that AtrributeError looks like a bug. I'll take a look at it when I next can.

It should be possible to connect to a remote kernel over SSH using euporie, but it'd be a bit involved. You'd need to run your kernel on the remote server, forward the ports that the kernel is listening on to the local machine, then provide a connection file to euporie (using the --kernel-connection-file command line option). This article gives a good idea of what would be involved. I haven't tried this though, so there are no guarentees!

However, since euporie is designed to run in the terminal, it would be far simpler to connect to the server using SSH and run euporie there (this is one of euporie's intended use-cases 🙂).

Hi, @joouha , when I SSH to a remote server and use euporie to open jupyternotebook, the image will not show(only a "Image" text in center). But locally it works well. So is there any configuration that I missed?

joouha commented 1 year ago

Hi,

What terminal are you using?

It sounds like euporie might be missing a dependency required to show images on your SSH server. If you are able to share the output of pip freeze from euporie's environment on the SSH server, that would be really useful to help me understand what's happened here.

Then make sure you have the Pillow and timg Python packages installed in the same environment as euporie. I'd also try installing chafa.py and seeing if that helps.

puppyapple commented 1 year ago

Sorry for the late reply. I install euporie in the base conda env(on a remote server) in which I've ensured that Pillow, timg and chafa.py are installed. Here is my pip freeze result. freeze.txt

puppyapple commented 1 year ago

and btw, how could I have [In] and [Out] style view(input cell output cell seperately) like what's shown in you video. I failed to find the correct config. Thanks!

joouha commented 1 year ago

I install euporie in the base conda env(on a remote server) in which I've ensured that Pillow, timg and chafa.py are installed.

Were images working over SSH after this? With the packages installed in your pip-freeze output I'd expect images to be displaying.

how could I have [In] and [Out] style view(input cell output cell seperately) like what's shown in you video

Do you mean the video here? If so, this is euporie-console, which is a REPL console that connects to Jupyter kernels. You can run euporie-console to run it.

puppyapple commented 1 year ago

Were images working over SSH after this? With the packages installed in your pip-freeze output I'd expect images to be displaying.

Unfortunately no, there is still "Image" text in center(I even tried with a new conda environment with all package reinstalled from start, still not working)

Do you mean the video here? If so, this is euporie-console, which is a REPL console that connects to Jupyter kernels. You can run euporie-console to run it.

Oh I see. So I could only get this style of output view in console? Because in notebook, I found it is not possible to select the output text, which is not very convinient.

puppyapple commented 1 year ago

What terminal are you using

Kitty terminal(the icat command works normaly over SSH)

joouha commented 5 months ago

This is now possible in the latest dev branch by using the --force-graphics option, implemented in 49a2c4e508f0dd7f1526f8c1d3c5f0e73c1b7b98