Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Associate ipynb files with Jupyter notebook in Windows 10 (Anaconda)

I installed Anaconda on my Windows 10 machine.

I have a few Jupyter notebooks on my pc and I would like to associate them with Jupyter, so they can be opened by double-clicking on the file, to avoid having to open Jupyter and navigate to the notebooks folders each time. Is this possible?

All notebooks should open in the same Jupiter Kernel (same localhost in the browser address bar), without starting a new kernel for every file I click.

PS I asked here because I figured this question to be more of interest for programmers, but if you think it would be more suited for SuperUser, I'll flag it for migration.

like image 732
DeltaIV Avatar asked Nov 13 '17 15:11

DeltaIV


People also ask

How do I open Ipynb files in Jupyter Anaconda?

Open Jupyter Notebook Files ipynb) in the Jupyter Notebook dashboard by clicking on the name of the file in the dashboard (e.g. filename. ipynb ). Note: if you don't see the Jupyter Notebook file (. ipynb) or directory that you are looking for, you may need to navigate to another directory in the dashboard (see above).

How do I open Ipynb files in Windows 10?

If you cannot open your IPYNB file correctly, try to right-click or long-press the file. Then click "Open with" and choose an application. You can also display a IPYNB file directly in the browser: Just drag the file onto this browser window and drop it.


2 Answers

Install nbopen: https://github.com/takluyver/nbopen

pip install nbopen python -m nbopen.install_win 

Now you can double-click on *.ipynb files:

Example.ipynb icon in Windows 7

like image 198
endolith Avatar answered Sep 19 '22 05:09

endolith


If you have Jupyter installed with Anaconda you can do the following.

Create a little batch file (e.g. start_jupyter_notebook.bat) with the content (the commands are from the Jupyter shortcut):

@echo off set ANACONDAPATH=C:\_work\_programs\Anaconda3 %ANACONDAPATH%\python.exe %ANACONDAPATH%\cwp.py %ANACONDAPATH%^  %ANACONDAPATH%\python.exe %ANACONDAPATH%\Scripts\jupyter-notebook-script.py %1 

(of course you will have to change the ANACONDAPATH to your installation)

Then go to one .ipynb file of your choice, right-click on it, go to properties --> open with --> change and select your created batch file.

I am pretty sure this can also be setup for any other Python/Jupyter installation.

P.S. The cwp.py file sets up some environment variables. I guess this is the reason why fredm73's answer did not work for everybody. Apart from that my answer is quite similar in the end.

like image 22
schendi Avatar answered Sep 19 '22 05:09

schendi