Installation of fastai v2 on Windows

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:

2 Likes