async download from Zenodo fails when run from within Jupyter
Dr. Noor, I installed the most recent version of equilibrator in a new environment using python 3.8. When I run ComponentContribution I get the following error
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
~/anaconda3/envs/cobra/lib/python3.8/site-packages/tenacity/__init__.py in call(self, fn, *args, **kwargs)
411 try:
--> 412 result = fn(*args, **kwargs)
413 except BaseException:
~/anaconda3/envs/cobra/lib/python3.8/site-packages/equilibrator_cache/zenodo.py in get_zenodo_files(zenodo_doi)
121 asyncio.set_event_loop(loop)
--> 122 return loop.run_until_complete(_get_zenodo_files(zenodo_doi))
123
~/anaconda3/envs/cobra/lib/python3.8/asyncio/base_events.py in run_until_complete(self, future)
591 self._check_closed()
--> 592 self._check_running()
593
~/anaconda3/envs/cobra/lib/python3.8/asyncio/base_events.py in _check_running(self)
553 if events._get_running_loop() is not None:
--> 554 raise RuntimeError(
555 'Cannot run the event loop while another loop is running')
RuntimeError: Cannot run the event loop while another loop is running
The above exception was the direct cause of the following exception:
RetryError Traceback (most recent call last)
<ipython-input-11-26804c7852cc> in <module>
----> 1 cc = eqtr.ComponentContribution()
~/anaconda3/envs/cobra/lib/python3.8/site-packages/equilibrator_api/component_contribution.py in __init__(self, rmse_inf, ccache, predictor)
145 ), "rmse_inf must be in units of kJ/mol (or equivalent)"
146
--> 147 self.ccache = ccache or create_compound_cache_from_zenodo()
148
149 if predictor is None:
~/anaconda3/envs/cobra/lib/python3.8/site-packages/equilibrator_cache/api.py in create_compound_cache_from_zenodo(doi, fname)
72 """
73
---> 74 path = get_cached_filepath(doi, fname)
75 return create_compound_cache_from_sqlite_file(path)
~/anaconda3/envs/cobra/lib/python3.8/site-packages/equilibrator_cache/zenodo.py in get_cached_filepath(zenodo_doi, zenodo_fname)
200
201 logging.info("Fetching a new version of the Compound Cache from Zenodo")
--> 202 dataframe_dict = get_zenodo_files(zenodo_doi)
203 cache_fname.write_bytes(dataframe_dict[zenodo_fname].getbuffer())
204
~/anaconda3/envs/cobra/lib/python3.8/site-packages/tenacity/__init__.py in wrapped_f(*args, **kw)
327 @_utils.wraps(f)
328 def wrapped_f(*args, **kw):
--> 329 return self.call(f, *args, **kw)
330
331 def retry_with(*args, **kwargs):
~/anaconda3/envs/cobra/lib/python3.8/site-packages/tenacity/__init__.py in call(self, fn, *args, **kwargs)
407 retry_object=self, fn=fn, args=args, kwargs=kwargs)
408 while True:
--> 409 do = self.iter(retry_state=retry_state)
410 if isinstance(do, DoAttempt):
411 try:
~/anaconda3/envs/cobra/lib/python3.8/site-packages/tenacity/__init__.py in iter(self, retry_state)
367 if self.reraise:
368 raise retry_exc.reraise()
--> 369 six.raise_from(retry_exc, fut.exception())
370
371 if self.wait:
~/anaconda3/envs/cobra/lib/python3.8/site-packages/six.py in raise_from(value, from_value)
RetryError: RetryError[<Future at 0x7fdddfacdac0 state=finished raised RuntimeError>]
At first I thought it could be a problem with the database built by quilt for the older equilibrator version, so I went ahead and removed the corresponding files but that did nothing. Any help will be greatly appreciated
Edited by Moritz E. Beber