Solution for problem "No module named 'jupyter_server.contents'" with Jupyter notebook

Course: Python for Trading: Basic

Jupyter Notebook version: 6.5.2



When I tried to run locally the downloadable files, and executed the "jupyter notebook" command in the quantra_py environment, I got the following error:

"

(D:\Dev\quantra_py) C:\Users\NickM>jupyter notebook

Traceback (most recent call last):

  File "D:\Dev\quantra_py\lib\site-packages\notebook\traittypes.py", line 235, in _resolve_classes

    klass = self._resolve_string(klass)

  File "D:\Dev\quantra_py\lib\site-packages\traitlets\traitlets.py", line 2009, in _resolve_string

    return import_item(string)

  File "D:\Dev\quantra_py\lib\site-packages\traitlets\utils\importstring.py", line 30, in import_item

    module = import(package, fromlist=[obj])

ModuleNotFoundError: No module named 'jupyter_server.contents'



"

To solve it, you have to find the file notebookapp.py in folder "…\site-packages\notebook\notebookapp.py" (the exact location depends on the environment installation folder), and then find the line with code:

"jupyter_server.contents.services.managers.ContentsManager" 

and replace it with the:

"jupyter_server.services.contents.manager.ContentsManager".



It worked for me.

Thx

pip uninstall traitlets
pip install traitlets==5.9.0

I have fixed this error using this

Thx MD, 

this is an even better solution!!