Skip to content

bwm_usage_notebook.ipynb fails on colab #176

Description

@asmacdo

cell 18 fails for a known reason

# Workaround: brainglobe-atlasapi 2.3.1 fetches its atlas-version manifest
# from a Colab-unfriendly S3 endpoint that returns 403 for some Colab IPs.
# Pre-seed the cache so BrainGlobeAtlas() below can find a version manifest
# even when the live fetch fails. See https://github.com/brainglobe/brainglobe-atlasapi/issues/738

However it seems that the fallback doesnt work either.

Full output

Could not fetch the latest atlas versions: 403
Using the last cached version from /root/.brainglobe/last_versions.conf
Could not fetch the latest atlas versions: 403
Using the last cached version from /root/.brainglobe/last_versions.conf
Could not fetch the latest atlas versions: 403
Using the last cached version from /root/.brainglobe/last_versions.conf
Could not fetch the latest atlas versions: 403
Using the last cached version from /root/.brainglobe/last_versions.conf

Downloading... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0% • 0/93 bytes • speed: ? • ETA: -:--:--

---------------------------------------------------------------------------

ReadError                                 Traceback (most recent call last)

[/usr/local/lib/python3.12/dist-packages/brainglobe_atlasapi/bg_atlas.py](https://localhost:8080/#) in download_extract_file(self)
    203         try:
--> 204             tar = tarfile.open(destination_path)
    205             tar.extractall(path=self.brainglobe_dir)

3 frames

ReadError: file could not be opened successfully:
- method gz: ReadError('not a gzip file')
- method bz2: ReadError('not a bzip2 file')
- method xz: ReadError('not an lzma file')
- method tar: ReadError('truncated header')


The above exception was the direct cause of the following exception:

ReadError                                 Traceback (most recent call last)

[/usr/local/lib/python3.12/dist-packages/brainglobe_atlasapi/bg_atlas.py](https://localhost:8080/#) in download_extract_file(self)
    208             # Delete corrupted file so we can try again later
    209             destination_path.unlink(missing_ok=True)
--> 210             raise tarfile.ReadError(
    211                 f"Atlas download was interrupted or corrupted. "
    212                 f"Please try again. Details: {e}"

ReadError: Atlas download was interrupted or corrupted. Please try again. Details: file could not be opened successfully:
- method gz: ReadError('not a gzip file')
- method bz2: ReadError('not a bzip2 file')
- method xz: ReadError('not an lzma file')
- method tar: ReadError('truncated header')

I tried clearing the cache, and retrying the download but this error seems to persist.

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