Fastai v0.7 install issues thread

Hello, Im having issues downloading fastai. I’m getting this error but i did download pytoch

fastai 0.7.0 not working Google Colaboratory anymore?

I am using Google Colaboratory and fastai 0.7.0

It worked fine some time back (I would guess in January this year),
now I am having a look at the notebooks, and they fail to run (without any code changes)

I have been using the dogs vs cats example from the course.

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

torch.version
gives 0.3.1

arch=resnet34
data = ImageClassifierData.from_paths(PATH, tfms=tfms_from_model(arch, sz))
learn = ConvLearner.pretrained(arch, data, precompute=True)
learn.fit(0.01, 2)

module ‘torch.nn.init’ has no attribute ‘kaiming_normal_’

No idea why it worked some months back and what changed.

I try to figure out what the issue is, and it seems to be due a need to upgrade to pytorch:

I kill the Colab seesions, and reset try to upgrade
!pip install -q http://download.pytorch.org/whl/{accelerator}/torch-0.4.1-{platform}-linux_x86_64.whl torchvision

torch.version
gives 0.4.1

Running the code again
arch=resnet34
data = ImageClassifierData.from_paths(PATH, tfms=tfms_from_model(arch, sz))
learn = ConvLearner.pretrained(arch, data, precompute=True)
learn.fit(0.01, 2)

/usr/local/lib/python3.6/dist-packages/torch/cuda/init.py:114: UserWarning:
Found GPU0 Tesla T4 which requires CUDA_VERSION >= 9000 for
optimal performance and fast startup time, but your PyTorch was compiled
with CUDA_VERSION 8000. Please install the correct PyTorch binary
using instructions from http://pytorch.org

warnings.warn(incorrect_binary_warn % (d, name, 9000, CUDA_VERSION))

so I think it is runs on CPU now instead, and it never finishes (it runs out of memory on colab after a while)

If I try to upgrade to pytorch 1.1 I get

ERROR: fastai 0.7.0 has requirement torch<0.4, but you’ll have torch 1.1.0 which is incompatible.

Anyone successfully running 0.7.0 in Colab now?

After creating the environment…when trying to activate by "
conda activate fastai-cpu"
I am getting below error
CommandNotFoundError: Your shell has not been properly configured to use ‘conda activate’.
To initialize your shell, run

$ conda init <SHELL_NAME>

I have created docker container for FastAI version 0.7.0. You can runn following command to pull the container:

docker pull mdeore/fastai_0_7_0

Hope this helps.

I’m also having problems with torch version, did you manage to sort this?

I’m getting this:
torchvision 0.3.0 has requirement torch>=1.1.0, but you’ll have torch 0.1.2.post2 which is incompatible.

And This:
Command “/Applications/anaconda3/bin/python -u -c “import setuptools, tokenize;file=’/private/var/folders/b2/l0wpqyh966759ms4lr29d9cm0000gn/T/pip-install-w360hnca/bcolz/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /private/var/folders/b2/l0wpqyh966759ms4lr29d9cm0000gn/T/pip-record-envqcys5/install-record.txt --single-version-externally-managed --compile” failed with error code 1 in /private/var/folders/b2/l0wpqyh966759ms4lr29d9cm0000gn/T/pip-install-w360hnca/bcolz/

Ruth,

Any chance you were able to resolve this? I’m running into same issue.

@mdeore Does it run on a gpu or cpu env? Thanks!

@draz its for CPU but will make it GPU as well.

Hello FastAI friends,

I think that I am at the very right topic to get helped on my problem. I am trying to create a docker on Ubuntu for fastai-cpu v0.7. I have created the following Dockerfile:

FROM ubuntu:18.04
ENV PYTHON_VERSION=3.6

WORKDIR /fastaidir

ENV TINI_VERSION v0.18.0

ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
ADD https://github.com/etheld/kubevaultenv/releases/download/0.1.12/kubevaultenv-linux-amd64 /vaultenv

