change working directory jupyter notebook

How to change Jupyter Notebook working directory ?

This tutorial guides you on how to change Jupyter Notebook working directory. Let’s see two ways using which you can change Jupyter Notebook working directory.

Change Jupyter Notebook working directory – Command line

To change working directory via command prompt, you need to follow the below steps.

1: First, open cmd prompt and run the following jupyter noteboook command.

> jupyter notebook --generate-config

Writing default config to: C:\Users990\.jupyter\

The above command will create a config file called ““.

2: Open the file “” from that location in a file editor.

3: After opening that file in an editor, search for the text “# c.NotebookApp.notebook_dir = ”

4: Then, uncomment that line and update the required path i.e., new working directory and save the modifications.

For example,

c.NotebookApp.notebook_dir = "C:\Users990\Documents\sneppets\Workspaces\Python\Examples"

5: Finally, run the following command in the command prompt.

> python -m notebook

[I 18:47:19.270 NotebookApp] The port 8888 is already in use, trying another port.
[I 18:47:19.271 NotebookApp] The port 8889 is already in use, trying another port.
[W 18:47:19.278 NotebookApp] Terminals not available (error was No module named 'winpty.cywinpty')
[I 18:47:19.279 NotebookApp] Serving notebooks from local directory: C:\Users990\Documents\sneppets\Workspaces\Python\Examples
[I 18:47:19.279 NotebookApp] Jupyter Notebook 6.3.0 is running at:
[I 18:47:19.279 NotebookApp] http://localhost:8890/?token=9cb56d43292734fd1587083d37be16b31e57199cd498eb33
[I 18:47:19.281 NotebookApp]  or
[I 18:47:19.281 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 18:47:19.328 NotebookApp]

    To access the notebook, open this file in a browser:
    Or copy and paste one of these URLs:

You could observe log messages like notebooks are being served from local directory : C:\Users\91990\Documents\sneppets\Workspaces\Python\Examples. Yay! the working directory is changed.

Change Working Directory Notebook – Command line Option 2

There is another approach using which you can change Notebook’s working directory from command line itself using the following syntax.

jupyter notebook --notebook-dir = <working_directory>

For example, run the following command.

> jupyter notebook --notebook-dir=C:\Users990\Documents\sneppets\Workspaces\Python\Examples

change working directory jupyter notebook

Now the working directory is changed to local directory: C:\Users\91990\Documents\sneppets\Workspaces\Python\Examples.

That’s it. You had learnt how to change Jupyter working directory from the command line in two ways.

Hope it helped 🙂

You’ll also like:


Notify of

Inline Feedbacks
View all comments