-
-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scimax-org-babel-ipython.el and remote kernels #114
Comments
I am not sure. if the base ob-ipython does than i would expect scimax too. |
Have spent some time trying to get this to work in both scimax and upstream ob-ipython and have been unsuccessful with both. Instead, use scimax with the additional command line parameters |
How do you deal with things like plots or sounds when you start emacs/scimax with |
As you point out, when I run things on the remote machine and the charts are created but can't be displayed. To somewhat get around this,
Obviously, this is not going to work for fine-tuning a figure but it is mostly workable for using scimax remotely. I usually save the long-running results to a file and load them on the local machine if I really need to fine tune stuff. |
I will piggyback on this and ask my question. I have an Ubuntu VM that I can access via ssh on a remote machine. I have some heavy analysis coming up that involves python, R etc. and I would like to run that on the machine from my local emacs/scimax. How do I do it/where do I start? Could someone give me a short step by step on how to do that from org-mode or using emacs in general? |
I have no idea how to run on remote kernels or if it is possible. It isn't a use case for me, and I have no way to test it for now, so I probably won't be much help in figuring it out. It sounds like you should just use Jupyter notebooks for that. |
Thank you @zngguvnf for the link. I wonder how it works for R processes |
I tried the approach outlined in the @zngguvnf link awhile back and just tried it again and it still isn't working. I setup a remote kernel with the ssh link (or it can even be an existing local kernel) and this code block in scimax:
gives this error message:
Haven't gotten around to trying it again in vanilla ob-ipython/emacs setup. |
That means you should take the dashes out of the session name. I recall those were problematic in the past, so now it raises an error. |
Thanks. That occurred to me also. On that, two things:
I get error messages and a new kernel is created in |
I am able to connect to a remote kernel (with dashes in the name as demonstrated above) using vanilla emacs and upstream ob-ipython. Going to do a diff on scimax ob-ipython and upstream to see if there is an easy fix. |
It looks like the dash error raising got introduced in e84a7d4 for getting completion to work from the kernel. It is related to issue #89 where it was reported that session names with dashes were causing a hang. An easy fix is just comment out the user error code and see if it works. It sounds like I should also update my local setup to upstream and work out any differences. My development time on this has been pretty limited lately. |
My intuition is that this will continue to create a new kernel, but I can try it out this weekend and report back. I noticed the upstream python driver/client.py and ob-ipython.el files were doing checks in multiple places to not create a new kernel if the session name included |
I can confirm that scimax is simply wrapping session name (even if session name is an existing kernel) with Steps I used for testing:
#+NAME: friend-football-diet-mississippi
#+BEGIN_SRC ipython :session kernel-8523.json
x = 1
print(x)
#+END_SRC
|
I made a little progress on this issue and was able to connect to a remote kernel. The https://github.com/gregsexton/ob-ipython He has updated it to aim for conforming with jupyter, which is a huge deal in the emacs/org/jupyter "replace notebooks" movement. He has removed Specifically for scimax, to get something working, I did the following:
Then I went looking for references to
(I am only showing the Then to address the wrapping of
Perhaps only commenting out the scimax version of Once I did the above, I ran the following explicitly with
Those are the correct values I created in my terminal jupyter console when I connected to the remote kernel:
Notice that Now, running
I am not submitting a PR because I am not sure what sort of ripple effect any of these (breaking?) changes would have but it sure seems like things are close if the latest |
Yes, the above works as advertised...and also introduces breaking changes that I think might be due to the loss of Specifically, I think the following function (that is added as a hook) will need some surgery to deal with the new
|
This is great news. I will start looking into updating scimax to work with the new ob-ipython. It would be great to by in sync with that. Thanks for working on this! |
Was just replying to a phantom comment that quickly disappeared...I got your same error initially, then quit and restarted Emacs and your example worked. |
ah. I had to update jupyter_client and jupyter_console to get it to work. There were a few Emacs restarts in there too, so who knows what made it finally work. It is a good start anyway. It looks like it could be a big job to clean up scimax to do this! |
See issue #109. I have a branch that runs the upstream ob-ipython repo that may resolve this issue. |
Tested against the new branch (mentioned in #109) and can confirm that remote execution is working with some basic examples using the instruction here: I will use this over the next week or so and report back. |
Thanks! I was able to test it out locally today, and I updated the notes on how to do it. |
Agreed--this works great now with your new branch. @jkitchin already put the following in his doc but just to reiterate to those coming here, that the "-ssh" has been added to the session file you need to connect to. In @roblem comment above, that example:
will result in a local file named
Also, setting a file property works so you do not have to specify
Great stuff! |
Thanks for the note! I added the file property note just now. |
Noticing that using jupyter console with, for example,
These aren't scimax/emacs/ob-ipython problems per se, but they impact the workflow alot. So, from the suggested link from upstream ob-ipython (https://github.com/ipython/ipython/wiki/Cookbook:-Connecting-to-a-remote-kernel-via-ssh in the manual ssh tunnels section), remote access can also be done this way:
I have found this to be bullet proof over a few hours of normal work. It is great to have this working in Scimax! |
Nice tip @roblem , I did not know about Another note regarding properties and kernels...as noted at the bottom of the doc: https://github.com/jkitchin/scimax/blob/ob-ipython-upstream/scimax-ipython.org you can set a global, buffer-wide ipython session via a property:
To get really fancy, you can have each heading of your org document be connected to separate kernels. It would be like having multiple Jupyter notebooks in a single .org file. Use the heading level property and follow all the same ways of connecting to a remote kernel:
|
The issues I was having in #114 (comment) was due to mixing and matching python 3.5 and 3.6 virtual environments on client and host (not a scimax or ob-ipython problem). Once I switched everything over to python 3.6, the As for Also, thanks for the header tip @timehaven. |
commit f2726b6 should address this. |
Does scimax-org-babel-ipython.el support remote kernels?
The text was updated successfully, but these errors were encountered: