Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

running "jupyter notebook" in virtualenv returning AttributeError

I installed jupyter using pip in a virtualenv in python3. On running:

jupyter notebook

I get the following Error

    File "<path>/ss/bin/jupyter-notebook", line 7, in <module>
    from notebook.notebookapp import main
  File "<path>/ss/lib/python3.4/site-packages/notebook/notebookapp.py", line 44, in <module>
    from zmq.eventloop import ioloop
  File "<path>/ss/lib/python3.4/site-packages/zmq/eventloop/__init__.py", line 3, in <module>
    from zmq.eventloop.ioloop import IOLoop
  File "<path>/ss/lib/python3.4/site-packages/zmq/eventloop/ioloop.py", line 78, in <module>
    while _IOLoop.configurable_default() is not _IOLoop:
  File "<path>/ss/lib/python3.4/site-packages/tornado/ioloop.py", line 350, in configurable_default
    from tornado.platform.asyncio import AsyncIOLoop
  File "<path>/ss/lib/python3.4/site-packages/tornado/platform/asyncio.py", line 25, in <module>
    from tornado.gen import convert_yielded
  File "<path>/ss/lib/python3.4/site-packages/tornado/gen.py", line 1295, in <module>
    _wrap_awaitable = asyncio.ensure_future
AttributeError: 'module' object has no attribute 'ensure_future'

I upgraded every dependency module to its latest version using

--upgrade

But it is still giving me same error.

like image 553
Utkarsh Mall Avatar asked Mar 06 '18 04:03

Utkarsh Mall


1 Answers

I solved this by downgrading the tornado package to version 4.5:

pip install tornado==4.5

When I installed ipykernel using pip in my virtual environment, it installed automatically tornado as latest version. But, I think latest version tornado with python version under than 3.4.4 causing the error.

So, I removed tornado and re-installed it with version 4.5 (This version was installed in my other virtual environment.)

like image 113
littlechun4 Avatar answered Oct 18 '22 21:10

littlechun4