Fastai install fail on colab - version mismatch in pytorch

Hi, starting the fastai course using Colab. In the app_jupyter.ipynb, I received a failure on
!pip install -Uqq fastbook

ERROR: torchtext 0.9.0 has requirement torch==1.8.0, but you’ll have torch 1.7.1 which is incompatible.

Any pointers on where to go next, I did some searches and did not get a useful hit.

1 Like

HI chas
I think this problem is still in the process of being resolved.
The link below should help and the other posts will give an idea of whats happening.

Cheers mrfabulous1 :smiley: :grinning:

1 Like

You should downgrade colab pytorch right now.
When you do

pip install fastai

it will downgrade to 1.7 and it should work. torchtext is not used so it shouldn’t impact fastai.

1 Like

It still happens:

! [ -e /content ] && pip install -Uqq fastai # upgrade fastai on colab

 |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 194kB 6.5MB/s 
 |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 776.8MB 19kB/s 
 |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 12.8MB 31.2MB/s 
 |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 61kB 6.0MB/s 

ERROR: torchtext 0.9.1 has requirement torch==1.8.1, but you’ll have torch 1.7.1 which is incompatible.

You will have to do !pip uninstall torchtext

I had a similar issue where I installed fastai with pip. I got the β€˜No module named fastai’ error whenever I tried to import fastai, but if I did β€œpip freeze | grep fastai” in the terminal, it showed that fastai was clearly installed.

The solution for me was to download anaconda3, enter an anaconda environment, and reinstall fastai with conda using step 6 of fastai’s setup instructions for using AWS EC2 instances.

1 Like