1

I tried changing the start in field of the shortcut, and I created the the config.py file and wrote c.NotebookApp.notebook_dir = u'D:\Jupyter' and made sure it's uncommented.

Note that when I open Jupyter Notebook from the Anaconda prompt it does open in the desired folder. I'm trying to make it work with the shortcut.

A print screen

This picture shows the properties of the shortcut and the relevant part of the config.py, as well as showing the Jupyter Notebook virtual server is attached.

I consulted the following link before posting my question (not hyperlinked due to lack of reputation): https://www.reddit.com/r/IPython/comments/44luwc/how_to_change_jupyter_start_folder/

http://jupyter-notebook.readthedocs.io/en/latest/config.html

Changing Jupyter Notebook start up folder by modifying "start in" not working any more

Jupyter Notebook Set Default Folder to Root

jupyter notebook starting directory

darthbith
  • 13,602
  • 7
  • 55
  • 70
Liron
  • 11
  • 2

3 Answers3

1

Try to remove the u before your path.

I've run Anaconda and Jupyter on several Windows environments, and my path has always worked, but I've never used the Unicode modifier. I don't believe it's needed. So try:

c.NotebookApp.notebook_dir = 'D:\\Jupyter'

The double \ is needed to escape the character

Petter Friberg
  • 19,652
  • 9
  • 51
  • 94
TheDetective
  • 573
  • 1
  • 5
  • 15
1

Step 1: Browse to the Jupyter Notebook file location and open the configuration file in Notepad:

C:\Users\username\.jupyter\jupyter_notebook_config.py

Step 2: Search for the following line in the file:

#c.NotebookApp.notebook_dir = ''

And replace it with:

c.NotebookApp.notebook_dir = 'C:/the/path of/folder/where you/want to set/'

Step 3: Finally, go to where your shortcut to the Jupyter Notebook is located; e.g.:

C:\Users\User_name\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64-bit)

And do the following:

  • Go to the Properties of Jupyter Notebook link.
  • In the Target field, remove %USERPROFILE%, as @stenlytw suggested above.
  • Then, in the Start in field, type the same directory you set above:
C:\path of folder\where you\want to set\in jupyter_notebook_config.py

Just remember! In the notebook_config.py file, the path is enclosed within apostrophes ('…'), and uses a forward slash (/) as the directory delimiter—but in properties, you don't use the apostrophes, and instead use a backslash (\).

Jeremy Caney
  • 4,585
  • 13
  • 32
  • 54
0

Here's an altenative which I have not seen anyone mentioned anywhere:

Keep the default directories all the same and simply create a bookmark in your browser.

For example, my python code is at C:\Users[name]\Documents\Code\Python, so I have a bookmark for "http://localhost:8888/tree/Documents/Code/Python" in my toolbar.

As soon as Jupyter opens a tab in your browser, hit the button. It requires one extra click, yes, but saves you from some possibly annoying tinkering, and allows you to create multiple such bookmarks!

Note: If I open Jupyter in a 2nd environment, I would need the same link but with 8889 (instead of 8888)

toe-pose
  • 21
  • 3