Hi,
after setting up jupyter via pip in a new virtualenv, it keeps crashing after start. I am using macOS.
[I 23:29:38.054 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports
WARNING:root:kernel 6f4f9263-6652-415f-b1e5-e32ce679a7e3 restarted
Traceback (most recent call last):
File "/Users/christian/Documents/virtualenv/machinelearning/lib/python3.4/site-packages/tornado/ioloop.py", line 288, in current
return IOLoop._ioloop_for_asyncio[loop]
KeyError: <asyncio.unix_events._UnixSelectorEventLoop object at 0x1042a59e8>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/christian/Documents/virtualenv/machinelearning/lib/python3.4/site-packages/ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "/Users/christian/Documents/virtualenv/machinelearning/lib/python3.4/site-packages/traitlets/config/application.py", line 657, in launch_instance
app.initialize(argv)
File "<decorator-gen-123>", line 2, in initialize
File "/Users/christian/Documents/virtualenv/machinelearning/lib/python3.4/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/Users/christian/Documents/virtualenv/machinelearning/lib/python3.4/site-packages/ipykernel/kernelapp.py", line 465, in initialize
self.init_kernel()
File "/Users/christian/Documents/virtualenv/machinelearning/lib/python3.4/site-packages/ipykernel/kernelapp.py", line 364, in init_kernel
shell_stream = ZMQStream(self.shell_socket)
File "/Users/christian/Documents/virtualenv/machinelearning/lib/python3.4/site-packages/zmq/eventloop/zmqstream.py", line 108, in __init__
self.io_loop = io_loop or IOLoop.instance()
File "/Users/christian/Documents/virtualenv/machinelearning/lib/python3.4/site-packages/zmq/eventloop/ioloop.py", line 105, in instance
loop = ioloop.IOLoop.instance(*args, **kwargs)
File "/Users/christian/Documents/virtualenv/machinelearning/lib/python3.4/site-packages/tornado/ioloop.py", line 221, in instance
return IOLoop.current()
File "/Users/christian/Documents/virtualenv/machinelearning/lib/python3.4/site-packages/tornado/ioloop.py", line 292, in current
current = AsyncIOMainLoop(make_current=True)
File "/Users/christian/Documents/virtualenv/machinelearning/lib/python3.4/site-packages/tornado/util.py", line 312, in __new__
instance.initialize(*args, **init_kwargs)
File "/Users/christian/Documents/virtualenv/machinelearning/lib/python3.4/site-packages/tornado/platform/asyncio.py", line 182, in initialize
super(AsyncIOMainLoop, self).initialize(asyncio.get_event_loop(), **kwargs)
File "/Users/christian/Documents/virtualenv/machinelearning/lib/python3.4/site-packages/tornado/platform/asyncio.py", line 53, in initialize
if loop.is_closed():
AttributeError: '_UnixSelectorEventLoop' object has no attribute 'is_closed'
[W 23:29:41.065 NotebookApp] KernelRestarter: restart failed
[W 23:29:41.065 NotebookApp] Kernel 6f4f9263-6652-415f-b1e5-e32ce679a7e3 died, removing from map.
ERROR:root:kernel 6f4f9263-6652-415f-b1e5-e32ce679a7e3 restarted failed!
[W 23:29:41.085 NotebookApp] 410 DELETE /api/sessions/a1fe78fe-4e00-4e5a-8d9d-065b5cc61857 (::1): Kernel deleted before session
[W 23:29:41.085 NotebookApp] Kernel deleted before session
[W 23:29:41.087 NotebookApp] 410 DELETE /api/sessions/a1fe78fe-4e00-4e5a-8d9d-065b5cc61857 (::1) 4.32ms referer=http://localhost:8888/notebooks/machinelearning/Untitled.ipynb?kernel_name=python3
^C[I 23:30:03.118 NotebookApp] interrupted
I was looking for this: AttributeError: '_UnixSelectorEventLoop' object has no attribute 'is_closed'but could not find a solution/hint for this.
I have another virtualenv, where it is still working fine. But need a fresh one. Any suggestions? Thanks!
What version of the tornado package have you got? And what's your exact version of Python?
cc @bdarnell
Requirement already satisfied: tornado in ./machinelearning/lib/python3.4/site-packages (5.0.2)
Python 3.4.1
The event_loop.is_closed method was introduced in Python 3.4.2, so this is apparently the minimum version Tornado 5.0 supports (I didn't know this because it's hard to test with non-latest versions of Python releases). Actually, I think this may have changed in 5.0.2, which would explain why your other virtualenv is working.
As long as python insists on adding features in patch releases, you'll just need to upgrade to the latest patch release of the python minor version you use.
OK, so you can either upgrade Python or pin tornado<5. Thanks @bdarnell for chiming in. :-) Closing this issue since there's nothing to be done for Jupyter.
This has Jupyter notebook not working for me. I'm on Python 3.6.4 on Ubuntu Linux with Anaconda Python.
Ah, downgrading to tornado 4.5.3 worked.
conda install tornado=4.5.3 or pip install --upgrade tornado==4.5.3
Ah, downgrading to tornado 4.5.3 worked.
conda install tornado=4.5.3orpip install --upgrade tornado==4.5.3
removeing all kenels :(