ModuleNotFoundError: No module named 'fastai.callback.all'; 'fastai.callback' is not a package

I had earlier post an error when I run this script
#id first_training

#caption Results from the first training

# CLICK ME

from fastai.vision import *

from fastai import * 

path = untar_data(URLs.PETS)/'images'

def is_cat(x): return x[0].isupper()

dls = ImageDataLoaders.from_name_func(

    path, get_image_files(path), valid_pct=0.2, seed=42,

    label_func=is_cat, item_tfms=Resize(224))

learn = cnn_learner(dls, resnet34, metrics=error_rate)

learn.fine_tune(1)

so i got a solution to install fastbook and fastai ~
#hide

!pip install -Uqq fastbook

import fastbook


fastbook.setup_book()

i get this error ~
ModuleNotFoundError: No module named 'fastai.callback.all'; 'fastai.callback' is not a package

HI bhinav_Kudva Hope all is well!

The posts here may help you solve your problem.


Cheers mrfabulous1 :smiley: :smiley:

Yes. I got the same error message.

still facing the same error

I had the same issue, and following these exact steps solved my problem:

3 Likes

Hi andyjakubowski, bhinav_Kudva, james3

hope you are all having a wonderful day!

This is how Colab works If you do not do a mouse click about every fifteen minutes or so it times out and all variables are lost.
So I save the notebook whenever I make changes and rerun it.

There is a paid version of Colab, but I am not sure If this does the same thing.

I use pyautogui, if I want to go away for up to 12hrs and I want the notebook to continue running.

I also use the runall option in the RUNTIME menu so it runs all the cells until it gets to the end or finds an error.
This way I get to the end of the notebook, and can see the results even if they are no longer available.

Cheers mrfabulous1 :smiley: :smiley:

1 Like

I faced the same Error when i accessed 01_intro.ipynb notebook from https://course.fast.ai/start_colab#Using-a-GPU. This error seems occurring mainly form version mismatch in fastai,fastai2,fastcore Try to run Bellow and restart the notebook again. These version combination seems to be working.
!pip install fastai==2.0.15
!pip install fastai2==0.0.30
!pip install fastcore==1.0.16.

PS ~ This issue is still open in fastai repo https://github.com/fastai/fastai/issues/2758#issuecomment-701754968

This is working, thanks

Iā€™m stilling getting this error on Google Collab. Right out the box I cannot train a model :frowning:

Hi Syirrus Hope your well!
Some people have used the following to solve the problem on Colab.

!pip install fastbook --upgrade

Cheers mfabulous1 :smiley: :smiley:

Thank you!

Press ā€œRuntimeā€ -> ā€œRestart Runtimeā€ and it leads you to solve the issue.

8 Likes

Hi mrnobody hope all is well!

After working on the same notebook everyday for about two weeks and earlier today. I came back this evening ran the the first few cells, then when I ran this cell from fastai.vision.all import *

I recieved the error

ModuleNotFoundError: No module named ā€˜fastai.callback.allā€™; ā€˜fastai.callbackā€™ is not a package

This time only restarting the runtime would clear it.

It looks like I now have two things to try if I get this error again.

:smiley: :smiley:

1 Like

@mrfabulous1 if you getting started (or anyone else, by the way), iā€™ve started a public community here https://gitter.im/deeplearning42/

weā€™re a few already (8 or so :joy:) feel free to fall in.

I had this same issue the other day. What I found was that I did not have a locally saved version on my Drive, which was causing the error. I created a copy and worked off of that and the issue was gone.

2 Likes

This worked for me, thanks

Yeah , upgrading packages and restarting runtime solves the problem !!!

Worked for me as well. Thank you

Still facing the same issue. nothing works

1 Like

Yes updating the packages and restarting the notebook solves the problem