jupyter / jupyter_core

Core Jupyter functionality
https://jupyter-core.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
196 stars 181 forks source link

0.5.6 causes "This event loop is already running" Error #383

Closed a3626a closed 11 months ago

a3626a commented 11 months ago

This new 5.6 version causes this error : (https://github.com/jupyter/jupyter_core/pull/381)

notebook Traceback (most recent call last):
notebook   File "/usr/local/bin/jupyter-labhub", line 8, in <module>
notebook     sys.exit(main())
notebook   File "/usr/local/lib/python3.10/site-packages/jupyterlab/labhubapp.py", line 41, in main
notebook     return SingleUserLabApp.launch_instance(argv)
notebook   File "/usr/local/lib/python3.10/site-packages/jupyter_core/application.py", line 307, in launch_instance
notebook     loop.run_until_complete(coro)
notebook   File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
notebook     return future.result()
notebook   File "/usr/local/lib/python3.10/site-packages/jupyter_core/application.py", line 292, in _async_launch_instance
notebook     app.initialize(argv)
notebook   File "/usr/local/lib/python3.10/site-packages/jupyterhub/singleuser/mixins.py", line 972, in initialize
notebook     result = super().initialize(*args, **kwargs)
notebook   File "/usr/local/lib/python3.10/site-packages/jupyterhub/singleuser/mixins.py", line 643, in initialize
notebook     super().initialize(argv)
notebook   File "/usr/local/lib/python3.10/site-packages/traitlets/config/application.py", line 118, in inner
notebook     return method(app, *args, **kwargs)
notebook   File "/usr/local/lib/python3.10/site-packages/jupyter_server/serverapp.py", line 2610, in initialize
notebook     self.init_httpserver()
notebook   File "/usr/local/lib/python3.10/site-packages/jupyterhub/singleuser/mixins.py", line 668, in init_httpserver
notebook     self.io_loop.run_sync(super().init_httpserver)
notebook   File "/usr/local/lib/python3.10/site-packages/tornado/ioloop.py", line 533, in run_sync
notebook     self.start()
notebook   File "/usr/local/lib/python3.10/site-packages/tornado/platform/asyncio.py", line 205, in start
notebook     self.asyncio_loop.run_forever()
notebook   File "/usr/local/lib/python3.10/asyncio/base_events.py", line 592, in run_forever
notebook     self._check_running()
notebook   File "/usr/local/lib/python3.10/asyncio/base_events.py", line 584, in _check_running
notebook     raise RuntimeError('This event loop is already running')

I'm using z2jh. These are installed pacakges

ColabTurtlePlus-2.0.1
Mako-1.3.0
MarkupSafe-2.1.3
SQLAlchemy-2.0.23
Send2Trash-1.8.2
absl-py-2.0.0
aiohttp-3.9.1
aiosignal-1.3.1
alembic-1.13.1
anyio-4.2.0
argon2-cffi-23.1.0
argon2-cffi-bindings-21.2.0
arrow-1.3.0
asttokens-2.4.1
astunparse-1.6.3
async-generator-1.10
async-lru-2.0.4
async-timeout-4.0.3
attrs-23.1.0
autobahn-23.6.2
babel-2.14.0
beautifulsoup4-4.12.2
bleach-6.1.0
branca-0.7.0
cachetools-5.3.2
certifi-2023.11.17
certipy-0.1.3
cffi-1.16.0
charset-normalizer-3.3.2
comm-0.2.0
cryptography-41.0.7
cycler-0.12.1
debugpy-1.8.0
decorator-5.1.1
defusedxml-0.7.1
entrypoints-0.4
exceptiongroup-1.2.0
executing-2.0.1
fastjsonschema-2.19.0
flatbuffers-23.5.26
folium-0.15.1
fonttools-4.47.0
fqdn-1.5.1
frozenlist-1.4.1
gast-0.4.0
google-auth-2.25.2
google-auth-oauthlib-1.0.0
google-pasta-0.2.0
greenlet-3.0.3
grpcio-1.60.0
h5py-3.10.0
hyperlink-21.0.0
idna-3.6
ipykernel-6.28.0
ipython-8.19.0
ipython-genutils-0.2.0
ipywidgets-8.1.1
isoduration-20.11.0
jedi-0.19.1
jinja2-3.1.2
joblib-1.3.2
json5-0.9.14
jsonpointer-2.4
jsonschema-4.20.0
jsonschema-specifications-2023.12.1
jupyter-1.0.0
jupyter-archive-3.4.0
jupyter-client-7.4.9
jupyter-console-6.6.3
jupyter-core-5.6.0
jupyter-events-0.9.0
jupyter-lsp-2.2.1
jupyter-server-2.12.1
jupyter-server-proxy-4.1.0
jupyter-server-terminals-0.5.1
jupyter-telemetry-0.1.0
jupyterhub-3.0.0
jupyterlab-4.0.8
jupyterlab-language-pack-ko-KR-4.0.post6
jupyterlab-pygments-0.3.0
jupyterlab-server-2.25.2
jupyterlab-vpython-3.1.6
jupyterlab-widgets-3.0.9
keras-2.13.1
kiwisolver-1.4.5
libclang-16.0.6
llvmlite-0.41.1
markdown-3.5.1
matplotlib-3.5.2
matplotlib-inline-0.1.6
mistune-3.0.2
multidict-6.0.4
nbclassic-1.0.0
nbclient-0.9.0
nbconvert-7.13.1
nbformat-5.9.2
nest-asyncio-1.5.8
notebook-6.5.6
notebook-shim-0.2.3
numba-0.58.1
numpy-1.22.4
oauthlib-3.2.2
opencv-python-headless-4.6.0.66
opt-einsum-3.3.0
overrides-7.4.0
packaging-23.2
pamela-1.1.0
pandas-2.0.2
pandocfilters-1.5.0
parso-0.8.3
pexpect-4.9.0
pillow-9.1.1
platformdirs-4.1.0
prometheus-client-0.19.0
prompt-toolkit-3.0.43
protobuf-4.25.1
psutil-5.9.7
ptyprocess-0.7.0
pure-eval-0.2.2
pyasn1-0.5.1
pyasn1-modules-0.3.0
pycparser-2.21
pygments-2.17.2
pynndescent-0.5.11
pyopenssl-23.3.0
pyparsing-3.1.1
python-dateutil-2.8.2
python-json-logger-2.0.7
pytz-2023.3.post1
pyyaml-6.0.1
pyzmq-24.0.1
qtconsole-5.5.1
qtpy-2.4.1
referencing-0.32.0
requests-2.31.0
requests-oauthlib-1.3.1
rfc3339-validator-0.1.4
rfc3986-validator-0.1.1
rpds-py-0.15.2
rsa-4.9
ruamel.yaml-0.18.5
ruamel.yaml.clib-0.2.8
scikit-learn-1.1.1
scipy-1.11.4
seaborn-0.13.0
sentry-sdk-1.30.0
simpervisor-1.0.0
six-1.16.0
sniffio-1.3.0
soupsieve-2.5
stack-data-0.6.3
tensorboard-2.13.0
tensorboard-data-server-0.7.2
tensorflow-cpu-2.13.1
tensorflow-estimator-2.13.0
tensorflow-io-gcs-filesystem-0.35.0
termcolor-2.4.0
terminado-0.18.0
threadpoolctl-3.2.0
tinycss2-1.2.1
tomli-2.0.1
tornado-6.4
tqdm-4.66.1
traitlets-5.14.0
txaio-23.1.1
types-python-dateutil-2.8.19.14
typing-extensions-4.5.0
tzdata-2023.3
umap-learn-0.5.5
uri-template-1.3.0
urllib3-2.1.0
vpython-7.6.4
wcwidth-0.2.12
webcolors-1.13
webencodings-0.5.1
websocket-client-1.7.0
werkzeug-3.0.1
widgetsnbextension-4.0.9
wrapt-1.16.0
xyzservices-2023.10.1
yarl-1.9.4
tornaria commented 11 months ago

juyter console is also failing with jupyter core 5.6.0:

$ jupyter console
[IPKernelApp] WARNING | debugpy_stream undefined, debugging will not be enabled
Jupyter console 6.6.3

Python 3.12.1 (main, Dec 26 2023, 18:42:33) [GCC 12.2.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.19.0 -- An enhanced Interactive Python. Type '?' for help.
Traceback (most recent call last):
  File "/usr/bin/jupyter-console", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.12/site-packages/jupyter_core/application.py", line 307, in launch_instance
    loop.run_until_complete(coro)
  File "/usr/lib/python3.12/asyncio/base_events.py", line 684, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/jupyter_core/application.py", line 294, in _async_launch_instance
    app.start()
  File "/usr/lib/python3.12/site-packages/jupyter_console/app.py", line 148, in start
    self.shell.mainloop()
  File "/usr/lib/python3.12/site-packages/jupyter_console/ptshell.py", line 676, in mainloop
    asyncio.run(self._main_task())
  File "/usr/lib/python3.12/asyncio/runners.py", line 190, 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

Reverting to jupyter core 5.5.1 makes this issue go away.

blink1073 commented 11 months ago

I've yanked this release