Jupyter not starting in Win 10

Hi, I am not able to start Jupyter in Windows 10 using the command jupyter-notebook. It gives me the error:

C:\Users\<me>>jupyter-notebook
Traceback (most recent call last):
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\<me>\AppData\Local\Programs\Python\Python38-32\Scripts\jupyter-notebook.exe\__main__.py", line 7, in <module>
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\jupyter_core\application.py", line 268, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\traitlets\config\application.py", line 663, in launch_instance
    app.initialize(argv)
  File "<c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\decorator.py:decorator-gen-7>", line 2, in initialize
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\notebook\notebookapp.py", line 1679, in initialize
    self.init_webapp()
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\notebook\notebookapp.py", line 1442, in init_webapp
    self.http_server.listen(port, self.ip)
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\tornado\tcpserver.py", line 152, in listen
    self.add_sockets(sockets)
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\tornado\tcpserver.py", line 165, in add_sockets
    self._handlers[sock.fileno()] = add_accept_handler(
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\tornado\netutil.py", line 279, in add_accept_handler
    io_loop.add_handler(sock, accept_handler, IOLoop.READ)
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\tornado\platform\asyncio.py", line 99, in add_handler
    self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ)
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\asyncio\events.py", line 501, in add_reader
    raise NotImplementedError
NotImplementedError

It had installed successfully. Path and pip details are:

$PATH:
        C:\Windows\system32
        C:\Windows
        C:\Windows\System32\Wbem
        C:\Windows\System32\WindowsPowerShell\v1.0\
        C:\Windows\System32\OpenSSH\
        C:\Program Files\Git\cmd
        C:\Users\<me>\AppData\Local\Programs\Python\Python38-32\Scripts\
        C:\Users\<me>\AppData\Local\Programs\Python\Python38-32\
        C:\Users\<me>\AppData\Local\Microsoft\WindowsApps
        C:\mingw-w64\x86_64-8.1.0-win32-seh-rt_v6-rev0\mingw64\bin\

        c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\pywin32_system32

sys.path:
        C:\Users\<me>\AppData\Local\Programs\Python\Python38-32\Scripts\jupyter-troubleshoot.EXE
        c:\users\<me>\appdata\local\programs\python\python38-32\python38.zip
        c:\users\<me>\appdata\local\programs\python\python38-32\DLLs
        c:\users\<me>\appdata\local\programs\python\python38-32\lib
        c:\users\<me>\appdata\local\programs\python\python38-32
        c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages
        c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\win32
        c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\win32\lib
        c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\Pythonwin

sys.executable:
        c:\users\<me>\appdata\local\programs\python\python38-32\python.exe

sys.version:
        3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)]

platform.platform():
        Windows-10-10.0.17134-SP0

where jupyter:
        C:\Users\<me>\AppData\Local\Programs\Python\Python38-32\Scripts\jupyter.exe

pip list:
        Package            Version
        ------------------ ---------
        attrs              19.3.0
        backcall           0.1.0
        bleach             3.1.0
        colorama           0.4.1
        decorator          4.4.0
        defusedxml         0.6.0
        entrypoints        0.3
        eventkit           0.8.5
        get                2019.4.13
        ib-insync          0.9.56
        importlib-metadata 0.23
        ipykernel          5.1.3
        ipython            7.8.0
        ipython-genutils   0.2.0
        jedi               0.15.1
        Jinja2             2.10.3
        json5              0.8.5
        jsonschema         3.1.1
        jupyter-client     5.3.4
        jupyter-core       4.6.0
        jupyterlab         1.1.4
        jupyterlab-server  1.0.6
        MarkupSafe         1.1.1
        mistune            0.8.4
        more-itertools     7.2.0
        nbconvert          5.6.0
        nbformat           4.4.0
        nest-asyncio       1.2.0
        notebook           6.0.1
        numpy              1.17.3
        pandocfilters      1.4.2
        parso              0.5.1
        pickleshare        0.7.5
        pip                19.3.1
        post               2019.4.13
        prometheus-client  0.7.1
        prompt-toolkit     2.0.10
        public             2019.4.13
        Pygments           2.4.2
        pyrsistent         0.15.4
        python-dateutil    2.8.0
        pywin32            225
        pywinpty           0.5.5
        pyzmq              18.1.0
        query-string       2019.4.13
        request            2019.4.13
        Send2Trash         1.5.0
        setuptools         41.4.0
        six                1.12.0
        terminado          0.8.2
        testpath           0.4.2
        tornado            6.0.3
        traitlets          4.3.3
        wcwidth            0.1.7
        webencodings       0.5.1
        zipp               0.6.0

How did you install Python? (e.g. Which installer). It looks like it does not fully support async io events.

