[note: this is a wiki post so you can edit it to improve it]
Please use this thread for any fastai v0.7 (i.e. pre-fastai-1.x.x) installation related issues. For fastai-v1 installation issue please refer to this thread instead.
Important
Since fastai-1.0.1 release in Oct 2018, fastai-v1 is now the main code base inside fastai git repo. The fastai-v0.7 code base has moved to the old/fastai
directory inside the same repository. And there is a symlink that points from courses/*/fastai
to ../../old/fastai
so the notebooks under courses/*/*.ipynb
currently still work with the v0.7 code base (windows users using their own GPU will need to tweak the symlinks, see the instructions in the windows-installation links below).
Installation
If youâre on windows follow this guide, instead.
First, please make sure you have the latest conda
and/or pip
, depending on the package manager you use:
pip install pip -U
conda update conda
Currently, there are two ways to install fastai-0.7.x: (1) via conda from git source (best), or (2) via pip package (outdated code):
-
Conda installation from source:
1a. First, create the
fastai
conda environment. It will install all the dependencies that are needed. Do it only once:git clone https://github.com/fastai/fastai.git cd fastai conda env create -f environment.yml
You then activate that environment with:
conda activate fastai
If you donât have GPU, build the
fastai-cpu
environment instead:git clone https://github.com/fastai/fastai.git cd fastai conda env create -f environment-cpu.yml
You then activate that environment with:
conda activate fastai-cpu
Windows users wanting to use their own GPU, rather than cloud or vm solutions, will have extra steps to take. Please see the links to windows-dedicated threads at the end of this post.
1b. and now you can start running the course notebooks:
jupyter notebook
Once the jupyter notebook environment has started, in your browser navigate to
courses/dl1/lesson1.ipynb
and execute the notebook.From now on remember that you need to activate either
fastai
orfastai-cpu
environment that you created before in the shell that you code or notebooks from.
Some time later, to update to the latest
fastai-0.7.x.
code base:cd fastai git pull conda env update
If something gets messed up, delete the old env first:
conda env remove -y -n fastai
or with
fastai-cpu
conda env remove -y -n fastai-cpu
and then re-create the environment as explained in steps 1 a+b above.
This post goes into more exact details on what else you might need to undo and restart from scratch. This probably mostly affects people who are updating their old setup, which no longer functions.
-
Pip installation
pip install fastai==0.7.0 pip install torchtext==0.2.3
This currently will install the fastai version from May 13, 2018 (outdated)
Using fastai v0.7 and v1.0 into the same environment
Ideally have a dedicated environment for each and then there should be no conflict.
If you have to have both in the same environment, install fastai
v1.0 normally and fastai
v0.7 into a hidden path, and then when you want v0.7 prepend that hidden path to sys.path
:
import sys
sys.path.insert(0, "/path/to/fastai/v.0.7")
import fastai
Specific problems
-
ModuleNotFoundError: No module named 'bcolzâ
. See this.
Some troubleshooting ideas
Tell me where Python is looking for my modules to import from:
import sys
print(sys.path)
Tell me which fastai
library got loaded (we want to know the exact path)
import sys, fastai
print(sys.modules['fastai'])
At times a quick hack can be used to get your first notebook working and then sorting out the setup. Say you checked out fastai
to /tmp/
:
cd /tmp/
git clone https://github.com/fastai/fastai
cd fastai/old/
So now you know that your uninstalled fastai
is located under `/tmp/fastai/old/. Next, put the following on the very top of your notebook:
import sys
sys.path.append("/tmp/fastai/old") # on windows use \'s instead
import fastai
and it should just work. Now, go and sort out the symlinks, so that you donât need to do it for every notebook.
Related threads
Google Cloud:
Installation on Windows (not recommended for beginners, use cloud instead)
Problem report
If you encounter installation issues please report them in this thread.
For windows-specific install issues itâs probably the best to post in this dedicated thread.
When you make your report include as much information as possible, including your platform details and in particular the exact steps you executed (all of them) that lead you to a problem. Please remember, we canât guess what you may have done.
Please do not send screenshots with trace/error messages - we canât copy-n-paste from the images, instead paste them verbatim into your post and use the markdown gui menu so that itâs code-formatted.
If your system is configured to use a non-English locale, if possible, re-run the problematic code after running:
export LC_ALL=en_US.UTF-8
So that the error messages will be in English. You can run locale
to see which locales you have installed.
p.s. if there are cloud/vm-service-specific instructional threads/posts that are up-to-date, please add a link, so this thread can send users to the more specific threads where a specific environment is discussed. Thanks.