How to change the windows drive for JupyterLab in Anaconda Navigator?

Viewed 887

Under Windows, JupyterLab does not allow navigation in the UI to any drive other than the drive that JupyterLab was started in. By default this is the C: drive.

How can you access notebooks on another drive?

2 Answers

Anaconda does not allow switching between drives but you can start Jupyter Lab or a Jupyter notebook on another drive, for example the D: drive.

  • First shutdown any running JupyterLab, then

  • Open a terminal window from within Anaconda Navigator. To do this, select environments in the Navigator window and then click the green "play" arrow next to base(root) -- or which ever environment you are using.

  • then in the terminal window type

jupyter notebook --generate-config

  • this will generate a file in your user directory under .jupyter\jupyter_notebook_config.py

  • edit the file.

  • Set the variable c.NotebookApp.notebook_dir to whatever directory you want to start in, for example

c.NotebookApp.notebook_dir = "D:\mydir"

  • NOTE do not put a trailing backslash. Also if the directory pathname contains spaces ensure you are using double quotes.

  • save the file and test that all is working. In the command line type

jupyter lab

  • this should start JupyterLab correctly, check for any errors in the terminal window. JupyterLab should start in the directory you set in the file.

  • If all is well, shutdown JupyterLab and run it from the Anaconda Navigator window as usual. All should work now.

As mentioned by GreyMS in this github issue, you can use an mklink:

mklink /D D_Drive D:\sources
Related