ob-ipython icon indicating copy to clipboard operation
ob-ipython copied to clipboard

Support using remote kernels

Open nbren12 opened this issue 10 years ago • 7 comments

I usually have ipython notebook running on a remote server, which I then connect to over ssh using port forwarding. These are the commands I usually run.

ssh -L 8888:127.0.0.1:8888 myserver
ipython notebook --port 8888 --no-browser

Then, I open 127.0.0.1:8888 in the browser on my local machine. Is there an easy way to do this sort of workflow in ob-ipython?

nbren12 avatar Jun 15 '15 15:06 nbren12

This should be very easy to support. Currently emacs starts the ipython kernel for you and a process which assumes that it is local. When I get time I'll take a look at opening up customisation here to allow running remotely.

gregsexton avatar Jun 24 '15 19:06 gregsexton

I think this use case could be simply achieved by setting

(setq ob-ipython-driver-port 8888)

after creating the tunnel. If you want this to be the case only for a given buffer, use setq-local instead.

If you don't want to use the intermediary tunnel, you'd have appply the changes proposed in my PR #29.

However, I think a more flexible approach would be to implement something like an :address header argument or :hostname and :port arguments and these settings would only serve as default settings. This should be reflected by e.g. renaming the to *-default*-.

On a different note, I think a different Customize group (Org Babel IPython) might be more appropriate to make ti easier for the user to find these setting in the group that would logically fit into the hierarchy.

smartass101 avatar Sep 21 '15 19:09 smartass101

I've merged the PR allowing for connecting to a different hostname across all src blocks. Leaving this open to implement the :hostname and :port arguments as suggested. Great idea.

gregsexton avatar Sep 23 '15 16:09 gregsexton

I have a working prototype of a solution in PR #39, but please note that at the moment it requires fix for bug in jupyter_client, see the PR for details. It works quite well.

smartass101 avatar Dec 06 '15 20:12 smartass101

@smartass101 @gregsexton Greg, thank you very much for your work on this module and Ondrej, thank you for your work to try and get remote execution working.

I have a question: Is it possible to connect to a remote ipython using ob-ipython-driver-hostname and ob-ipython-driver-port with the current master branch?

If so, what is the procedure to establish a connection? I've tried the SSH tunnel, together with manually launching jupyter console or driver.py on the remote host, but this didn't work and doesn't seem right - when I execute an ipython block, my local emacs still tries to launch it's own driver.py, since the emacs buffers that run the driver processes aren't running on my machine.

What's the intended purpose of ob-ipython-driver-hostname right now? How do you use it?

EmperorDali avatar Nov 01 '16 18:11 EmperorDali

Ah, does ob-ipython support this now?

dabro avatar Mar 13 '17 04:03 dabro

I'm interested in ob-ipython using a remote kernel too.

I'm starting ssh tunnel on local machine, setting ob-ipython-driver-port and verified ob-ipython-driver-hostname. This approach fails when ob-ipython tries to start the local jupyter/ipykernel because the port is already in use.

I'm surely missing something obvious...ideas appreciated!

singletS avatar Apr 04 '17 16:04 singletS