agf1997
agf1997

Reputation: 2898

Issue modifying Jupyter Home Directory

At one point I set my Jupyter home directory to ~/Dropbox Unfortunately, because of the way Dropbox changed their folder name that location is now a symbolic link on my machine that points to a hidden directory. This causes the following error in Jupyter

Refusing to serve hidden directory '/Users/alex/Dropbox', via 404 Error

That's fine ... I'd like to now change my Jupyter home directory, but the issue I'm having is that I can't figure out where it's currently set.

I've checked my ~/.jupyter/jupyter_notebook_config.py but that seems to be unmodified from the default.

The output of $jupyter --paths is :

config:
    /Users/alex/.jupyter
    /usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/etc/jupyter
    /usr/local/etc/jupyter
    /etc/jupyter
data:
    /Users/alex/Library/Jupyter
    /usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter
runtime:
    /Users/alex/Library/Jupyter/runtime

Interestingly, the following directories don't exist.

/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/etc/jupyter
/usr/local/etc/jupyter
/etc/jupyter

Setting c.NotebookApp.notebook_dir = '/Users/alex/' in /Users/alex/.jupyter/jupyter_notebook_config.py seems to have no effect.

$jupyter notebook
[I 18:26:34.756 NotebookApp] [nb_conda_kernels] enabled, 4 kernels found
[I 18:26:35.257 NotebookApp] The port 8888 is already in use, trying another port.
[I 18:26:35.258 NotebookApp] The port 8889 is already in use, trying another port.
[I 18:26:35.259 NotebookApp] The port 8890 is already in use, trying another port.
[I 18:26:35.260 NotebookApp] The port 8891 is already in use, trying another port.
[I 18:26:36.299 NotebookApp] [nb_anacondacloud] enabled
[I 18:26:36.304 NotebookApp] [nb_conda] enabled
[I 18:26:36.382 NotebookApp] ✓ nbpresent HTML export ENABLED
[W 18:26:36.382 NotebookApp] ✗ nbpresent PDF export DISABLED: No module named 'nbbrowserpdf'
[I 18:26:36.388 NotebookApp] Serving notebooks from local directory: /Users/alex
[I 18:26:36.388 NotebookApp] 0 active kernels
[I 18:26:36.388 NotebookApp] The Jupyter Notebook is running at:
[I 18:26:36.388 NotebookApp] http://localhost:8892/?token=289948463daed06187325be63202f620b812dddc14f2918a
[I 18:26:36.388 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 18:26:36.389 NotebookApp] 

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8892/?token=289948463daed06187325be63202f620b812dddc14f2918a
[I 18:26:36.717 NotebookApp] Accepting one-time-token-authenticated connection from ::1
[I 18:26:37.252 NotebookApp] Refusing to serve hidden directory '/Users/alex/Dropbox', via 404 Error
[W 18:26:37.252 NotebookApp] 404 GET /api/contents?type=directory&_=1526088397023 (::1): directory does not exist: 'Dropbox'
[W 18:26:37.252 NotebookApp] directory does not exist: 'Dropbox'
[W 18:26:37.253 NotebookApp] 404 GET /api/contents?type=directory&_=1526088397023 (::1) 15.70ms referer=http://localhost:8892/tree

Where could the Jupyter home directory be set from?

Upvotes: 2

Views: 960

Answers (1)

Peter Szoldan
Peter Szoldan

Reputation: 4868

It is the intended behavior of jupyter notebook to throw a 404 when starting it from a hidden folder.

Generally, jupyter notebook will start in the folder where you invoke the jupyter notebook command. So cd into the directory where you want it to run from, and issue jupyter notebook there.

If that doesn't work, you can try forcing the directory with a command line argument like jupyter notebook --notebook-dir=NEWDIR.

Otherwise, there is a global config and a local (per user) one you refer above. If the local is the default, then you probably changed the global config earlier. If you change your local config in ~/.jupyter/jupyter_notebook_config.py to the new value that should override the global config.

To clean up the global config, look for it in /etc/jupyter or /usr/local/etc/jupyter/ on Unix or %PROGRAMDATA%\jupyter\ in Windows.

You can list the current config paths used with the command jupyter --paths. More info in the manual.

Upvotes: 3

Related Questions