Skip to content Skip to sidebar Skip to footer

Jupyter Notebook Cannot Start With Python 3.8 In Windows 10

Here is the detailed error when launching jupyter notebook with python version 3.8 File 'c:\users\kokat\appdata\local\programs\python\python38\lib\runpy.py', line 192, in _run_mo

Solution 1:

Following one of the comments in this thread, I've solved the problem by:

  1. Locate and open the asyncio.py file. In my case it's in C:\Users\[USERNAME]\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\tornado\platform\
  2. After the line import asyncio add the following:
from sys import platform 
if platform == "win32":               
    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # python-3.8.0a4

This will force using SelectorEventLoop on Windows.


Solution 2:

Jupyter notebook runs as a tornado web server. Your browser connect to this tornado server via a socket.

The I/O of the socket are handled by tornado's asyncio, which relies on the add_reader implementation of the native asyncio module of python runtime. As pointed out in the documentation of asyncio, this method is only supported with Windows SelectorEventLoop so make sure you are using this kind of event loop in your python installation. To find out which eventloop implementation is in usage, you can run the following commands in python shell:

import asyncio
print(asyncio.get_event_loop().__class__)
# Output: <class 'asyncio.windows_events._WindowsSelectorEventLoop'>

There is an ongoing discussion about allowing user to change the EventLoopPolicy of asyncio in jupyter's configuration file.


Post a Comment for "Jupyter Notebook Cannot Start With Python 3.8 In Windows 10"