Notebook: Can't launch jupyter-lab or jupyter-notebook: AttributeError: type object 'Callable' has no attribute '_abc_registry'

Created on 3 Nov 2018  路  4Comments  路  Source: jupyter/notebook

I installed jupyter with anaconda, and always keep it up to date. Today I find I can't launch jupyter-lab or jupyter-notebook: python raises an error when I run jupyter-lab with terminal:

Traceback (most recent call last):
File "/opt/anaconda/bin/jupyter-lab", line 7, in
from jupyterlab.labapp import main
File "/opt/anaconda/lib/python3.7/site-packages/jupyterlab/labapp.py", line 12, in
from jupyterlab_server import slugify, WORKSPACE_EXTENSION
File "/opt/anaconda/lib/python3.7/site-packages/jupyterlab_server/__init__.py", line 4, in
from .app import LabServerApp
File "/opt/anaconda/lib/python3.7/site-packages/jupyterlab_server/app.py", line 9, in
from .server import ServerApp
File "/opt/anaconda/lib/python3.7/site-packages/jupyterlab_server/server.py", line 14, in
from notebook.base.handlers import (
File "/opt/anaconda/lib/python3.7/site-packages/notebook/__init__.py", line 25, in
from .nbextensions import install_nbextension
File "/opt/anaconda/lib/python3.7/site-packages/notebook/nbextensions.py", line 610, in
from .extensions import (
File "/opt/anaconda/lib/python3.7/site-packages/notebook/extensions.py", line 8, in
from tornado.log import LogFormatter
File "/opt/anaconda/lib/python3.7/site-packages/tornado/log.py", line 36, in
from tornado.escape import _unicode
File "/opt/anaconda/lib/python3.7/site-packages/tornado/escape.py", line 27, in
from tornado.util import PY3, unicode_type, basestring_type
File "/opt/anaconda/lib/python3.7/site-packages/tornado/util.py", line 48, in
import typing # noqa
File "/opt/anaconda/lib/python3.7/site-packages/typing.py", line 1347, in
class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
File "/opt/anaconda/lib/python3.7/site-packages/typing.py", line 1003, in __new__
self._abc_registry = extra._abc_registry
AttributeError: type object 'Callable' has no attribute '_abc_registry'

Or this almost the same error when I run jupyter-notebook with terminal:

Traceback (most recent call last):
File "/opt/anaconda/bin/jupyter-notebook", line 7, in
from notebook.notebookapp import main
File "/opt/anaconda/lib/python3.7/site-packages/notebook/__init__.py", line 25, in
from .nbextensions import install_nbextension
File "/opt/anaconda/lib/python3.7/site-packages/notebook/nbextensions.py", line 610, in
from .extensions import (
File "/opt/anaconda/lib/python3.7/site-packages/notebook/extensions.py", line 8, in
from tornado.log import LogFormatter
File "/opt/anaconda/lib/python3.7/site-packages/tornado/log.py", line 36, in
from tornado.escape import _unicode
File "/opt/anaconda/lib/python3.7/site-packages/tornado/escape.py", line 27, in
from tornado.util import PY3, unicode_type, basestring_type
File "/opt/anaconda/lib/python3.7/site-packages/tornado/util.py", line 48, in
import typing # noqa
File "/opt/anaconda/lib/python3.7/site-packages/typing.py", line 1347, in
class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
File "/opt/anaconda/lib/python3.7/site-packages/typing.py", line 1003, in __new__
self._abc_registry = extra._abc_registry
AttributeError: type object 'Callable' has no attribute '_abc_registry'

How to fix it?

Most helpful comment

This is because typing library is in the standard library since 3.5. If you have older version of typing uninstalling it does the trick

sudo pip3 uninstall typing

All 4 comments

I found the same issue.
My crude workaround - drop back to Python 3.6.
When I installed Keras, it downgraded a significant number of modules to prior versions including Python to 3.6.

I later created a new environment py37 and upgraded Python to 3.7 in that environment.
Activated py37 tried to launch jupyter notebook and once again got the error. I'm running on a Mac, have yet to check it out on my virtual windows install.

Later, I used anaconda-clean then trashed anaconda, re-installed (getting python 3.7).

Could not launch jupyter notebook from Terminal, nor from Anaconda navigator without getting "Callable has n attribute _abc_registry". But I could launch jupyter-lab from Anaconda navigator, then used Help menu to display lab as jupyter notebook.

It's a workaround that got jupyter notebook running nicely.

This is because typing library is in the standard library since 3.5. If you have older version of typing uninstalling it does the trick

sudo pip3 uninstall typing

@dave-wilkins @pradeepcheers Thanks to your help, this problem has been fixed!

Was this page helpful?
0 / 5 - 0 ratings