Still not loading my directory?

I have defined my wanted folder in jupyter_notebook_config at C:\Users\user.jupyter\ folder, but no matter if it is with / or \ it just loads C:\Users\user folder and not my defined one.

Folder defined with:

The directory to use for notebooks and kernels.

Default: ‘’

c.NotebookApp.notebook_dir = ‘C:/Users/user/Python’

W 2021-10-30 19:55:24.292 LabApp] ‘notebook_dir’ has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[W 2021-10-30 19:55:24.293 LabApp] ‘notebook_dir’ has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[I 2021-10-30 19:55:24.305 LabApp] JupyterLab extension loaded from C:\Users\user\anaconda3\lib\site-packages\jupyterlab
[I 2021-10-30 19:55:24.305 LabApp] JupyterLab application directory is C:\Users\user\anaconda3\share\jupyter\lab

Would appreciate help. Running latest version 6.4.5 from anaconda.

Hi @LaMpiR - welcome to the community!

The default notebook-dir is the user’s HOME directory, so it looks like your configuration settings are not getting picked up - as you mention. If you’re launching jupyter notebook from a command prompt (and if not, I suggest you do), here are some suggestions to narrow things down.

  1. Try the CLI option directly: jupyter notebook --notebook-dir=C:\Users\user\Python as this will not rely on the configuration file to set the value as any CLI options supersede config file options. (Note the use of a dash in --notebook-dir rather than an underscore. Typically, the CLI flags use dashes where the configuration options use underscores - and this is an example of that.) I’m not aware of how path separators should be expressed on Windows or whether some options are more finicky in this area than others, so you might need to switch the styles if this doesn’t work.
  2. If you invoke jupyter notebook --debug to enable DEBUG logging, some of the early messages indicate the directories being searched for configuration files. There should be an indication of which directory contained appropriate files, so those messages are probably worth a close look.
  3. The command jupyter --paths will display the various directories searched. This output is broken down into sections of config, data, and runtime so focus on the config directories.

If you’re not invoking jupyter notebook from a command prompt, I’m not sure how to perform the above checks via another “launcher”. Perhaps others have some ideas as well.

1 Like

Hi, I am also having trouble lauching jupyter in a browser. It does nothing. A jupyter notebook will open for me in VS Code and IDLE but not a browser. When I try to launch from command line:

(base) C:\Users\nicho>jupyter notebook --notebook-dir=C:\Users\nicho\Python
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
    from notebook.notebookapp import main
  File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 78, in <module>
    from .services.kernels.kernelmanager import MappingKernelManager, AsyncMappingKernelManager
  File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 18, in <module>
    from jupyter_client.session import Session
  File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\__init__.py", line 6, in <module>
    from .asynchronous import AsyncKernelClient  # noqa
  File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\asynchronous\__init__.py", line 1, in <module>
    from .client import AsyncKernelClient  # noqa
  File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\asynchronous\client.py", line 6, in <module>
    from jupyter_client.channels import HBChannel
  File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\channels.py", line 15, in <module>
    from .session import Session
  File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\session.py", line 52, in <module>
    from jupyter_client.jsonutil import extract_dates
  File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\jsonutil.py", line 11, in <module>
    from dateutil.parser import parse as _dateutil_parse  # type: ignore
  File "C:\Users\nicho\AppData\Roaming\Python\Python38\site-packages\dateutil\parser.py", line 158
    l.append("%s=%s" % (attr, `value`))
                              ^
SyntaxError: invalid syntax

I see in other forums that there should be a configuration file to control the redirect to a browser. Because of the ‘jupyter notebook’ launch error, I cannot do any other commands, as shown.

Hi @Nick-f - This appears to be a different issue and there are several google hits for this. It appears a python2 version of dateutil is somehow in play. Here’s one of the search results in SO that includes an upgrade command: python - Invalid syntax inside dateutil when importing tensorflow. Why? - Stack Overflow which might help move you forward.

1 Like

It took me a long time to figure out the dilemma. By some sort of random event, I tried upgrade for the last of a dozen times, then anaconda prompt returned “requirement already satisfied lines,” and it finally ran. I have no idea. I also tinkered with the path a bit for Anaconda, but that did not initially work. Perhaps it was the combination of the two. I am sure it probably broke something else by getting a notebook to run. I also use nteract with notebooks, so this might present another problem.

