jupyter notebook starting directory

10,046

Solution 1

The followings steps work perfectly for me on Windows:

First find which directory Jupyter is looking in for your config file:

jupyter --config-dir

If there is no jupyter_notebook_config.py file in that directory, generate one by typing:

jupyter notebook --generate-config

Then edit the jupyter_notebook_config.py file and add something like:

## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = 'c:\\users\\rsignell\\documents\\github'

Then start your jupyter notebook from any directory:

jupyter notebook

and it will start in the directory you specified.

For more info see: http://jupyter-notebook.readthedocs.io/en/latest/config.html

Solution 2

Microsoft Windows

Open dos command line by typing cmd on windows explorer address bar. This will open command prompt with current path set to current folder. Type jupyter notebook --notebook-dir=%CD% on commandline to start jupyter notebook (ipython notebook) with current directory as notebook's starting directory

Solution 3

I also had the problem, and editing jupyter configuration file didn't work either.

My workaround is to make a batch file that goes to a specified directory, then start jupyter notebook from that directory.

You can use notepad to write the batch file, just save it as an all files and specify the extension as .bat

An easy way is also available from DOS prompt using copy con. First, access command prompt (usually by typing "cmd" and enter). Then:

copy con startjupyter.bat

after that you can specify your directory and start notebook from there, for example if your directory is D:\python_codes :

d:
cd python_codes
jupyter notebook

After that, save the file using CTRL+Z and Enter.

You can run the batch file by calling the name (startjupyter), or click it. For the latter, maybe put it in your desktop for easy access.

Share:
10,046
Admin
Author by

Admin

Updated on August 04, 2022

Comments

  • Admin
    Admin over 1 year

    I'm trying to set a custom starting directory in Jupyter Notebook. I have edited jupyter_notebook_config.py.

    Removed # from line "c.NotebookApp.notebook_dir =", added parameter:

    c.NotebookApp.notebook_dir = u'c:\\my\\chosen\\directory'.
    

    But still doesn't work, console coming up with error, and jupyter starting in the default home directory.

    I'm using Windows server 2008. According to the manuals, it should work.

    Does anyone have a suggestion about my problem?