Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rpigott opened this issue Dec 27, 2023 · 6 comments

Comments

@rpigott
Copy link

rpigott commented Dec 27, 2023

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
@VelocityREST
Copy link

VelocityREST commented Dec 28, 2023

I got the exact same issue, I use Arch as well.
EDIT: I just have recalled that I have updated jupyter yesterday or today morning. That change must have introduced this bug.

@natsukium
Copy link

I guess this change in jupyter-core causes this problem.
For now, the workaround is to set jupyter_core == 5.5.1.

@VelocityREST
Copy link

jupyter_core == 5.5.1

Do you mean to downgrade the package manually using the package manger? Because I searched for an option to use a specific jupyter_core version and I couldn't find a away

@natsukium
Copy link

Do you mean to downgrade the package manually using the package manger?

Yes

@ccordoba12
Copy link

This is a the problem with Arch: it's maintainers sometimes update packages too quickly and then you end up with issues like this.

Since that version was yanked on PyPI, please report that in the Arch bug tracker so they revert to 5.5.1.

@rpigott
Copy link
Author

rpigott commented Jan 8, 2024

This appears to be resolved by jupyter_core 5.7.1. Thanks everyone.

@rpigott rpigott closed this as completed Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants