Fastai V2 with Google Colab

I have been using Fastai v2, development version, in Google Colab for several months. 2 days ago, I moved to the released version of Fastai V2. I have encountered two problems:

  1. The following statement fails with a 'No module named 'fastai.vision.all"
    from fastai.vision.all import *

  2. The following statement also fails:
    ds_source = untar_data(URLs.PASCAL_2007)

    AssertionError Traceback (most recent call last)
    in ()
    ----> 1 ds_source = untar_data(URLs.PASCAL_2007)

    /usr/local/lib/python3.6/dist-packages/fastai/datasets.py in untar_data(url, fname, dest, data, force_download, verbose)
    233 fname = download_data(url, fname=fname, data=data)
    234 if url in _checks:
    –> 235 assert _check_file(fname) == _checks[url], f"Downloaded file {fname} does not match checksum expected! Remove that file from {Config().data_archive_path()} and try your code again."
    236 if verbose: print(’.tgz file downloaded. Extracting the contents…’)
    237 tarfile.open(fname, ‘r:gz’).extractall(dest.parent)

    AssertionError: Downloaded file /root/.fastai/data/pascal_2007.tgz does not match checksum expected! Remove that file from /root/.fastai/data and try your code again.

I have waited 48 hours before re-starting the notebook in the hope the folders would flush out. I also tried to fix the problem by renaming the existing folder containing pascal_2007.tgz and creating a new folder, but the problem persists in all cases.

1 Like

Did you make sure to upgrade the version? Colab comes preinstalled with the old fastai version so just doing pip install fastai won’t do anything. You need a --upgrade along with it

1 Like

Thank you for responding so quickly. I checked the Fastai version with “!pip show fastai”
the results is:

Name: fastai Version: 1.0.61 Summary: fastai makes deep learning with PyTorch faster, more accurate, and easier Home-page: https://github.com/fastai/fastai Author: Jeremy Howard Author-email: [info@fast.ai](mailto:info@fast.ai) License: Apache Software License 2.0 Location: /usr/local/lib/python3.6/dist-packages Requires: dataclasses, spacy, matplotlib, torch, torchvision, pandas, scipy, fastprogress, packaging, numpy, beautifulsoup4, pyyaml, requests, numexpr, Pillow, bottleneck, nvidia-ml-py3 Required-by: Torch Version: 1.6.0+cu101

Isn’t Version 1.0.61 the official release version? Thanks

No, it’s 2.0.0. You have the old version. See my answer above to update it

Thanks very much for your help

Gee thanks for providing this answer. As simple as it is, I was entirely lost thanks for clearing this up lmao.

I experienced the same issue and !pip install fastai --upgrade fixed the problem.

Thanks you for the reply! Seems like I had the same problem :smile: