# Failed to get session data

**URL:** <https://community.brain-map.org/t/failed-to-get-session-data/503>\
**Category:** Technical\
**Tags:** brain-observatory-visual-coding, allensdk\
**Created:** [April 3, 2020, 3:00pm UTC](https://community.brain-map.org/t/failed-to-get-session-data/503 "2020-04-03T15:00:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![chiyu1203](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/chiyu1203/32/158_2.png) [@chiyu1203](https://community.brain-map.org/u/chiyu1203)\
**Post date:** [April 3, 2020, 3:00pm UTC](https://community.brain-map.org/t/failed-to-get-session-data/503/1 "2020-04-03T15:00:51Z")

</div>

Hi everyone,  
I ran the Jupyter Notebook’s code to access neuropixels visual coding data.  
After typing the following comments to get session data,

import os  
import numpy as np  
import pandas as pd  
import matplotlib.pyplot as plt  
from allensdk.brain\_observatory.ecephys.ecephys\_project\_cache import EcephysProjectCache  
data\_directory=’/Users/cylee/Documents/AllenSDK-master/example\_ecephys\_project’  
manifest\_path=os.path.join(data\_directory,“manifest.json”)  
cache= EcephysProjectCache.from\_warehouse(manifest=manifest\_path)  
sessions=cache.get\_session\_table()  
filtered\_sessions = sessions[(sessions.sex == ‘M’) &   
…: (sessions.full\_genotype.str.find(‘Sst’) \> -1) &   
…: (sessions.session\_type == ‘brain\_observatory\_1.1’) &   
…: ([‘VISl’ in acronyms for acronyms in  
…: sessions.ecephys\_structure\_acronyms])]  
probes=cache.get\_probes()  
channels=cache.get\_channels()  
units=cache.get\_units()  
analysis\_metrics1 = cache.get\_unit\_analysis\_metrics\_by\_session\_type(‘brain\_observatory\_1.1’)  
analysis\_metrics2 = cache.get\_unit\_analysis\_metrics\_by\_session\_type(‘functional\_connectivity’)  
all\_metrics = pd.concat([analysis\_metrics1, analysis\_metrics2], sort=False)  
session = cache.get\_session\_data(filtered\_sessions.index.values[0])

I bumped into error on my mac, 8GB 1600 MHz DDR3, saying “raise asyncio.TimeoutError from None concurrent.futures.\_base.TimeoutError”

I assumed this is because my mac does not have enough disk space to store that session data locally. Then I moved to a PC with 350 GB free and 16 RAM GB and ran the same code on jupyter notebook. However I bumped into another error saying RuntimeError: This event loop is already running

 ![Screen Shot 2020-04-03 at 12.21.25](https://canada1.discourse-cdn.com/flex027/uploads/brainobservatory/original/1X/6b995db5fb77eaf1b325cf91ec27de92db0f1438.png)

Does anyone know what issue I am facing and what I should do to fix this issue?

Best Regards

Chi-Yu

---

<div class="post-metadata">

**Author:** ![wayne](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/wayne/32/16_2.png) [@wayne](https://community.brain-map.org/u/wayne)\
**Post date:** [April 6, 2020, 8:23pm UTC](https://community.brain-map.org/t/failed-to-get-session-data/503/2 "2020-04-06T20:23:14Z")

</div>

> [@chiyu1203](#):
>
> EcephysProjectCache

I have been able to reproduce the error. We will look into this

---

<div class="post-metadata">

**Author:** ![noahpettit](https://avatars.discourse-cdn.com/v4/letter/n/ecccb3/32.png) [@noahpettit](https://community.brain-map.org/u/noahpettit)\
**Post date:** [April 6, 2020, 8:49pm UTC](https://community.brain-map.org/t/failed-to-get-session-data/503/3 "2020-04-06T20:49:12Z")

</div>

Hi,

I too am having the same problem (windows 10), always when calling `cache.get_session_data(session_id)`

I’ve tried this on session ids 756029989 and 791319847 using the exact code posted in the example notebooks and I get the same error each time - “runtime error: this event loop is already running”

in the local cache directory, session folders are created but are empty.

happy to provide more info / do additional testing if that would be helpful.

Thanks,

Noah

---

<div class="post-metadata">

**Author:** ![wayne](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/wayne/32/16_2.png) [@wayne](https://community.brain-map.org/u/wayne)\
**Post date:** [April 6, 2020, 11:07pm UTC](https://community.brain-map.org/t/failed-to-get-session-data/503/4 "2020-04-06T23:07:31Z")

</div>

Looks like the problem here is most likely that these data files are very large, and at “typical” Internet download speeds, the time that it takes to get the files is greater than an internal default timeout limit. In the long-term, we will increase the default timeout value and make a change to AllenSDK to make it easier to pass in your own timeout value. In the short-term, here is a code snippet that will show how you can set your own timeout value so that the files will have a chance to download. In this example, I have set the value to 50 minutes; you can change that value as needed for your system.

```
import os
from allensdk.brain_observatory.ecephys.ecephys_project_cache import EcephysProjectCache
from allensdk.brain_observatory.ecephys.ecephys_project_api import EcephysProjectWarehouseApi
from allensdk.brain_observatory.ecephys.ecephys_project_api.rma_engine import RmaEngine
data_directory = 'C:/allensdk_data'
manifest_path = os.path.join(data_directory, "manifest.json")
session_id = 721123822
cache = EcephysProjectCache(
  manifest=manifest_path,
  fetch_api=EcephysProjectWarehouseApi(RmaEngine(
    scheme="http",
    host="api.brain-map.org",
    timeout=50 * 60 #set timeout to 50 minutes
  ))
)
session = cache.get_session_data(session_id)
```

---

<div class="post-metadata">

**Author:** ![noahpettit](https://avatars.discourse-cdn.com/v4/letter/n/ecccb3/32.png) [@noahpettit](https://community.brain-map.org/u/noahpettit)\
**Post date:** [April 9, 2020, 4:12pm UTC](https://community.brain-map.org/t/failed-to-get-session-data/503/5 "2020-04-09T16:12:47Z")

</div>

Thanks! This worked for me.

---

<div class="post-metadata">

**Author:** ![chiyu1203](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/chiyu1203/32/158_2.png) [@chiyu1203](https://community.brain-map.org/u/chiyu1203)\
**Post date:** [April 11, 2020, 6:34am UTC](https://community.brain-map.org/t/failed-to-get-session-data/503/6 "2020-04-11T06:34:26Z")

</div>

Thank you! this worked for me too
