6

is there a way I can link in jupyter notebooks (ipython) into the org-mode notebook? The same way other files (images) can be brought in? If it is possible will the outputs are also seen in the note (and inputs are runnable?), or only code itself? A dummy's guide would be a lot more appreciated as I'm new to emacs and configuring things are not straightforward.

I spend most of my time in Jupyter notebooks and try to document the various steps as a tutorial for colleagues who may want to reproduce my methods (sometimes code snippets are included) as well as discussing the findings in org-mode notebook. It's purely because org-mode notebook has much nicer interface with automatic sections/subsections and easily accessible for anyone (e.g. HTML). If someone wanted to check sensitivity of some other parameters, it would've been much nicer to have the ability to change the code within org-mode (without the need to switch to Jupyter) and output figures are automatically generated (same as Jupyter) or any other outputs. A lot of the times, I have to export various charts from Jupyter to be able to bring into org-mode. I was hoping whether I can switch to org-mode entirely and do all the coding in there. So there is an element of collaboration with colleagues who don't code and efficiency for myself so I can focus most of my time on emacs.

An example jupyter notebook with lots of outputs and graphs is given here, you would need to install seaborn as it doesn't come as a standard package if Anaconda is used.

  • I am not sure what it is you are trying to do? Ipython saves its notebooks as ipynb, this is just a json so it should be straight forward to write a parser to convert it into an org txt file. I'm not sure if they exist already. On the other hand, if you would like to stay in emacs and in org mode then there is the emacs package og-ipython. This enables you to use the src blocks in org mode to interact with an ipython kernel, run code, output plots all within emacs. This is what I use mostly because I refuse to leave emacs! Hope this helps. github.com/gregsexton/ob-ipython – Seeralan S Jan 11 at 12:07
  • 1
    John Kitchen has written ox-ipynb which appears to do something like that. I have not used it, but it might be worth trying. kitchingroup.cheme.cmu.edu/blog/2017/01/21/… And because you're new, it's worth mentioning the tutorial, C-h t and, if you're inclined, the Introduction to Emacs Lisp is an excellent read: gnu.org/software/emacs/manual/eintr.html – Lorem Ipsum Jan 11 at 13:09
  • I’m happy to write a tutorial to do this in order to help others do Reproducible Research! Would you update your question with some simple use case examples and a workflow. For example, do you want to pull ipynp files into org-mode? Generate ipynp files from org-mode? Both? Neither? How you update your question should include the answer to why you want to do this. For example, collaboration with others that don’t use emacs + org-mode. Best wishes! – Melioratus Jan 11 at 18:43
  • Thanks for all your comments. @Melioratus - updated use keys as requested. – Curtis Jan 13 at 14:41
  • Thank you! Your updates are very helpful! Writing this tutorial will be a fun learning experience for me! Do you have a Jupyter notebook with some graphs which I can use use for a reference for creating an org-mode file with similar functionality. A link to an example Jupyter notebook would be helpful to limit the scope of the tutorial. – Melioratus Jan 13 at 17:08
1

Check out ob-ipython: An Emacs library that allows Org mode to evaluate code blocks using a Jupyter kernel (Python by default), it might be what you are looking for. Run code on remote ipython kernels with Emacs and orgmode provides a basic example using exactly that library, and there are more related articles on that site as well.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.