Download_images() not working (on JarvisLabs)

Hi everyone,
I`m trying to run the code of Chapter 2. On google colab the download_images() function is working fine, but on Jarvislabs, it’s not. (I tried Google Cloud Platform too, that one time that I got a GPU, and also there it wasn’t working…)
The Bing API works as I get a list of working URL’s of bear pictures. Just the actual downloading into the folders doesn’t work.
I don’t get any error messages. The function creates the folders but no images are placed in it.

Google colab, the platform where I got it working is using a much older version of FastAI, that might have something to do with it?

Any ideas?
Would love to keep moving forward with the course!

Best regards,


1 Like

in case anyone is having the same issue. Instead of using the download_images() function I made up this piece of code. (which probably has bugs but is does the job in this case)

from urllib import request

if not path.exists():
    for o in bear_types:
        dest = (path/o)
        results = search_images_bing(key, f'{o} bear')
        pic_id = 0
        for url in results.attrgot('contentUrl'):
            url_last_part = url.rsplit('/', 1)[-1]
            file_extension = url_last_part.rsplit('.', 1)[-1]
                request.urlretrieve(url, f'{dest}/{o}{pic_id}.jpg')
                pic_id += 1
            pic_id += 1
1 Like

The download_images function has a bug in fastai version 2.5.0, which is fixed in the latest version 2.5.2. You can look into the issue to understand more.

You can upgrade the fastai version by

pip install fastai --upgrade

We will update the base version in soon, so you do not need to do it manually.

We have updated the fastai version to the latest one. So you don’t need to manually update it. The download_images works in the latest version.

1 Like

Fantastic. That indeed solved the problem. Thanks Vishnu!

1 Like