NameError: name 'Path' is not defined

I am trying to follow lesson2-download.ipynb notebook on Google Colab to upload GOOGLE images to Google Drive.
When I run this:

path = Path(base_dir + ‘data/images’)

I get NameError: name ‘Path’ is not defined.

How to resolve this?



You should import the fastai imports

–> from fastai.imports import *


Great, thanks so much!


Thanks from me as well!!
Why do I need this command for colab and windows?

Thanks from me aswell. I thought Path is something that is part of the Python Path class. But apparently, FastAi adds ls method on top of that. Still not clear why Path wouldnt just work on Colab.

1 Like

I think this issue has something to do with FASTAI’s version 1 and 2, current version as of now is 2.4, I experienced similar issue while I could sort this out by downgrading to version 1.0.52 also.