Name 'PILImage' is not defined AND name 'SimpleNamespace' is not defined

I am getting this

I am getting error in almost all the modules import * is also not working. Can anyone explain what is happening and what to do?
Why am I getting so many name error?

Well first, you do need to follow the from import *, as the only thing you’ve imported here is the name fastai.

Now given your screenshots it seems you’re using Google Colab. Colab only has fastai v1 by default, so you’ll need to do a pip install fastai -U. On top of this you may also need to restart the instance for the library to be properly loaded in


Thanks for your reply. It made my life simpler.

Can you explain, why is it taking such insane amount of times to run. Is there any solution to this.

Click one Runtime then Change Runtime Type and select GPU


Thanks so much!

For new users like me, this is what worked for me in Colab:

!pip install -Uqq fastbook
import fastbook
from fastbook import *
!pip install fastai -U
import fastai
from import *

The dog vs cat model code worked after inputting those above.