1

I am having issues launching Jupyter Notebook. I have tried to do it two ways and seem to get errors.

1 - Launching from the Anaconda Prompt using the command jupyter notebook or directly choosing from the Anaconda menu

I get the following:

(base) C:\Users\metni>jupyter notebook
Traceback (most recent call last):
  File "C:\Users\metni\anaconda3\lib\site-packages\jsonschema\__init__.py", line 31, in <module>
    from importlib import metadata
ImportError: cannot import name 'metadata' from 'importlib' (C:\Users\metni\anaconda3\lib\importlib\__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\metni\anaconda3\lib\site-packages\nbformat\validator.py", line 12, in <module>
    from jsonschema import ValidationError
  File "C:\Users\metni\anaconda3\lib\site-packages\jsonschema\__init__.py", line 33, in <module>
    import importlib_metadata as metadata
ModuleNotFoundError: No module named 'importlib_metadata'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\metni\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
    from notebook.notebookapp import main
  File "C:\Users\metni\anaconda3\lib\site-packages\notebook\notebookapp.py", line 80, in <module>
    from .services.contents.manager import ContentsManager
  File "C:\Users\metni\anaconda3\lib\site-packages\notebook\services\contents\manager.py", line 17, in <module>
    from nbformat import sign, validate as validate_nb, ValidationError
  File "C:\Users\metni\anaconda3\lib\site-packages\nbformat\__init__.py", line 32, in <module>
    from .validator import validate, ValidationError
  File "C:\Users\metni\anaconda3\lib\site-packages\nbformat\validator.py", line 23, in <module>
    raise ImportError(str(e) + verbose_msg)
ImportError: No module named 'importlib_metadata'

    Jupyter notebook format depends on the jsonschema package:

        https://pypi.python.org/pypi/jsonschema

    Please install it first.

2 - Launching from the command line with the same command

I get the following:

C:\Users\metni>jupyter notebook
Traceback (most recent call last):
  File "C:\Users\metni\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
    from notebook.notebookapp import main
  File "C:\Users\metni\anaconda3\lib\site-packages\notebook\notebookapp.py", line 64, in <module>
    from tornado import httpserver
  File "C:\Users\metni\anaconda3\lib\site-packages\tornado\httpserver.py", line 29, in <module>
    import ssl
  File "C:\Users\metni\anaconda3\lib\ssl.py", line 98, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: DLL load failed: The specified module could not be found.

It seems like this is referring to a package called jsonschema which is not installed apparently, but running a pip install jsonschema does not solve the problem for me...

Houssam Metni
  • 143
  • 2
  • 8
  • This may solve your problem https://stackoverflow.com/questions/20201868/importerror-dll-load-failed-the-specified-module-could-not-be-found – K. Prot Jul 29 '20 at 14:35
  • Thank you! I just managed to solve the issue based on one answer in another question but thanks anyways – Houssam Metni Jul 29 '20 at 14:39

2 Answers2

1

In the answer above I also have two two commands but they are a bit different

source /opt/anaconda/bin/activate root

and then

jupyter notebook

It seems like you have to go into your anaconda directory then bin, then you can "activate root"

It also looks like you need to install some other dependencies for jupyter to run. Where is says

Jupyter notebook format depends on the jsonschema package:

    https://pypi.python.org/pypi/jsonschema

Please install it first.

So if the above doesn't work try installing the other dependency and try again

Dharman
  • 30,962
  • 25
  • 85
  • 135
  • Thank you! Since everything is already working fine for me I won't necessarily try running these commands but your answer will surely be useful for anybody in the future who is having the same problem – Houssam Metni Jul 30 '20 at 20:59
0

Based on this answer from a similar question, I managed to solve the problem by running these two commands:

conda update -n root conda

conda update --all

I thus updated all packages, and the notebook is now launching.

Houssam Metni
  • 143
  • 2
  • 8