Below is how the same issue I faced got resolved. Most of the steps I took to solve the issues are already described in the solutions provided earlier by others.
There are two ways to start Jupyter Notebook application
- From Anaconda Navigator
- Using the shortcut (name: Jupyter Notebook) to Jupyter Notebook application. In Windows OS it is normally available in the folder:
"C:\Users\\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64-bit)"
There are different ways to configure Jupyter Notebook application to save the notebooks in a folder other than the default.
If using Anaconda Navigator to launch notebook
In case of using the Anaconda navigator to launch Jupyter notebook application, the way to configure is to un-comment the "c.NotebookApp.notebook_dir" field in "jupyter_notebook_config.py" and add the path. After updating the field looks like:
c.NotebookApp.notebook_dir = <Enter the absolute path here>
In case of Windows and when Anaconda is installed for a particular user, this file is located in C:\Users\<USERNAME>.jupyter.
If you don;t find ".jupyter" folder then do the below steps to create it
- Run anaconda command prompt
- At the command prompt run "jupyter notebook --generate-config"
If using the shortcut (name: Jupyter Notebook) to Jupyter Notebook application to launch it
If you examine the command in the target box of this shortcut, you will notice that Notebook app is started by executing the file "C:\Users\<USERNAME>\Anaconda3\Scripts\ jupyter-notebook-script.py" which accepts a path parameter.
The basic approach to define the location where the notebook files will be saved is --> to provide the path of the required folder when starting the Jupyter Notebook application. This can be done in two ways:
- Create an environment variable to point to the required folder and use it as parameter
- Define the absolute path in the shortcut itself
Follow the below steps: (Note: Replace the text in angle brackets with the actual text)
- Locate the shortcut "Jupyter Notebook". When Anaconda was installed for a particular user (during installation the choice selected was for the user only) the shortcut (Name: "Jupyter Notebook", Type: Shortcut) resided in "C:\Users\<USERNAME>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64-bit)"
- Right click on the shortcut and select "Properties"
- In the "Target" box locate C:\Users\<USERNAME>\Anaconda3\Scripts\jupyter-notebook-script.py %USERPROFILE%
Replace "%USERPROFILE%" with
a. Either: the environment variable created to point to the folder where you want to store the notebook files. The command will look like: C:\Users\<USERNAME>\Anaconda3\Scripts\jupyter-notebook-script.py %<ENVIRONMENTVARIABLE>%
b. OR: the absolute path to the work folder you want the notebook files to be stored in. The command will look like: C:\Users\<USERNAME>\Anaconda3\Scripts\jupyter-notebook-script.py <F://folder//subfolder>
Replace the text (path) in "Start In" box with:
a. Either: the environment variable created to point to the folder where you want to store the notebook files. The text in "Start In" box will look like: %<ENVIRONMENTVARIABLE>%
b. OR: the absolute path to the work folder you want the notebook files to be stored in. The text in "Start In" box will look like: <F://folder//subfolder>
Note 1: If there are spaces in the path then the whole path should be enclosed in double quotes.
Note 2: The paths in this solution apply to the situation when Anaconda 3 (and Jupyter 3) is installed on Windows for a particular user (not for all users).
I personally preferred to define environment variable rather than hard coding the path in the shortcut.