yjmantilla / sovabids

A python package for the automatic conversion of EEG datasets to the BIDS standard, with a focus on making the most out of metadata.
https://sovabids.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
9 stars 3 forks source link

RuntimeError: can't register atexit after shutdown #46

Closed aswinnarayanan closed 2 years ago

aswinnarayanan commented 2 years ago

I followed the advanced installation on miniconda

git clone https://github.com/yjmantilla/sovabids.git
cd sovabids
pip install -r requirements-dev.txt

python -c 'from sovabids.datasets import lemon_prepare; lemon_prepare()'

python front/app/app.py gives the following error

* Serving Flask app 'app' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/home/uqanaray/miniconda3/envs/sovabids/lib/python3.9/threading.py", line 973, in _bootstrap_inner
    self.run()
  File "/home/uqanaray/miniconda3/envs/sovabids/lib/python3.9/threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "/home/uqanaray/workspace/sovabids/sovabids/sovarpc.py", line 286, in main
    import uvicorn
  File "/home/uqanaray/miniconda3/envs/sovabids/lib/python3.9/site-packages/uvicorn/__init__.py", line 1, in <module>
    from uvicorn.config import Config
  File "/home/uqanaray/miniconda3/envs/sovabids/lib/python3.9/site-packages/uvicorn/config.py", line 36, in <module>
    from uvicorn.middleware.wsgi import WSGIMiddleware
  File "/home/uqanaray/miniconda3/envs/sovabids/lib/python3.9/site-packages/uvicorn/middleware/wsgi.py", line 85, in <module>
    class WSGIResponder:
  File "/home/uqanaray/miniconda3/envs/sovabids/lib/python3.9/site-packages/uvicorn/middleware/wsgi.py", line 89, in WSGIResponder
    executor: concurrent.futures.ThreadPoolExecutor,
  File "/home/uqanaray/miniconda3/envs/sovabids/lib/python3.9/concurrent/futures/__init__.py", line 49, in __getattr__
    from .thread import ThreadPoolExecutor as te
  File "/home/uqanaray/miniconda3/envs/sovabids/lib/python3.9/concurrent/futures/thread.py", line 37, in <module>
    threading._register_atexit(_python_exit)
  File "/home/uqanaray/miniconda3/envs/sovabids/lib/python3.9/threading.py", line 1394, in _register_atexit
    raise RuntimeError("can't register atexit after shutdown")
RuntimeError: can't register atexit after shutdown
civier commented 2 years ago

For me the new version works fine, but notice that I did the "pip install -r requirements-dev.txt" already for an older version of SOVABIDS, so no python packages had to be installed.

@aswinnarayanan what OS do you use?

aswinnarayanan commented 2 years ago

I tried it on Windows and WSL-ubuntu 20.04

yjmantilla commented 2 years ago

Im almost sure it must be this https://stackoverflow.com/questions/65467329/server-in-a-thread-python3-9-0aiohttp-runtimeerror-cant-register-atexit-a ,

it is missing a thread.join after the start

yjmantilla commented 2 years ago

This probably hints I should do a CI test for the GUI, Im sure that maybe with selenium I could infact simulate the procedure. It may be quite cumbersome with GUI changes.

yjmantilla commented 2 years ago

The fix I applied in v0.1a1+26.gc6dde77.dirty (or just the latest version) should fix this

aswinnarayanan commented 2 years ago

That's fixed it