How to change working directory?

Hey Guys,

I need to change the Working Directory for my team.
I want to change the Working Directory to a network drive (on a storage server) instead of the local drive.

Is it possible? If yes, then how?

Thanks.

You didn’t make it clear whether this is for jupyterlab or jupyterhub.
On windows I made a short cut
Target
“C:\Program Files\Python38\Scripts\jupyter-lab.exe”
Start in
C:\Users\peter\Documents\ipynb

Before I made the short cut jupyterlab would always start in my c:\windows/ system32 directory because I start it as admin.
Oh jupyterhub each user has his own user area
/home/jupyter-user_name
The /home directory has a directory for each user.

Sorry if I wasn’t clear.
This is for JupyterHub.
The storage is on another server, we don’t want to save anything on the webserver!

Server01 - JupyterHub (Linux Web-server)
Server02 (Windows) - Data Storage (for all the users Working Directories data)

I hope it’s more clear now!

I’m not use to setting up JupyterHub but surely you should be able to use symlinks?
We use them in JupyterLab with the filebrowser.

What spawner are you using? I think it will vary based on that.

It’s surprising that there’s no option to choose a root directory from the menu gui, puts a dampener on the feeling for a first timer of being able install and get going, had me stumped for a bit. Here’s how to set it up:-

For JupyterLab on windows

Run command to generate config file
jupyter lab --generate-config
or
jupyter notebook --generate-config

Find Jupyter Lab config file location:-
C:\Users##accountname##.jupyter\jupyter_notebook_config.py

uncomment/alter following line with the root location you want to save your notebooks:-

The directory to use for notebooks and kernels.

c.NotebookApp.notebook_dir = ‘E:/files/jupyter/’

Restart JupyterLab

I could not find a place to change the /home/username directory but…
We created a share directory by modifying or adding a startup.py directory in
/home/jupyter-peter/.ipython/profile_default/startup
We added this

import sys
sys.path.append("/srv/shared/peter/py")

So now anybody can access my shared/peter/directory.
shared is a link to a
/srv/shared
directory
It appears that valid path can be appended to the sys.path.
Everyone still has their own directory but there can be a common directory that is shared.

BTW, I am using tljh.

A handy thing to do is to type
jupyter --help
jupyter --paths
Now you can see the directories that tljh uses.

Thanks, I will try this one.

To be honest, I was really surprised that Jupyter didn’t give a simple option to sate data on another file server. Unless Jupyter was made for single users only!

Jupiter lab is definitely a single user program. Someone had a good idea to make it web based on a remote server. I can’t get too critical about that.
I call this a win and I am willing to wait for improvements.

Well, that explains a lot why there is no option to save the data on a separate server.
I guess we will have to look for another notebook. This is also very difficult since aren’t many notebooks for Data Scientist :unamused: