Skip to content

Unable to start jupyter console: "RuntimeError: asyncio.run() cannot be called from a running event loop" #298

Closed
@rpigott

Description

@rpigott

I'm not able to start jupyter console. Unfortunately, I use it too infrequently to know precisely when it started failing. On startup, I get the following python traceback, which is the same regardless of the kernel chosen:

$ jupyter console --kernel=julia-1.9 
Starting kernel event loops.
Jupyter console 6.6.3

Julia: A fresh approach to technical computing.Traceback (most recent call last):
  File "/usr/bin/jupyter-console", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.11/site-packages/jupyter_core/application.py", line 307, in launch_instance
    loop.run_until_complete(coro)
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/jupyter_core/application.py", line 294, in _async_launch_instance
    app.start()
  File "/usr/lib/python3.11/site-packages/jupyter_console/app.py", line 148, in start
    self.shell.mainloop()
  File "/usr/lib/python3.11/site-packages/jupyter_console/ptshell.py", line 676, in mainloop
    asyncio.run(self._main_task())
  File "/usr/lib/python3.11/asyncio/runners.py", line 186, in run
    raise RuntimeError(
RuntimeError: asyncio.run() cannot be called from a running event loop
sys:1: RuntimeWarning: coroutine 'ZMQTerminalInteractiveShell._main_task' was never awaited

I'm using Arch Linux, and the following packages:

$ pacman -Q python jupyter-console
python 3.11.6-1
jupyter-console 6.6.3-2
$ jupyter --version
Selected Jupyter core packages...
IPython          : 8.19.0
ipykernel        : 6.28.0
ipywidgets       : not installed
jupyter_client   : 8.6.0
jupyter_core     : 5.6.0
jupyter_server   : 2.12.1
jupyterlab       : 4.0.9
nbclient         : 0.9.0
nbconvert        : 7.13.1
nbformat         : 5.9.2
notebook         : 7.0.6
qtconsole        : not installed
traitlets        : 5.14.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions