-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
We should make sure that ipylab
is only instantiated in notebook environments, I think.
Essentially, the whole nbproject should only be instantiated in a notebook environment.
Otherwise people will who import nbproject from within scripts will run into unpredictable issues like the following:
2022-11-13 23:08:04,749:INFO - RuntimeError: There is no current event loop in thread 'ThreadPoolExecutor-0_0'.
Traceback (most recent call last):
File "/opt/anaconda3/envs/base1/bin/redun", line 11, in <module>
client.execute()
File "/opt/anaconda3/envs/base1/lib/python3.9/site-packages/redun/cli.py", line 1037, in execute
return args.func(args, extra_args, argv)
File "/opt/anaconda3/envs/base1/lib/python3.9/site-packages/redun/cli.py", line 1648, in run_command
result = scheduler.run(
File "/opt/anaconda3/envs/base1/lib/python3.9/site-packages/redun/scheduler.py", line 928, in run
raise result.error
File "/opt/anaconda3/envs/base1/lib/python3.9/site-packages/redun/executors/local.py", line 148, in on_done
self._scheduler.done_job(job, future.result())
File "/opt/anaconda3/envs/base1/lib/python3.9/concurrent/futures/_base.py", line 439, in result
return self.__get_result()
File "/opt/anaconda3/envs/base1/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
raise self._exception
File "/opt/anaconda3/envs/base1/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/opt/anaconda3/envs/base1/lib/python3.9/site-packages/redun/executors/local.py", line 27, in exec_task
return task.func(*args, **kwargs)
File "/Users/falexwolf/repos/redun-lamin-fasta/docs/guide/workflow.py", line 64, in main
import lamindb as ln
File "/Users/falexwolf/repos/lamindb/lamindb/__init__.py", line 66, in <module>
from . import _check_versions # executes checks during import
File "/Users/falexwolf/repos/lamindb/lamindb/_check_versions.py", line 8, in <module>
from nbproject import __version__ as nbproject_v
File "/Users/falexwolf/repos/nbproject/nbproject/__init__.py", line 32, in <module>
_init_frontend()
File "/Users/falexwolf/repos/nbproject/nbproject/dev/_jupyter_lab_commands.py", line 12, in _init_frontend
app = JupyterFrontEnd()
File "/opt/anaconda3/envs/base1/lib/python3.9/site-packages/ipylab/jupyterfrontend.py", line 37, in __init__
self._ready_event = asyncio.Event()
File "/opt/anaconda3/envs/base1/lib/python3.9/asyncio/locks.py", line 177, in __init__
self._loop = events.get_event_loop()
File "/opt/anaconda3/envs/base1/lib/python3.9/asyncio/events.py", line 642, in get_event_loop
raise RuntimeError('There is no current event loop in thread %r.'
RuntimeError: There is no current event loop in thread 'ThreadPoolExecutor-0_0'.
Metadata
Metadata
Assignees
Labels
No labels