1

I've been trying to figure out how I can open a .ipynb file on double-click on a Mac, so the file opens with Anaconda and then automatically opens Jupyter Notebook with the file contents.

I have tried creating an application through Automator that opens with a jupyter_lab command, but the issue is that Jupyter lives in Anaconda, so this method is not working. See these articles for my steps: https://samedwardes.com/2020-01-31-open-ipynb-with-double-click/ and Open an ipython notebook via double-click on osx

I have also tried installing nbopen with the following:

python3 -m pip install nbopen

This works, and then I can run nbopen file.ipynb through the terminal, but I want to be able to bypass this step and do it while in file explorer, physically looking at the file instead.

I have ran the recommended command for osx to integrate it with file manager ./osx-install.sh but I just get zsh no such file or directory and can't really find any help with figuring out why this is pushing back an error.

Any suggestions?

Madison Leopold
  • 377
  • 4
  • 18

1 Answers1

2

I have this "convenience issue" as well, and didn't go for the nbopen route, but instead, I just made a batch script (I named it jupyter-notebook.bat) that calls certain conda functions, and pretty much initiates things like how double clicking works. In the script, I just have this:

call "C:\Users\XYZ\Anaconda3\Scripts\activate.bat"
call conda activate myEnvironment
call python C:\Users\XYZ\Anaconda3\Scripts\jupyter-notebook-script.py %1

Lastly you just need to configure that every .ipynb opens up using your jupyter-notebook.bat script.

For consistency, I placed the script in my Anaconda folder. And if you also have nb_conda_kernels installed in your base environment, you'd have access to the other environment you've created as well from there.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Adji_PA
  • 74
  • 8
  • "Lastly you just need to configure that every .ipynb opens up using your jupyter-notebook.bat script." how would you do that ? – gohu Aug 23 '22 at 15:46
  • 1
    If it's on Windows, I meant by opening the file's properties and changing "Open File WIth" and enter the batch command's path. – Adji_PA Aug 24 '22 at 09:55