2

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:)

  • Does this answer your question? [How to change the Jupyter start-up folder](https://stackoverflow.com/questions/35254852/how-to-change-the-jupyter-start-up-folder) – krassowski Oct 23 '21 at 16:41
  • In particular you seem to be using the `notebook` instructions whereas you should probably use `server` as described in the second section (I now improved formatting in that answer to make it more obvious). – krassowski Oct 23 '21 at 16:43
  • Unrelated: have you tried to just change the current directory in the command line before starting JupyterLab via cmd? – krassowski Oct 23 '21 at 16:44
  • Please provide enough code so others can better understand or reproduce the problem. – Community Oct 23 '21 at 17:47
  • @krassowski Sorry I was using my phone to write the question, here is the clear details. I used `Jupyter lab --generate-config` to get the settings file. And this is how it looks now `c.ServerApp.root_dir = "C:/Users/name/Documents/Python" ` But no changes whatsoever. – Anoban Karunananthan Oct 24 '21 at 01:07
  • @krassowski Nope I didn't try to change the cwd in the cmd before opening Jupyter lab. And I did just now and **It worked** It's embarrassing but yeah that's very stupid of me. it's an obvious fix I didn't think of. I first changed the cwd by `C:\Windows\system32>cd C:\Users\name\Documents\Python` and then opened Jupyterlab in `C:\Users\name\Documents\Python>Jupyter lab` Thanks a lot. **That fixed it.** But still don't know why there isn't a way inside Jupyter to change the working directory. – Anoban Karunananthan Oct 24 '21 at 01:17

1 Answers1

1

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.

Gray
  • 1,164
  • 1
  • 9
  • 23