trustimaging / stride

A modelling and optimisation framework for medical ultrasound
https://www.stride.codes
GNU Affero General Public License v3.0
89 stars 16 forks source link

07_script_running has error #70

Closed elcolie closed 4 months ago

elcolie commented 10 months ago

I can run tutorial 1-6 without any problem. Until No.7

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[4], line 2
      1 if __name__ == '__main__':
----> 2     mosaic.run(main)

File ~/anaconda3/lib/python3.10/site-packages/mosaic/__init__.py:275, in run(main, *args, **kwargs)
    272                         key, value = line.strip().split('=')
    273                         kwargs[key] = kwargs.get(key, eval(value))
--> 275 init(*args, **kwargs)
    277 loop = _runtime.get_event_loop()
    279 async def _main():

File ~/anaconda3/lib/python3.10/site-packages/mosaic/__init__.py:134, in init(runtime_type, runtime_indices, address, port, parent_id, parent_address, parent_port, monitor_address, monitor_port, pubsub_port, num_workers, num_threads, mode, reuse_head, monitor_strategy, log_level, profile, node_list, asyncio_loop, dump_init, wait, **kwargs)
    130     raise KeyError('Endpoint type is not recognised, available types are head, '
    131                    'monitor, node and worker')
    133 loop = _runtime.get_event_loop(asyncio_loop=asyncio_loop)
--> 134 result = loop.run(_runtime.init, **runtime_config)
    136 if profile:
    137     profiler.start()

File ~/anaconda3/lib/python3.10/site-packages/mosaic/utils/event_loop.py:291, in EventLoop.run(self, coro, *args, **kwargs)
    288     coro = awaitify(coro)
    290 if not self._loop.is_running():
--> 291     return self._loop.run_until_complete(coro(*args, **kwargs))
    293 future = self._loop.create_task(coro(*args, **kwargs))
    295 self._futures.add(future)

File ~/anaconda3/lib/python3.10/site-packages/uvloop/loop.pyx:1511, in uvloop.loop.Loop.run_until_complete()

File ~/anaconda3/lib/python3.10/site-packages/uvloop/loop.pyx:1504, in uvloop.loop.Loop.run_until_complete()

File ~/anaconda3/lib/python3.10/site-packages/uvloop/loop.pyx:1377, in uvloop.loop.Loop.run_forever()

File ~/anaconda3/lib/python3.10/site-packages/uvloop/loop.pyx:522, in uvloop.loop.Loop._run()

RuntimeError: Cannot run the event loop while another loop is running

How to fix this?

ccuetom commented 10 months ago

Could you give us some more context? How are you running the script? How is your conda environment set up?

elcolie commented 10 months ago

Environment: Python 3.10.9 Linux bugger 6.4.0-4-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.4.13-1 (2023-08-31) x86_64 GNU/Linux Step to reproduce:

  1. pip install .
  2. jupyter notebook --ip 0.0.0.0 --no-browser --allow-root
  3. Run 7th file by jupyter notebook
ccuetom commented 4 months ago

@elcolie have you installed stride using the conda environment?

elcolie commented 4 months ago

@ccuetom I am barely recall this issue now. I think I haven't installed stride.