Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create and open a jupyter notebook ipynb file directly from terminal

The command jupyter notebook will open the Jupyter directory tree page where you can create a ipynb file.

Is there a way to skip that page and create and open the ipynb file directly on the browser?

I was thinking something like jupyter notebook mynotebook.ipynb

like image 915
multigoodverse Avatar asked Feb 23 '18 11:02

multigoodverse


People also ask

How do I open Jupyter Notebook directly from terminal?

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 Ipynb file in Jupyter Notebook terminal?

You can open existing Jupyter Notebook files (. ipynb) in the Jupyter Notebook dashboard by clicking on the name of the file in the dashboard (e.g. filename. ipynb ).

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 I open Ipynb files directly?

You can open an IPYNB file in Jupyter Notebook (cross-platform), Jupyter Notebook Viewer (Web), Cantor (Linux), or Google Colaboratory (Web). To open an IPYNB file in Jupyter Notebook Viewer, the file must be hosted online (via GitHub or another file hosting service).


1 Answers

Open notebook in browser

jupyter notebook <notebook>.ipynb 

Create empty, minimal notebook:

"""create-notebook.py    Creates a minimal jupyter notebook (.ipynb)    Usage: create-notebook <notebook> """ import sys from notebook import transutils as _ from notebook.services.contents.filemanager import FileContentsManager as FCM  try:     notebook_fname = sys.argv[1].strip('.ipynb') except IndexError:     print("Usage: create-notebook <notebook>")     exit()  notebook_fname += '.ipynb'  # ensure .ipynb suffix is added FCM().new(path=notebook_fname) 

Alias create-notebook script:

alias create-notebook='python $(pwd)/create-notebook.py' 

Putting it all together

create-notebook my_notebook && jupyter notebook my_notebook.ipynb

like image 194
stacksonstacks Avatar answered Sep 20 '22 09:09

stacksonstacks