How to fix “NotImplementedError” when trying to run Hydrogen in Atom

家住魔仙堡 提交于 2019-12-01 11:55:15

问题


I am trying to run Hydrogen on Atom, but I am getting an error message that ends with "NotImplementedError" in the asyncio python lib.

I have Python3 installed on a Windows 10 machine, and I have the ipython kernel installed with jupyter.

I am getting the following error message, and I am not sure where to start to fix the problem.

Traceback (most recent call last): File "C:\Users\chels\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 192, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\chels\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\chels\AppData\Local\Programs\Python\Python38\lib\site-packages\ipykernel_launcher.py", line 16, in app.launch_new_instance() File "C:\Users\chels\AppData\Local\Programs\Python\Python38\lib\site-packages\traitlets\config\application.py", line 657, in launch_instance app.initialize(argv) File "", line 2, in initialize File "C:\Users\chels\AppData\Local\Programs\Python\Python38\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error return method(app, *args, **kwargs) File "C:\Users\chels\AppData\Local\Programs\Python\Python38\lib\site-packages\ipykernel\kernelapp.py", line 469, in initialize self.init_sockets() File "C:\Users\chels\AppData\Local\Programs\Python\Python38\lib\site-packages\ipykernel\kernelapp.py", line 259, in init_sockets self.init_iopub(context) File "C:\Users\chels\AppData\Local\Programs\Python\Python38\lib\site-packages\ipykernel\kernelapp.py", line 267, in init_iopub self.iopub_thread = IOPubThread(self.iopub_socket, pipe=True) File "C:\Users\chels\AppData\Local\Programs\Python\Python38\lib\site-packages\ipykernel\iostream.py", line 68, in init self._setup_pipe_in() File "C:\Users\chels\AppData\Local\Programs\Python\Python38\lib\site-packages\ipykernel\iostream.py", line 141, in _setup_pipe_in self._pipe_in = ZMQStream(pipe_in, self.io_loop) File "C:\Users\chels\AppData\Local\Programs\Python\Python38\lib\site-packages\zmq\eventloop\zmqstream.py", line 120, in init self._init_io_state() File "C:\Users\chels\AppData\Local\Programs\Python\Python38\lib\site-packages\zmq\eventloop\zmqstream.py", line 541, in _init_io_state self.io_loop.add_handler(self.socket, self._handle_events, self.io_loop.READ) File "C:\Users\chels\AppData\Local\Programs\Python\Python38\lib\site-packages\tornado\platform\asyncio.py", line 79, in add_handler self.asyncio_loop.add_reader( File "C:\Users\chels\AppData\Local\Programs\Python\Python38\lib\asyncio\events.py", line 498, in add_reader raise NotImplementedError NotImplementedError


回答1:


The exception comes from Tornado invoking the asyncio event loop method add_reader which is not supported on Windows.

The Tornado documentation states the following about platforms:

Platforms: Tornado should run on any Unix-like platform, although for the best performance and scalability only Linux (with epoll) and BSD (with kqueue) are recommended for production deployment (even though Mac OS X is derived from BSD and supports kqueue, its networking performance is generally poor so it is recommended only for development use). Tornado will also run on Windows, although this configuration is not officially supported and is recommended only for development use. Without reworking Tornado IOLoop interface, it’s not possible to add a native Tornado Windows IOLoop implementation or leverage Windows’ IOCP support from frameworks like AsyncIO or Twisted.

The last sentence means that the asyncio part of Tornado does not yet work on Windows.




回答2:


You can roll back to Python 3.7, or you can edit Tornado to work on 3.8.

Find the tornado / platform / asyncio.py file and add the following code:

import sys

if sys.platform == 'win32':
    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

From here.



来源:https://stackoverflow.com/questions/54608421/how-to-fix-notimplementederror-when-trying-to-run-hydrogen-in-atom

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!