(base) C:\Users\nicho>pip install notebook --upgrade
Requirement already satisfied: notebook in c:\programdata\anaconda3\lib\site-packages (6.4.5)
Requirement already satisfied: jinja2 in c:\programdata\anaconda3\lib\site-packages (from notebook) (2.11.3)
Requirement already satisfied: Send2Trash>=1.5.0 in c:\programdata\anaconda3\lib\site-packages (from notebook) (1.8.0)
Requirement already satisfied: argon2-cffi in c:\programdata\anaconda3\lib\site-packages (from notebook) (20.1.0)
Requirement already satisfied: jupyter-core>=4.6.1 in c:\programdata\anaconda3\lib\site-packages (from notebook) (4.8.1)
Requirement already satisfied: jupyter-client>=5.3.4 in c:\programdata\anaconda3\lib\site-packages (from notebook) (7.0.1)
Requirement already satisfied: nbformat in c:\programdata\anaconda3\lib\site-packages (from notebook) (5.1.3)
Requirement already satisfied: nbconvert in c:\programdata\anaconda3\lib\site-packages (from notebook) (6.1.0)
Requirement already satisfied: ipykernel in c:\programdata\anaconda3\lib\site-packages (from notebook) (6.4.1)
Requirement already satisfied: tornado>=6.1 in c:\programdata\anaconda3\lib\site-packages (from notebook) (6.1)
Requirement already satisfied: terminado>=0.8.3 in c:\programdata\anaconda3\lib\site-packages (from notebook) (0.9.4)
Requirement already satisfied: prometheus-client in c:\programdata\anaconda3\lib\site-packages (from notebook) (0.11.0)
Requirement already satisfied: traitlets>=4.2.1 in c:\programdata\anaconda3\lib\site-packages (from notebook) (5.1.0)
Requirement already satisfied: pyzmq>=17 in c:\programdata\anaconda3\lib\site-packages (from notebook) (22.2.1)
Requirement already satisfied: ipython-genutils in c:\programdata\anaconda3\lib\site-packages (from notebook) (0.2.0)
Requirement already satisfied: entrypoints in c:\programdata\anaconda3\lib\site-packages (from jupyter-client>=5.3.4->notebook) (0.3)
Requirement already satisfied: python-dateutil>=2.1 in c:\programdata\anaconda3\lib\site-packages (from jupyter-client>=5.3.4->notebook) (2.8.2)
Requirement already satisfied: nest-asyncio>=1.5 in c:\programdata\anaconda3\lib\site-packages (from jupyter-client>=5.3.4->notebook) (1.5.1)
Requirement already satisfied: pywin32>=1.0 in c:\programdata\anaconda3\lib\site-packages (from jupyter-core>=4.6.1->notebook) (228)
Requirement already satisfied: six>=1.5 in c:\programdata\anaconda3\lib\site-packages (from python-dateutil>=2.1->jupyter-client>=5.3.4->notebook) (1.16.0)
Requirement already satisfied: pywinpty>=0.5 in c:\programdata\anaconda3\lib\site-packages (from terminado>=0.8.3->notebook) (0.5.7)
Requirement already satisfied: cffi>=1.0.0 in c:\programdata\anaconda3\lib\site-packages (from argon2-cffi->notebook) (1.14.6)
Requirement already satisfied: pycparser in c:\programdata\anaconda3\lib\site-packages (from cffi>=1.0.0->argon2-cffi->notebook) (2.20)
Requirement already satisfied: ipython<8.0,>=7.23.1 in c:\programdata\anaconda3\lib\site-packages (from ipykernel->notebook) (7.27.0)
Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in c:\programdata\anaconda3\lib\site-packages (from ipykernel->notebook) (0.1.2)
Requirement already satisfied: debugpy<2.0,>=1.0.0 in c:\programdata\anaconda3\lib\site-packages (from ipykernel->notebook) (1.4.1)
Requirement already satisfied: colorama in c:\programdata\anaconda3\lib\site-packages (from ipython<8.0,>=7.23.1->ipykernel->notebook) (0.4.4)
Requirement already satisfied: pygments in c:\programdata\anaconda3\lib\site-packages (from ipython<8.0,>=7.23.1->ipykernel->notebook) (2.10.0)
Requirement already satisfied: setuptools>=18.5 in c:\programdata\anaconda3\lib\site-packages (from ipython<8.0,>=7.23.1->ipykernel->notebook) (58.0.4)
Requirement already satisfied: decorator in c:\programdata\anaconda3\lib\site-packages (from ipython<8.0,>=7.23.1->ipykernel->notebook) (5.1.0)
Requirement already satisfied: pickleshare in c:\programdata\anaconda3\lib\site-packages (from ipython<8.0,>=7.23.1->ipykernel->notebook) (0.7.5)
Requirement already satisfied: backcall in c:\programdata\anaconda3\lib\site-packages (from ipython<8.0,>=7.23.1->ipykernel->notebook) (0.2.0)
Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in c:\programdata\anaconda3\lib\site-packages (from ipython<8.0,>=7.23.1->ipykernel->notebook) (3.0.20)
Requirement already satisfied: jedi>=0.16 in c:\programdata\anaconda3\lib\site-packages (from ipython<8.0,>=7.23.1->ipykernel->notebook) (0.17.2)
Requirement already satisfied: parso<0.8.0,>=0.7.0 in c:\programdata\anaconda3\lib\site-packages (from jedi>=0.16->ipython<8.0,>=7.23.1->ipykernel->notebook) (0.7.0)
Requirement already satisfied: wcwidth in c:\programdata\anaconda3\lib\site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython<8.0,>=7.23.1->ipykernel->notebook) (0.2.5)
Requirement already satisfied: MarkupSafe>=0.23 in c:\programdata\anaconda3\lib\site-packages (from jinja2->notebook) (2.0.1)
Requirement already satisfied: jupyterlab-pygments in c:\programdata\anaconda3\lib\site-packages (from nbconvert->notebook) (0.1.2)
Requirement already satisfied: bleach in c:\programdata\anaconda3\lib\site-packages (from nbconvert->notebook) (4.0.0)
Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in c:\programdata\anaconda3\lib\site-packages (from nbconvert->notebook) (0.5.3)
Requirement already satisfied: mistune<2,>=0.8.1 in c:\programdata\anaconda3\lib\site-packages (from nbconvert->notebook) (0.8.4)
Requirement already satisfied: pandocfilters>=1.4.1 in c:\programdata\anaconda3\lib\site-packages (from nbconvert->notebook) (1.4.3)
Requirement already satisfied: defusedxml in c:\programdata\anaconda3\lib\site-packages (from nbconvert->notebook) (0.7.1)
Requirement already satisfied: testpath in c:\programdata\anaconda3\lib\site-packages (from nbconvert->notebook) (0.5.0)
Requirement already satisfied: async-generator in c:\programdata\anaconda3\lib\site-packages (from nbclient<0.6.0,>=0.5.0->nbconvert->notebook) (1.10)
Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in c:\programdata\anaconda3\lib\site-packages (from nbformat->notebook) (3.2.0)
Requirement already satisfied: attrs>=17.4.0 in c:\programdata\anaconda3\lib\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->notebook) (21.2.0)
Requirement already satisfied: pyrsistent>=0.14.0 in c:\programdata\anaconda3\lib\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->notebook) (0.17.3)
Requirement already satisfied: packaging in c:\programdata\anaconda3\lib\site-packages (from bleach->nbconvert->notebook) (21.0)
Requirement already satisfied: webencodings in c:\programdata\anaconda3\lib\site-packages (from bleach->nbconvert->notebook) (0.5.1)
Requirement already satisfied: pyparsing>=2.0.2 in c:\programdata\anaconda3\lib\site-packages (from packaging->bleach->nbconvert->notebook) (3.0.4)

