Problem with running chapter 8

Hi everyone. Since last three days, I am trying to run chapter 8 in Google colab. However, this line “from fastai.conv_learner import *” always seems to throw a new error. Now, it is showing “cannot import name ‘BatchSampler’” error. Yesterday, it was throwing an error saying some brackets and ‘’ were missing. I am using following commands to import library and the dataset.

!pip install
!pip install opencv-python
!apt update && apt install -y libsm6 libxext6
!pip3 install
!pip3 install torchvision
!mkdir data
!wget -P data/
!wget -P data/
!tar -xf data/VOCtrainval_06-Nov-2007.tar -C data/
!unzip data/ -d data/
!rm -rf data/ data/VOCtrainval_06-Nov-2007.tar

I suspect you face this problem because you are using the older version 0.7 notebooks but you are installing fastai library version 1.0.

!pip install

The line above will download and install fastai lib latest version (1.0 and above). If that’s not your intention, please install fastai lib version 0.7 (the version before 1.0).


  • See this thread. The solution is in there.