Fastai v0.7 install issues thread


will that work with !pip install fastai==0.7.0 in kaggle kernels?

(Stas Bekman) #43

no, the pip package is from May-2018. you need to use the source:

git clone
cd fastai
conda env create -f environment.yml

(or environment-cpu.yml for cpu)

or just install it from the nb:

!pip install fastai==0.7.0
!pip install torchtext==0.2.3

(Jeremy Howard (Admin)) #44

I don’t think you can do that in kaggle kernels AFAIK.


thanks stas!
tried that in kaggle kernels but got error: AttributeError: ‘torch.dtype’ object has no attribute ‘type’
but also seems somewhat random, i managed to get it work once, then it showed error, some other people also reported errors.


ML lesson 1 worked with !pip install fastai==0.7.0, however DL v2 lessons are not running on kernels reliably. the more i look forward to v3 course. noticed v3 notebooks started to appear on github repo!

(George Zhang) #47

I noted that the setup is slightly different from what Jeremy posted in Wiki thread: lesson 1 for the Machine Learning MOOC:

Would you mind explain a bit about the difference between these two ways of setting up v0.7?

(Cesare) #48

AttributeError: module ‘torch’ has no attribute ‘float32’.

Generated by:
from fastai.transforms import *

Caused by:
A newer version of torchtext (>0.3.0) in the requirments.txt (>=0.2.3)

Resolved by:
!pip install fastai==0.7.0
!pip install torchtext==0.2.3

Order matters

(Stas Bekman) #49

Thank you for the PR, @Cesare.montresor
It looks like everybody has been using environment*yml files, so requirements.txt got out of sync. I synced it to match environment.yaml.

(Cesare) #50

Thanks, really fast!
I use it on Colab for giving classes with my 2 study groups.
As it requires to reinstall dependencies every time, using pip is somehow faster :slight_smile:

(Stas Bekman) #51

Wiki mode has been turned on for the first post so you can edit it to improve it. Thank you.

(SA) #52

hey, after i used the 2 lines which you specified, I got a lot of lines of the form: Requirement Already Satisfied…
After that there was the following code snippet:

mxnet 1.3.0.post0 has requirement numpy<1.15.0,>=1.8.2, but you'll have numpy 1.15.2 which is incompatible.

kmeans-smote 0.1.0 has requirement imbalanced-learn<0.4,>=0.3.1, but you'll have imbalanced-learn 0.5.0.dev0 which is incompatible.

kmeans-smote 0.1.0 has requirement numpy<1.15,>=1.13, but you'll have numpy 1.15.2 which is incompatible.

anaconda-client 1.7.2 has requirement python-dateutil>=2.6.1, but you'll have python-dateutil 2.6.0 which is incompatible.

imbalanced-learn 0.5.0.dev0 has requirement scikit-learn>=0.20, but you'll have scikit-learn 0.19.1 which is incompatible.

Installing collected packages: torch
  Found existing installation: torch 0.4.1
    Uninstalling torch-0.4.1:
      Successfully uninstalled torch-0.4.1
Successfully installed torch-0.3.1
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
/bin/sh: 1: cannot open =0.3.0: No such file

But then I executed all the other cells,it worked fine. So do I need to upgrade pip or any other package? Also, I didn’t understand that last line (cannot open =0.3.0…)
Also, why does it ask to update pip? Doesn’t the kernel have the latest version by default?

Apart from this I encountered 2 other warning messages regarding deprecated module/function in pandas,numpy. I had forked @miwojc’s kernel :

(Stas Bekman) #53

Because of > or < you must quote the string in bash:

!pip install "torchtext<=0.3.0"


$ pip install torchtext<=0.3.0
bash: =0.3.0: No such file or directory

tries to read from file “=0.3.0”

(Cesare) #54

Ho sorry, it was with a \, but it got escaped by the forum, I doubled it :slight_smile: or yes, with quotes.

Even better:
!pip install torchtext==0.2.3

(Stas Bekman) #55

pip is a packaging tool, I’m not sure why you expect the kernel to have the latest unless you have run: pip update -U pip :wink:


For anyone using kaggle kernels. Kaggle downgraded fastai to 0.7 in kernels. Not sure what’s the plans there to upgrade to v1. But old courses run fine for now.

(Mware) #58

For anyone using paperspace this is what finally worked for me after multiple failed attempts.

1). Started from scratch by deleting fastai folder and followed install instructions above by @stas
2). Changed ~/.jupyter/ file as follows: uncomment and set c.NotebookApp.open_browser = False, uncomment and set c.NotebookApp.ip = ‘’, and uncomment and set c.NotebookApp.allow_remote_access =True
3). After launching jupyter notebook I inserted my ip before :888 i.e. http://[my_ip_here]:8888…

Also, make sure the fastai env is active otherwise you’ll get errors when running code in the notebooks.

(Karan Purohit) #59

just followed all the steps for installation on linux.
Getting same error message
ModuleNotFoundError: No module named 'bcolz’
If I comment out first line then:

ModuleNotFoundError Traceback (most recent call last)
in ()
1 #from fastai.imports import *
----> 2 from fastai.torch_imports import *
3 from fastai.transforms import *
4 from fastai.conv_learner import *
5 from fastai.model import *
~/Downloads/fastai/courses/dl1/fastai/ in ()
1 import os
2 from distutils.version import LooseVersion
----> 3 import torch, torchvision, torchtext
4 from torch import nn, cuda, backends, FloatTensor, LongTensor, optim
5 import torch.nn.functional as F

ModuleNotFoundError: No module named 'torchtext'

I have tried all other method posted but getting same errors!
Please help @stas

(Stas Bekman) #60

Please use forum search for when encountering problems, there is a whole thread with solutions about this issue:

(Bradley Graham) #61

I’m struggling to get the fastai module to work on Spyder. I’ve followed the instructions in this thread and created a separate environment using conda, but when I run spyder in this environment and try to import the fastai library, I get this error:

import fastai
Traceback (most recent call last):

File “”, line 1, in
import fastai

File “C:\Users\User\Anaconda3\lib\site-packages\”, line 1, in
from .basic_train import *

File “C:\Users\User\Anaconda3\lib\site-packages\fastai\”, line 2, in
from .torch_core import *

File “C:\Users\User\Anaconda3\lib\site-packages\fastai\”, line 2, in
from .imports.torch import *

File “C:\Users\User\Anaconda3\lib\site-packages\fastai\”, line 2, in
from .torch import *

File “C:\Users\User\Anaconda3\lib\site-packages\fastai\imports\”, line 3, in
from torch import nn, optim, as_tensor

ImportError: cannot import name ‘as_tensor’

I’m assuming its because I’ve got an incompatible version of one of the packages but I’m not adept with anaconda prompt, and have no idea how to downgrade packages if that’s whats needed.

Which packages are wrong and how do I fix them using conda?


Can someone explain how does method 1 works to install 0.7.0?
If you pull from the git, then fastai will be v1? Am I missing something?