0

When I try running a Python Interactive Window in VS Code i get the error message:

Jupyter notebook failed to launch. 
Error: Traceback (most recent call last):
  File "C:\Users\Parker\AppData\Local\Programs\Python\Python37\lib\site-packages\nbformat\validator.py", line 12, in <module>
    from jsonschema import ValidationError
  File "C:\Users\Parker\AppData\Roaming\Python\Python37\site-packages\jsonschema\__init__.py", line 11, in <module>
    from jsonschema.exceptions import (
  File "C:\Users\Parker\AppData\Roaming\Python\Python37\site-packages\jsonschema\exceptions.py", line 9, in <module>
    import attr
ModuleNotFoundError: No module named 'attr'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\Parker\.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\vscode_datascience_helpers\daemon\daemon_python.py", line 54, in _decorator
    return func(self, *args, **kwargs)
  File "c:\Users\Parker\.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\vscode_datascience_helpers\jupyter_daemon.py", line 105, in m_exec_module_observable
    self._start_notebook(args, cwd, env)
  File "c:\Users\Parker\.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\vscode_datascience_helpers\jupyter_daemon.py", line 147, in _start_notebook
    from notebook import notebookapp as app
  File "C:\Users\Parker\AppData\Local\Programs\Python\Python37\lib\site-packages\notebook\notebookapp.py", line 83, in <module>
    from .services.contents.manager import ContentsManager
  File "C:\Users\Parker\AppData\Local\Programs\Python\Python37\lib\site-packages\notebook\services\contents\manager.py", line 17, in <module>
    from nbformat import sign, validate as validate_nb, ValidationError
  File "C:\Users\Parker\AppData\Local\Programs\Python\Python37\lib\site-packages\nbformat\__init__.py", line 33, in <module>
    from .validator import validate, ValidationError
  File "C:\Users\Parker\AppData\Local\Programs\Python\Python37\lib\site-packages\nbformat\validator.py", line 23, in <module>
    raise ImportError(str(e) + verbose_msg)
ImportError: No module named 'attr'

    Jupyter notebook format depends on the jsonschema package:

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

    Please install it first.


Failed to run jupyter as observable with args notebook --no-browser --notebook-dir=C:\Users\Parker\AppData\Local\Temp\e74520b3-6a8d-4e0a-8f80-8ddf2a64bf70 --config=C:\Users\Parker\AppData\Local\Temp\e74520b3-6a8d-4e0a-8f80-8ddf2a64bf70\jupyter_notebook_config.py --NotebookApp.iopub_data_rate_limit=10000000000.0

There was another thread about this same problem here: Can't use Jupyter Notebook: jsonschema apparently missing, however, after following all the steps in the solution the error persist. If anyone might be able to provide a possible solution, I'd greatly appreciate it.

Gama11
  • 31,714
  • 9
  • 78
  • 100
Parker Shamblin
  • 111
  • 1
  • 10

2 Answers2

0

You need to install jupyter notebook seperately in code.

description is given: Jupyter notebook

Akshat Zala
  • 710
  • 1
  • 8
  • 23
  • So I did not run the command 'conda install -c conda-forge jupyterlab', however, I did run all the other commands on the page and the error persisted. I just reinstalled both Anaconda and VS Code and it fixed the problem so sadly I'm not able to tell if running all the commands on that page would of fixed it for me but thank you for helping me out. – Parker Shamblin Jun 04 '20 at 09:17
  • Correction to my comment above. You were correct that running the command 'conda install -c conda-forge notebook' featured on the website you linked would fix the problem. :) – Parker Shamblin Jun 04 '20 at 09:44
0

So I ended up uninstalling and reinstalling Anaconda and VS Code and it fixed the problem.

EDIT: Akshat Zala helped me find the underlying problem. I was trying to run the Interactive Window in a brand new Anaconda environment. This means I did not have Jupyter Notebook installed on it yet, therefore, the interactive window would not work. I fixed this issue by activating the conda environment then running the command 'conda install -c conda-forge notebook'.

Parker Shamblin
  • 111
  • 1
  • 10