RUN apt-get update && \
    apt-get install -y git wget curl unzip libsm6 libxrender1 && \
    curl -o ~/miniconda.sh -O  https://repo.continuum.io/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh  && \
    chmod +x ~/miniconda.sh && \
    ~/miniconda.sh -b -p /opt/conda && \
    rm ~/miniconda.sh && \
    /opt/conda/bin/conda install conda-build && \
    git clone https://github.com/fastai/fastai.git && \
    cd /fastaidir/fastai && ls && /opt/conda/bin/conda env create -f environment-cpu.yml -n fastai-cpu && \
    /opt/conda/bin/conda clean -ya && \
    chmod +x /tini && \
    chmod +x /vaultenv && \
    ln -s /data /fastaidir/data

ADD config_fastai_cpu.sh /
ENV USER fastai

ENTRYPOINT ["/tini", "--"]
CMD ["/config_fastai_cpu.sh”]

, where at the end I am configuring the fastai-cpu with the config_fastai_cpu.sh, inspired from Jeremy at the beginning of this thread:

#!/bin/bash

source /opt/conda/etc/profile.d/conda.sh
conda activate fastai-cpu

pip uninstall -y matplotlib  ;
python -m pip install --upgrade pip  ;
pip install matplotlib  ;
pip install fastai==0.7.0  ;
pip install torchtext==0.2.3  ;
pip install flask==1.0.2    ;

exec /opt/conda/envs/fastai-cpu/bin/python -c 'from fastai.conv_learner import *; print("\nimported \n")'
printf "%*s\n" $ColumnsN |tr " " “_”

This was a working code about a year ago. I bet it’s something about the versions of torch, (or Ubuntu?, or Miniconda?), and at the very end I am getting this error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/conda/envs/fastai-cpu/lib/python3.6/site-packages/fastai/conv_learner.py", line 1, in <module>
    from .core import *
  File "/opt/conda/envs/fastai-cpu/lib/python3.6/site-packages/fastai/core.py", line 2, in <module>
    from .torch_imports import *
  File "/opt/conda/envs/fastai-cpu/lib/python3.6/site-packages/fastai/torch_imports.py", line 2, in <module>
    import torch, torchvision, torchtext
  File "/opt/conda/envs/fastai-cpu/lib/python3.6/site-packages/torch/__init__.py", line 56, in <module>
    from torch._C import *
ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory

I don’t understand what I am missing. Please suggest. Thanks!

OMG it works!
I spent hours trying to follow the various install documents. Please do this document in just one place, and replace all the other awful ones. No greater barrier to a software community than an impossible setup.
Thanks…

I wrote a document on How to Install Fastai v0.7 on AWS for Fastai Machine Learning Course that details every installation step to get you started on the Fastai ML course. I agree with @banksiaboy that there is no greater barrier to software development and learning than an impossible setup.

@minh I think that the step 3 is not correct. By doing git clone https://github.com/fastai/fastai.git it basically installs v1.x, not v0.7.

1 Like

I tried and got fasai v0.7 installed correctly. Did you somehow get v1 installed?

On a brand new system (created with Docker) v1 is installed in this way. Moreover, the instructions in https://github.com/fastai/fastai/tree/master/old describe exactly what I am saying.

I have installed latest fastai version. But i am not able to run the ML course. How can i access 0.7version now. Does all the functions of 0.7 version is present in current version?

@DebabrataRoy The latest version is different from the v0.7. You should follow the instructions in https://github.com/fastai/fastai/tree/master/old that refer to the old version (v0.7).

Hello guys, I’m a noob trying out random forest algorithm. I have a little prediction I have made. Please can anyone look into my code and tell me if it makes sense or not. https://github.com/mamman1010/How-much-does-it-rain

Sadly I do not see a torch 0.3.1 for windows anymore!

Is there any way we could install fastai v0.7 on Google Colab and progress with the course using Goolge Colab only? Any other options are paid and I do not have a local machine with GPU on it.

try
!pip install scikit-learn==0.21.3
!pip install fastai==0.7.0