(base) C:\Users\nicho>jupyter notebook
[I 08:45:43.392 NotebookApp] Writing notebook server cookie secret to C:\Users\nicho\AppData\Roaming\jupyter\runtime\notebook_cookie_secret
[I 2021-11-13 08:45:44.433 LabApp] JupyterLab extension loaded from C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab
[I 2021-11-13 08:45:44.433 LabApp] JupyterLab application directory is C:\ProgramData\Anaconda3\share\jupyter\lab
[I 08:45:44.440 NotebookApp] Serving notebooks from local directory: C:\Users\nicho
[I 08:45:44.445 NotebookApp] Jupyter Notebook 6.4.5 is running at:
[I 08:45:44.446 NotebookApp] http://localhost:8888/?token=a5545d4acda3e1d667206eeeaea793adedac73c25e664609
[I 08:45:44.455 NotebookApp]  or http://127.0.0.1:8888/?token=a5545d4acda3e1d667206eeeaea793adedac73c25e664609
[I 08:45:44.456 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 08:45:44.525 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///C:/Users/nicho/AppData/Roaming/jupyter/runtime/nbserver-31572-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=a5545d4acda3e1d667206eeeaea793adedac73c25e664609
     or http://127.0.0.1:8888/?token=a5545d4acda3e1d667206eeeaea793adedac73c25e664609

I do see that I threw a pip into the conda environment for the installation/update. I guess that may have been the difference, though I would not recommend that to others. That was purely an accident on my end.

Hi LaMpiR,
I found your solution. I, too, had the same issue when launching from Anaconda 3. To resolve this, open the Anaconda installation directory. I’m on Windows, but chose a custom installation location. However, you should be able to find your Anaconda 3 installation folder easily enough if you are familiar with your operating system.
My installation path is D:\Programming\Anaconda3\ so adjust your accordingly. From there, find this directory:
.\Lib\site-packages\anaconda_navigator\utils
You are looking for the launch.py file. Open it in your favorite Python editor.

Find this line:
def console(activate=None, working_directory=os.path.expanduser(’~’), term_command=’’):
then change the working_directory value to working_directory=’/path/to/desired/directory’ (note the forward slashes).

Save, stop the server, then restart it (it probably won’t hurt to reload Anaconda, too). Your server should now start with the desired directory.

Best wishes!

1 Like