Issue in 01_intro colab

Apologies in advance if this is a noob question but I’ve been trying to the cell in colab containing

‘img = PILImage.create(‘images/chapter1_cat_example.jpg’)
img.to_thumb(192)’

but it gives me a

‘FileNotFoundError: [Errno 2] No such file or directory: ‘images/chapter1_cat_example.jpg’’ error

How do I go about resolving this? Thanks

1 Like

Did you follow the install directions?

I can confirm that I am seeing the same error as @Nik0knight

When I look at the file directory, I don’t see the fastai/fastbook repo installed anywhere obvious: Screen Shot 2020-08-25 at 10.59.39 PM

However if I manually install the github repo myself I can fix the issue (for those reading this, make sure to run the git clone in a separate cell):

%%bash 

git clone https://github.com/fastai/fastbook.git

And then I just modify the path to make it work:

## Add fastbook in front of original path
img = PILImage.create('fastbook/images/chapter1_cat_example.jpg')
img.to_thumb(192)

Is this what we are supposed to be doing ourselves? (I ask because I assumed that the fastai/fastbook would already be installed on the colab instance.)

@muellerzr what install directions are you referring to? The only directions I know are here and they don’t seem to mention anything related to the repo.

4 Likes

That’s a bug, Jeremy’s opened an issue in fastbook in regards to this :slight_smile:

FYI for folks that get the error related to callback.all, restart your runtime. I finally was able to reproduce it :slight_smile:

2 Likes

It might be worth doing %pwd and %cd /content/fastbook if necessary after cloning. I think the connection to Gdrive is setting %pwd to /content (your GDrive)

Regards Conwyn

Do we know if the bug was resolved? I am seeing the same issue in Dec

Hey, I have the same problem with this.
I’m using gradiant - paperspace + fastai
I solved it by add … before the link path

Hope this might help!

2 Likes

Hello Everyone ,
I am new here , thanks for all the inputs above , I am having the same issue while using COLAB , is there any specific solution ,

Thanks for trying but that does not solve it for me…just FYI

I’m having the same problem and have tried everything above… but no dice.

So I am on my first lesson but this is what I tried in Colab -
Commented out
uploader = SimpleNamespace(data = [’…/images/chapter1_cat_example.jpg’])
I think this is for taking a sample image out of the same directory, not sure, not very familiar with this directory repository stuff. But I did upload one image in the cell just above that from the clickable button. The the cell which is creating a problem will run.
I think the sample one is for the hard copy of the book.

1 Like

Thanks for sharing. This worked for me!

(Disclaimer - Might be too late to the party (discussion))

I am using Google Collab.
As a noob (to both Python and fastai), I faced the same <No such file or directory: ‘images/chapter1_cat_example.jpg’> and using ‘…/images/chapter1_cat_example.jpg’ did not solve the problem.

uploader = widgets.FileUpload()
uploader

works fine.

In github repo, chapter1_cat_example.jpg is available only under fastbook/images/ but not under fastbook/clean/images/ (empty folder). In lesson 1, Jeremy suggests to use notebooks under clean to learn/practice.

Perhaps, this is the cause for some people to face issue.

Hi Fastai community,
I’m running the course on Colab and I get the same issue.
I did every tweak mentioned in this thread but nothing work.
any thoughts please?
thank you all.