Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I open a Notebook with Ipython Notebook/ Jupyter without starting a kernel?

Let us assume, I want to open a notebook (i.e. with my local Jupyter instance) but I do not want to start the associated kernel (i.e. Python) with it. How can I do this?

Possible use cases:

  • I just want to the the notebook output from former calculations. I do not want to do further computations.
  • I want to quickly glance at it, without waiting for the kernel to start up.

To my understanding, all LaTeX rendering, JavaScript and CSS should work independent of the kernel. It should then just show me, that the kernel is not connected. I may then decide to start the kernel via the menu.

I did not find this documented anywhere.

I do not want to use nbviewer, since I want it to be integrated as much as possible in my normal Jupyter workflow.

like image 262
Lukas Avatar asked Oct 13 '15 23:10

Lukas


People also ask

How do I launch a jupyter notebook from IPython?

To launch Jupyter Notebook App: Click on spotlight, type terminal to open a terminal window. Enter the startup folder by typing cd /some_folder_name . Type jupyter notebook to launch the Jupyter Notebook App The notebook interface will appear in a new browser window or tab.

How do I open a jupyter notebook directly?

Windows File Explorer + Command Prompt Once you've entered your specific folder with Windows Explorer, you can simply press ALT + D, type in cmd and press Enter. You can then type jupyter notebook to launch Jupyter Notebook within that specific folder.

How do you start jupyter notebook server without opening a Web browser?

Step 1: Run Jupyter Notebook from remote machine In most cases, this is simply done via an ssh command. Once the console shows, type the following: remoteuser@remotehost: jupyter notebook --no-browser --port=XXXX # Note: Change XXXX to the port of your choice. Usually, the default is 8888.


1 Answers

I don't use Jupyter, only the last version of IPython before the big split, but when I try to open a notebook with a bogus kernel associated with it, IPython offers me to open it "without Kernel". So, the functionality exists, but it's not directly accessible AFAIK.

So I guess you just have to edit the .ipynb file manually (or write a script to do this) and change the global metadata field to something like this to achieve your goal:

"metadata": {
  "kernelspec": {
   "display_name": "bogus",
   "language": "bogus",
   "name": "bogus"
  },
  "language_info": {
   "codemirror_mode": "<don't change this>",
   "mimetype": "text/plain",
   "name": "bogus"
  }
}

It's only a partial workaround, but it seems to work in all cases. You still need to have the right codemirror configuration in your system.

An alternative would be to write a small kernel that does nothing (like the "Echo Kernel"), but that would be less effective, as you would still need a way of specify different modes of syntax highlighting (except if you only intend to write IPython notebooks).

like image 132
Taar Avatar answered Oct 16 '22 21:10

Taar