Fastai error - Lesson 1

Clearly I have something missing - I was up and running on my first instance, but created a 2nd one that was non-pre-emptive and now I get
ImportErrorTraceback (most recent call last)
in ()
----> 1 from fastai.vision import *
2 from fastai.metrics import error_rate

ImportError: No module named fastai.vision

from fastai.vision import *
from fastai.metrics import error_rate

running on a mac

I followed all these steps with no luck:
I used these steps, and error got resolved for me:

  1. Open terminal
  2. Navigate to anaconda3
    cd anaconda3
  3. update conda
    conda update conda
  4. Navigate to conda env section and create new environment named fastai
    cd envs
    conda create --name fastai
  5. make fastai environment as current working directory
    cd fastai
  6. clone github repository of course-v3
    git clone https://github.com/fastai/course-v3.git
  7. make course-v3 as current working dir
    cd course-v3
  8. open jupyter notebook
    jupyter notebook
  9. Click New->Terminal in Jupyter, then type:
    conda install -c fastai fastai
    this step will install all required libraries.

appreciate your help

Try to run these codes:

 pip install http://download.pytorch.org/whl/cpu/torch-1.0.0-cp36-cp36m-linux_x86_64.whl
 pip install fastai

doc:https://docs.fast.ai/install.html

Thank you for trying to help me:)

Got this
jupyter@my-fastai-instance2 : ~ $ pip install http://download.pytorch.org/whl/cpu/torch-1.0.0-cp36-cp36m-linux_x86_64.whl

ERROR: torch-1.0.0-cp36-cp36m-linux_x86_64.whl is not a supported wheel on this platform.

how about

pip install fastai

?

well that didn’t error out in the terminal - but same error in the notebook :frowning:

calling it a night…been fighting this since Saturday and no luck…I am not a programmer so I am sure that doesn’t help with my understanding of where things are but still frustrated that I haven’t figured it out - thanks for your help!

Ok, if you want to do it next time, let’s copy and paste your error code from notebook to here, so we can see what your issue is.:upside_down_face:

If you want, you can train it online with Colab(Free google gpu).

Go to here: https://colab.research.google.com/github/fastai/course-v3/blob/master/nbs/dl1/lesson1-pets.ipynb

put this line on the top !curl https://course.fast.ai/setup/colab | bash

You need to activate your fastai conda environment. Do you see (fastai) to the in your terminal?

If not, do the following:

conda activate fastai

now you should see (fastai) to the left in your terminal, yes? Now to finish up…

pip install fastai

or

conda install -c fastai fastai

check that it worked with: pip show fastai, this should show something like this:

If that all worked go ahead and lauch jupyter and run from fastai.vision import *. Remember to activate your fastai environment each time before launching jupyter

Actually, you need to do more than this as I’m assuming your trying to use GCP to host your notebooks and execute them. The problem is the ssh doesn’t activate your conda environment, and you can’t do it subsequently.

Follow the instructions here under section “Executing Jupyter remotely with Conda Environment” to fix this. If your screen matches the screenshots then you’ll know your error lies elsewhere.

Note: I put this together for fastaiv2 but it should work for you by simply writing fastai instead of fastai2 where appropriate.

Thanks for your help - I haven’t been able to work on this - but am at it again - I went through all these suggestions but am still at the same place - attached is what I get in my notebook -Screen Shot 2020-02-21 at 9.17.43 PM