I'm trying to run the jupyter notebooks of fastai's v3 course. My system has ubuntu 16.04 . Here's what I've done:
Installed Python
Installed Anaconda
Ran
conda update conda
conda install -c pytorch -c fastai fastai pytorch torchvision cuda92
git clone https://github.com/fastai/course-v3
The repo is now cloned at /home/ali/ml/course-v3
Did cd nbs/dl1
, then jupyter notebook
Opened the http://localhost:8888/?token=xxxx
link from terminal
However, when I open any of the notebooks, and select any of the import statements, e.g:
%matplotlib inline
from fastai.basics import *
I get an error of the following kind:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-2-d09c56fdb8ce> in <module>
1 get_ipython().run_line_magic('matplotlib', 'inline')
----> 2 from fastai.basics import *
ModuleNotFoundError: No module named 'fastai'
I've running conda install -c fastai fastai
again as indicated on https://course.fast.ai/start_aws.html#step-6-access-fastai-materials but same result.
None of the other code blocks work of course, giving a NameError
on variables not being defined, probably because the initial import didn't work.
Any ideas what to do / what I'm doing wrong? This is driving me insane..
To install with pip, use: pip install fastai . If you install with pip, you should install PyTorch first by following the PyTorch installation instructions.
So, for another newbie like me, here's what was going on.
Anaconda is its own python environment, it installs its own python packages and python binary, and it changes the PATH so references to python resolve to it instead.
My conda install -C fastai
calls had actually not finished successfully, conda list | grep fastai
was empty, showing it hadn't installed, and when I tried to reinstall, I actually saw that it fails due to incompatibility / conflict issues with wrapt
I also had jupyter
installed thru pip, so it was probably not using anaconda's environment anyway.
I had to create a new environment, reinstall, and then it finally worked!
conda create -n fastai python=3.7 #New blank slate env
conda activate fastai
conda install -c pytorch -c fastai fastai #No erors this time
conda list | grep fastai #It shows up now!
At this point, the previous install of jupyter started breaking, so I reinstalled it with conda install jupyter
, and then everything finally worked!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With