user17061353
user17061353

Reputation:

How to change Jupyter lab Working Directory?

I'm using the latest version of Jupyter lab on a Windows 10 64 bit machine inside Firefox. When I start the Jupyter lab (via cmd) the default working directory appears to be

c:/windows/system32

(i.e the folder tab on the left) which is a terrible place to be meddling with, at leat for me. I don't know why Jupyter lab starts there. I've installed Jupyter lab using cmd with administrator privileges. Is that why? Should I have it installed just for a user? (My machine has only one user;me). I tried changing the directory by using

jupyter notebook --generate-config

And inserted a path to my documents folder (in the path for kernels and notebooks line) , edited out the commentary ("#"). And when I restarted Jupyter lab nothing has changed. It shows the

c:/Windows/system32

as default directory which has so many windows folders and is too messy to deal with. Any solutions will be greatly appreciated. Thanks in advance:)

Upvotes: 4

Views: 10248

Answers (1)

Gray
Gray

Reputation: 1388

A late answer to one of the most common Jupyter Notebook or Jupyter Lab questions most new users have about the file/folder structure when they first begin using Jupyter.

For those Windows users who may still be using that old school Windows Command Prompt - which is actually being phased out of Windows, the Windows Command Prompt will normally start-up and display the location where the Windows Command Prompt application is located on the Windows PC:

c:/Windows/system32

In a nutshell, the OP opened the Windows Command prompt, and then the OP typed the following code to start Jupyter Notebook:

Jupyter notebook

But when the OP created / saved the new Notebook file, it was saved to the Windows / system 32 folder - definitely not a location where anyone wants to save their files.

To avoid saving Jupyter Notebook files in the wrong place, the Command Prompt must be started in a different folder or be moved to another directory. One way to move the Command Prompt is by using an old dos command, Change Directory. Just type cd for Change Directory.

Best advice, create a new folder on the C drive and call it Jupyter_Files. Then use old dos, Change Director command, navigate from the location where the command prompt opens and move to that new folder. Do the following to navigate to the new folder.

cd..
cd..
cd Jupyter_Files

Now the Command Prompt is in the location where the Notebook files want to be saved. At the Command Prompt, type: Jupyter notebook. This will create and save those notebook files in this new folder.

Upvotes: 3

Related Questions