1

In Windows 10 cmd.exe I can start jupyter in a current directory by following command:

jupyter notebook --notebook-dir="."

The current directory is C:\Users\Евгений\Documents\GitHub\sandbox

However, when I start simply jupyter notebook in a current directory above my working directory for jupyter is D:/git:

λ cd
C:\Users\Евгений\Documents\GitHub\sandbox
λ jupyter notebook
[I 14:46:44.273 NotebookApp] The port 8888 is already in use, trying another port.
[I 14:46:44.304 NotebookApp] JupyterLab beta preview extension loaded from D:\Anaconda3\lib\site-packages\jupyterlab
[I 14:46:44.304 NotebookApp] JupyterLab application directory is D:\Anaconda3\share\jupyter\lab
[I 14:46:44.571 NotebookApp] Serving notebooks from local directory: D:/git

Note the last line Serving notebooks from local directory: D:/git. Where is D:/git may be coming from? Are there environment variables other than these affecting working directory choice?

  • My %USERPROFILE%/.jupyter is totally empty.
  • jupyter --config-dir directs to C:\Users\Евгений\.jupyter, it is %USERPROFILE%/.jupyter.

I read various threads about jupyter invoke, in particular:

My other thought is that %USERPROFILE% with non-Latin character is not be recongnisable by jupyter, but %USERPROFILE%/.jupyter is empty anyways.

Evgeny
  • 4,173
  • 2
  • 19
  • 39

3 Answers3

1

You must generate the configuration of Jupyter.

jupyter notebook --generate-config

Navigate to your folder and the folder .jupyter (C:\Users\%username%\.jupyter)
You will find a file called jupyter_notebook_config.py
Edit it with notepad++ for exemple and locate c.NotebookApp.notebook_dir

Between ' ' put the path you want. For exemple :

c.NotebookApp.notebook_dir = 'C:/Users/Евгений/Documents/GitHub/sandbox'

Save it and start Jupyter without specifying a path
Be careful, the characters in your username may be a problem.

Keep me informed.

Sir Mishaa
  • 541
  • 1
  • 6
  • 19
  • Thanks for the answer, I'm aware of the `notebook --generate-config` option. My specific question is where does jupyter store `D:\git` in absence of configuration file. Another internal config file? – Evgeny Jan 20 '19 at 19:23
  • If we don't generate a configuration, I don't think Jupyter stores another configuration file. I just know that you can switch configuration files with `jupyter -f /path/to/configFile.py`. I advise you to use [**Jupyterlab**](https://jupyterlab.readthedocs.io/en/stable/). For me, the configuration with Jupyterlab works well. – Sir Mishaa Jan 20 '19 at 19:29
1

Use the jupyter notebook config file:

Open cmd (or Anaconda Prompt) and run jupyter notebook --generate-config.

This writes a file to C:\Users\username\.jupyter\jupyter_notebook_config.py.

Browse to the file location and open it in an Editor

Search for the following line in the file: #c.NotebookApp.notebook_dir = ''

Replace by c.NotebookApp.notebook_dir = 'D:/git'

Make sure you use forward slashes in your path

Remove the # at the beginning of the line to allow the line to execute

Bane
  • 484
  • 3
  • 13
0

Using docker and the images maintained by the Jupyter team:

docker run -v `pwd`:/home/jovyan -p 8890:8888 jupyter/scipy-notebook
Joshua Cook
  • 12,495
  • 2
  • 35
  • 31