Note: Not a expert in Windows/Python, so this could be a wild goose chase…

I’m trying to figure out how to fix this issue as well, however I did find this issue for Tornado / asyncio: https://github.com/tornadoweb/tornado/issues/2608

I can confirm that if you edit site-packages\tornado\platform\asyncio.py and, on a new line after “import asyncio” (line 29), add

asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

jupyter-notebook works

However, this is an ugly workaround. Hopefully it’ll get patched properly.

Thanks for the work-around hack!. It opened for me after putting import asyncio in tornado’s asyncio.py

Will test if my asyncio works. It used to work in my previous installation

Hope the developers do something to fix it.

pip3 install jupyter using Admin PowerShell in Win10 on Python38-32

Spoke a bit too early. Am getting Kernel Error

Traceback (most recent call last):
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\tornado\web.py", line 1699, in _execute
    result = await result
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\notebook\services\sessions\handlers.py", line 69, in post
    model = yield maybe_future(
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 88, in create_session
    kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 100, in start_kernel_for_session
    kernel_id = yield maybe_future(
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\tornado\gen.py", line 209, in wrapper
    yielded = next(result)
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
    km.start_kernel(**kwargs)
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\jupyter_client\manager.py", line 240, in start_kernel
    self.write_connection_file()
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\jupyter_client\connect.py", line 470, in write_connection_file
    self.connection_file, cfg = write_connection_file(self.connection_file,
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\jupyter_client\connect.py", line 141, in write_connection_file
    with secure_write(fname) as f:
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\jupyter_core\paths.py", line 424, in secure_write
    win32_restrict_file_to_user(fname)
  File "c:\users\<me>\appdata\local\programs\python\python38-32\lib\site-packages\jupyter_core\paths.py", line 359, in win32_restrict_file_to_user
    import win32api
ImportError: DLL load failed while importing win32api: The specified module could not be found.

Solved the issue using C:\Users\<me>\AppData\Local\Programs\Python\Python38-32\Scripts> python pywin32_postinstall.py … the kernel seems to be working now.

Also had issues installing lxml. Had to manually…

pip install C:\Users\<me>\Downloads\lxml-4.4.1-cp38-cp38-win32.whl

Thanks kashivis and drepamig, I had the same issues and your workarounds solved them.

1 Like

Apparently, it’s currently planed for Jupyterlab-2.0 milestone https://github.com/jupyterlab/jupyterlab/issues/6487 , somewhere Q1 2020

Hi Kashivis,
I am facing the same problem…
I did go through the sollution given below… Great!!
but my problem did not get solved though… I request you to help me as soon as possible because I am in need of using this particular software in particular… It is highly appreciated…

-Ravi

Microsoft Windows [Version 6.1.7601]
Copyright © 2009 Microsoft Corporation. All rights reserved.

C:\Users\Ashmeet>cd AppData\Local\Programs\Python\Python35-32\Scripts

C:\Users\Ashmeet\AppData\Local\Programs\Python\Python35-32\Scripts>jupyter-noteb
ook.exe
Traceback (most recent call last):
File “c:\users\ashmeet\appdata\local\programs\python\python35-32\lib\runpy.py”
, line 170, in run_module_as_main
main”, mod_spec)
File “c:\users\ashmeet\appdata\local\programs\python\python35-32\lib\runpy.py”
, line 85, in run_code
exec(code, run_globals)
File "C:\Users\Ashmeet\AppData\Local\Programs\Python\Python35-32\Scripts\jupyt
er-notebook.exe_main
.py", line 4, in
File "c:\users\ashmeet\appdata\local\programs\python\python35-32\lib\site-pack
ages\notebook_init
.py", line 25, in
from .nbextensions import install_nbextension
File “c:\users\ashmeet\appdata\local\programs\python\python35-32\lib\site-pack
ages\notebook\nbextensions.py”, line 605, in
from .extensions import (
File “c:\users\ashmeet\appdata\local\programs\python\python35-32\lib\site-pack
ages\notebook\extensions.py”, line 8, in
from tornado.log import LogFormatter
File “c:\users\ashmeet\appdata\local\programs\python\python35-32\lib\site-pack
ages\tornado\log.py”, line 34, in
from tornado.escape import _unicode
File “c:\users\ashmeet\appdata\local\programs\python\python35-32\lib\site-pack
ages\tornado\escape.py”, line 27, in
from tornado.util import unicode_type
File “c:\users\ashmeet\appdata\local\programs\python\python35-32\lib\site-pack
ages\tornado\util.py”, line 21, in
from typing import (
ImportError: cannot import name ‘Type’

C:\Users\Ashmeet\AppData\Local\Programs\Python\Python35-32\Scripts>

cant open juypter