ModuleNotFoundError: No module named 'fastai.vision.all' on Kaggle Notebook

This solved my problem. Thank you!

Hi, I just tried doing this myself in colab. I get the error:

AttributeError Traceback (most recent call last)
in ()
1 #hide
----> 2 from fastai.vision.all import *
3 from fastai.text.all import *
4 from fastai.collab import *
5 from fastai.tabular.all import *

3 frames
/usr/local/lib/python3.6/dist-packages/fastai/vision/core.py in ()
22 # Cell
23 if not hasattr(Image,’_patched’):
—> 24 _old_sz = Image.Image.size.fget
25 @patch_property
26 def size(x:Image.Image): return fastuple(_old_sz(x))

AttributeError: type object ‘Image’ has no attribute ‘size’

Any ideas? Thanks!

Hey @Tom26, I am not able to replicate the error. Here is a link to the colab notebook that I used. You can also check the fastai version that is loaded to see if it is the latest version. You may have to just restart the runtime. Let me know if you still have issues.

PyTorch 1.6 and FastAI 2.0 are installed by default in Kaggle Notebooks as of 9/23/2020. Now you can use the following import statements (without the need to do any pip installs):

import torch
import fastai
from fastai.tabular.all import *
from fastai.text.all import *
from fastai.vision.all import *
from fastai.medical.imaging import *
from fastai import *
# etc, etc, etc

2 Likes

Thanks @amritv! Seems to work fine now.

I installed Fastai and other resources on my local machine and I’m getting this error. Thought it belonged to this thread. Can somebody help!

Hi all,
I am quite a newbie but I just upgraded my fastai version as there were some functions I wanted to try.
Now I find out that some parts of my script are not working anymore. I am working in collab.

Such as I cannot do open_image() anymore.
Am I missing a module to load in or do I have to use PIL to open it?

Thank you

Thank you, this worked for me. the instance was running the 1.0.61 version.
Cheers!

3 Likes

Restarting the runtime worked for me thanks!

Thanks! was wondering why from fastai.vision import * isn’t working for aug_transforms

thanks for the help! you rock

I agree!
After updating your lib, restart the runtime as Colab suggests:

WARNING: The following packages were previously imported in this runtime:
[fastai]
You must restart the runtime in order to use newly installed versions.

I didn’t need to install fastcore :frowning: