Installation of fastai v2 on Windows

Hi All,
Please pardon my ignorance but while on holiday break, I have been working to get fastai and fastbook installed on my Windows 10 for Workstations system. I have two Ubuntu machines (one VMWare) on my Windows machine and an old Dell T7500 workstation where I have successfully installed fastai v2 and fastbook. I have been working hard to sift through all of the documentation on the installation of fastai v2 on my Windows box but I have only been successful in getting fastai v1 (version 1.0.34) to run. I am beginning to understand Jeremy Howard’s recommendation on sticking with Linux in his video course.

I have a new machine with B550 Ryzen 3900X and GeForce 2080 super graphics card. I would really like to use the power of this system but appear to be frustrated at this point. Has anyone successfully installed fastai v2 and fastbook on Windows? If so, I would be very grateful for a link to information on how to make it work.

Thank you for your patience.

Fastai2 it works with windows. Fastai2 on Windows

fastai2 is old name and absolute now.
you can check

git clone
pip install -e “fastai[dev]”

pip install -e “fastai[dev]” from the fastai repo.
not fastai2.

dls = ImageDataLoaders.from_name_func(path, get_image_files(path), valid_pct=0.2, seed=42, label_func=is_cat, item_tfms=Resize(224), num_workers=0)
don’t dorget to set
num_workers=0 has to set 0 for windows.

1 Like

Yay! with your help I have version 2.2.0 on Windows. Thank you.

Can you help me with the last part of your message?

dls = ImageDataLoaders.from_name_func(path, get_image_files(path), valid_pct=0.2, seed=42, label_func=is_cat, item_tfms=Resize(224), num_workers=0 )
don’t dorget to set
num_workers=0 has to set 0 for windows.

does this information go into an environment file?

Thanks again for your help.

workers on windows does not work …due to the pytorch problem… so you should use single data loader. to do that you should set the parameter num_workers=0 in the right place…

I spent a few hours on this tonight, and finally got fastbook / fastai working on Windows 10. I have an Nvidia GTX 1060, and 1.5TB of free disk space, so would rather learn on my own hardware than rent an environment in the cloud.

Here was my method.

  1. Install Anaconda Individual version. Then launch it, and from the Anaconda Navigator you can see what packages are installed.

  2. Install the fastai packages. Run the Anaconda Prompt to get a command line, and enter the following:

conda install -c fastai -c pytorch -c conda-forge -c anaconda fastai gh anaconda

Note that the conda-forge option was not listed in other posts, and without it the “gh” package fails.

I believe I then also ran the following command to install the fastbook package, but I do not know if this is needed? (Since I could not actually find the book notebooks anywhere on my computer after this.)

conda install -c fastai fastbook fastcore

  1. Get the actual fastbook content notebooks. To do this, I installed Github Desktop (you need a github account to do this) and cloned the fastbook repo to my PC. (You could just download the repo as a Zip file without running git locally, but then you may not know if it gets updated.) After this step, i now had the chapter notebooks for the book in the folder I designated.

  2. Launch “Jupyter Notebook” from the Anaconda Navigator home screen. This should open Jupyter in your browser, and you should see the folders on your system. Navigate to your copy of the fastbook repo, and click on the “01_intro.ipynb” notebook.

  3. Fix C++ Runtime library issue, if you have it. When I tried to run the first cell, which runs the fastbook.setup_book() method, I got an error saying that I did not have the C++ runtime installed. There was a link in the error message, so I downloaded and installed it. Then I could run the cells in the book.

  4. Fix the “num_workers=0” problem. You will get a CUDA error when you try to load the images for the first example. To fix it, add the parameter “num_workers=0” inside the parenthesis of the ImageDataLoaders.from_name_func command. I put it right before the final ‘)’ and don’t forget the comma since you are adding it to the list of parameters.

  5. Verify the ML algorithm uses the GPU. I started up the Windows Task Manager, and sorted the display by GPU usage. When it was running the final training on the first example, I saw the GPU usage go from 0% up to 45% while it was running. Success!

Note, I did not have to install any CUDA libraries, but I did some crypto mining with this machine a while back, so that may be why. :grin:


The conda code offered in the book did not work for me (Win 10 home).
So first I created a conda env (python 3.8.3), then installed pytorch (gpu enabled, using the site generated command), then ran pip install fastai - it worked


I plan to use the windows 10 installation only for inference. As I have Miniconda installed on my laptop I used
conda install -c fastai -c pytorch fastai
as suggested in the installation section. The installation went on successfully.
However when I try to load the trained model using load_learner(model_path) I get an error

NameError: name ‘load_learner’ is not defined

Is it an issue with installation or I am missing something else??