Skip to content

Importing Sisyphus within IPython fails #275

Description

@albertz

(I wanted to import actually sth from i6_experiments, but that imported sisyphus.)

...

File ~/setups/2025-08-aed-large/tools/sisyphus/sisyphus/__init__.py:4
      2 from .job import Job
      3 from .task import Task
----> 4 import sisyphus.toolkit as tk
      5 from sisyphus.loader import RecipeFinder
      7 # setup_path and gs will be removed in the future since they are both accessible via tk

File ~/setups/2025-08-aed-large/tools/sisyphus/sisyphus/toolkit.py:56
     54 import sisyphus.block
     55 from sisyphus.block import block, sub_block, set_root_block
---> 56 from sisyphus.async_workflow import async_run, async_gather, async_context
     57 from sisyphus.delayed_ops import Delayed
     58 from sisyphus import cleaner

File ~/setups/2025-08-aed-large/tools/sisyphus/sisyphus/async_workflow.py:2
      1 from sisyphus import graph
----> 2 from sisyphus.loader import config_manager
      3 from sisyphus.tools import extract_paths
      4 from typing import Any

File ~/setups/2025-08-aed-large/tools/sisyphus/sisyphus/loader.py:260
    255     @classmethod
    256     def invalidate_caches(cls):
    257         PathFinder.invalidate_caches()
--> 260 config_manager = ConfigManager()

File ~/setups/2025-08-aed-large/tools/sisyphus/sisyphus/loader.py:18, in ConfigManager.__init__(self)
     16 self._config_readers = []
     17 self._waiting_reader = {}
---> 18 self.loop = asyncio.get_event_loop()
     19 self._reader_threads = defaultdict(dict)
     20 self._current_config = None

File /usr/lib64/python3.12/asyncio/events.py:702, in BaseDefaultEventLoopPolicy.get_event_loop(self)
    699     self.set_event_loop(self.new_event_loop())
    701 if self._local._loop is None:
--> 702     raise RuntimeError('There is no current event loop in thread %r.'
    703                        % threading.current_thread().name)
    705 return self._local._loop

RuntimeError: There is no current event loop in thread 'MainThread'.

I think importing should always work, no matter the environment.

This is with Python 3.12.9 and IPython 9.6.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