ImportError: cannot import name 'Callable' from 'traitlets'

Question:

I can run jupyter notebook, but when I try to open a jupyter file I get the following error on my browser

500 : Internal Server Error

in the console, I get this error message

    To access the notebook, open this file in a browser:
        file:///C:/Users/Bruno/AppData/Roaming/jupyter/runtime/nbserver-23164-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=1e5a289e6fd9b36cab176131f1e3d0b673921c1a76258552
     or http://127.0.0.1:8888/?token=1e5a289e6fd9b36cab176131f1e3d0b673921c1a76258552
[W 16:19:04.850 NotebookApp] 404 GET /ipyparallel/clusters?_=1649168344196 (::1) 16.95ms referer=http://localhost:8888/tree
[E 16:19:24.938 NotebookApp] Uncaught exception GET /notebooks/examples/jupyter_notebooks/greenhouse.ipynb (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/notebooks/examples/jupyter_notebooks/greenhouse.ipynb', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "c:users...tornadoweb.py", line 1697, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "c:users..tornadoweb.py", line 3174, in wrapper
        return method(self, *args, **kwargs)
      File "c:users..notebooknotebookhandlers.py", line 96, in get
        get_frontend_exporters=get_frontend_exporters
      File "c:users..notebookbasehandlers.py", line 507, in render_template
        return template.render(**ns)
      File "c:users...jinja2asyncsupport.py", line 76, in render
        return original_render(self, *args, **kwargs)
      File "c:users...jinja2environment.py", line 1008, in render
        return self.environment.handle_exception(exc_info, True)
      File "c:users...jinja2environment.py", line 780, in handle_exception
        reraise(exc_type, exc_value, tb)
      File "c:users...jinja2_compat.py", line 37, in reraise
        raise value.with_traceback(tb)
      File "c:users...notebooktemplatesnotebook.html", line 1, in top-level template code
        {% extends "page.html" %}
      File "c:users...notebooktemplatespage.html", line 154, in top-level template code
        {% block header %}
      File "c:users...notebooktemplatesnotebook.html", line 114, in block "header"
        {% for exporter in get_frontend_exporters() %}
      File "c:users...notebooknotebookhandlers.py", line 19, in get_frontend_exporters
        from nbconvert.exporters.base import get_export_names, get_exporter
      File "c:users...nbconvert__init__.py", line 4, in <module>
        from .exporters import *
      File "c:users...nbconvertexporters__init__.py", line 4, in <module>
        from .slides import SlidesExporter
      File "c:users...nbconvertexportersslides.py", line 12, in <module>
        from ..preprocessors.base import Preprocessor
      File "c:users...nbconvertpreprocessors__init__.py", line 10, in <module>
        from .execute import ExecutePreprocessor
      File "c:users...nbconvertpreprocessorsexecute.py", line 8, in <module>
        from nbclient import NotebookClient, execute as _execute
      File "c:users...nbclient__init__.py", line 6, in <module>
        from .client import NotebookClient, execute  # noqa: F401
      File "c:users...nbclientclient.py", line 18, in <module>
        from traitlets import (
    ImportError: cannot import name 'Callable' from 'traitlets' (c:users...traitlets__init__.py)
[E 16:19:24.954 NotebookApp] {
      "Host": "localhost:8888",
      "Connection": "keep-alive",
      "Sec-Ch-Ua": "" Not A;Brand";v="99", "Chromium";v="99", "Google Chrome";v="99"",
      "Sec-Ch-Ua-Mobile": "?0",
      "Sec-Ch-Ua-Platform": ""Windows"",
      "Upgrade-Insecure-Requests": "1",
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
      "Sec-Fetch-Site": "same-origin",
      "Sec-Fetch-Mode": "navigate",
      "Sec-Fetch-User": "?1",
      "Sec-Fetch-Dest": "document",
      "Referer": "http://localhost:8888/tree/examples/jupyter_notebooks",
      "Accept-Encoding": "gzip, deflate, br",
      "Accept-Language": "es-MX,es;q=0.9,en-US;q=0.8,en;q=0.7,es-419;q=0.6,de;q=0.5,it;q=0.4",
      "Cookie": "_xsrf=2|d1d886ef|7780482558d83a8cceac4628e4649561|1649085007; username-localhost-8888="2|1:0|10:1649168343|23:username-localhost-8888|44:MTBiMWRjMTMzODlhNDUyM2IxYzMxNTgwZThlYTUyODk=|6f47252b3d75cbe3567f
0fb5380e2c6522193331

I am using Python 3.7 on windows and this is the list of packages I have installed

absl-py==0.8.0
alabaster==0.7.12
appdirs==1.4.3
astor==0.8.0
atomicwrites==1.3.0
attrs==19.1.0
Babel==2.9.0
backcall==0.1.0
bleach==3.1.0
bokeh==2.3.1
build==0.3.1.post1
cachetools==4.2.1
certifi==2020.12.5
chardet==4.0.0
charset-normalizer==2.0.12
colorama==0.4.4
coverage==4.5.4
cycler==0.10.0
Cython==0.29.23
decorator==4.4.0
defusedxml==0.6.0
depinfo==1.5.1
docutils==0.16
entrypoints==0.3
fastjsonschema==2.15.3
future==0.17.1
gast==0.3.1
google-pasta==0.2.0
gpflow==1.5.0
gpytorch==1.4.2
grpcio==1.37.0
h5py==2.10.0
idna==2.10
imagesize==1.2.0
importlib-metadata==4.11.3
ipykernel==5.1.3
ipyparallel==8.2.1
ipython==7.10.2
ipython-genutils==0.2.0
ipywidgets==7.5.1
jedi==0.15.1
Jinja2==2.10.1
joblib==0.14.0
jsonschema==3.2.0
jupyter==1.0.0
jupyter-client==6.2.0
jupyter-console==6.4.0
jupyter-core==4.7.1
jupyterlab-pygments==0.1.2
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.0
kiwisolver==1.1.0
latexcodec==2.0.1
Markdown==3.1.1
MarkupSafe==1.1.1
matplotlib==3.1.1
matplotlib-inline==0.1.3
mistune==0.8.4
more-itertools==7.2.0
mpmath==1.1.0
multipledispatch==0.6.0
nbclient==0.5.11
nbconvert==6.0.7
nbformat==5.3.0
nest-asyncio==1.5.1
nose==1.3.7
notebook==6.0.2
numpy==1.17.1
oauthlib==3.1.0
optlang==1.4.4
packaging==19.1
pandas==1.1.0
pandocfilters==1.4.2
parso==0.5.2
pep517==0.10.0
pexpect==4.7.0
phantomjs-binary==2.1.3
pickleshare==0.7.5
Pillow==8.2.0
Pint==0.10.1
pipdeptree==0.13.2
pluggy==0.13.0
ply==3.11
prettytable==0.7.2
prometheus-client==0.7.1
prompt-toolkit==2.0.10
protobuf==3.9.1
psutil==5.9.0
PTable==0.9.2
ptyprocess==0.6.0
py==1.8.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pybtex==0.24.0
pybtex-docutils==1.0.0
Pygments==2.5.2
pyparsing==2.4.2
PyQt5==5.13.2
PyQt5-sip==12.7.0
pyrsistent==0.15.6
pytest==5.1.2
python-dateutil==2.8.0
python-libsbml-experimental==5.18.0
pytz==2019.2
PyUtilib==5.7.3
pywin32==303
pywinpty==2.0.5
PyYAML==5.1.2
pyzmq==18.1.1
qtconsole==4.6.0
requests==2.27.1
rsa==4.7.2
ruamel.yaml==0.16.5
ruamel.yaml.clib==0.1.2
scikit-learn==0.21.3
scipy==1.3.1
seaborn==0.9.0
selenium==3.141.0
Send2Trash==1.5.0
six==1.12.0
snowballstemmer==2.1.0
Sphinx==4.5.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
swiglpk==4.65.0
sympy==1.4
tabulate==0.8.6
tensorboard==1.14.0
tensorboard-plugin-wit==1.8.0
tensorflow==1.14.0
tensorflow-estimator==1.14.0
termcolor==1.1.0
terminado==0.8.3
terminaltables==3.1.0
testpath==0.4.4
toml==0.10.2
torch==1.8.1
torchaudio==0.8.1
tornado==6.0.3
tqdm==4.64.0
traitlets==4.3.3
typing-extensions==3.7.4.3
urllib3==1.25.7
wcwidth==0.1.7
webencodings==0.5.1
Werkzeug==0.15.6
widgetsnbextension==3.5.1
wrapt==1.11.2
xlrd==1.2.0
zipp==0.6.0

The following is not related to the question above!
I don’t have any more details to write, but if I don’t write something Stackoverflow complains that I am writing only code and doesn’t let me post my message. So I am writing some more stuff to get to the point that he lets me post it. I find this check a bit annoing

Asked By: Bruno

||

Answers:

The problem was solved by installing traitlets v5.1.1 and traitlets-widget v5.5.0

Answered By: Bruno

This worked for me:

pip install jupyterlab==3.5.3

I think the error appears when mixing the old pip jupyter package with jupyterlab components.

Answered By: Oliver Zendel
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.