Resolving issues with FastAI on Windows 10 Anaconda due to Torch 1.8

On March 4th PyTorch 1.8 was released and I believe this is causing problems for new or updated Anaconda Installs

I personally just purchased the new FastAI book and was going through the latest Course v4 when i noticed my code was not running. Specifically from fastai.vision.all import * would not execute. This was due to be having am older version from FastAI pre 2.0 installed. I struggled for 4+ hours trying to get it resolved, even giving up and trying colab only to get another similar error.

Finally resolved my issues doing this:

Keep in mind the first action is to uninstall Anaconda so this will remove everything else you ever uninstalled in Anaconda, this is par for the course sometimes trying to do AI, Python work on a PC.

  1. Uninstall Anaconda3 and Reboot
  2. Install Pytorch using Anaconda Prompt (As Admin, right click it and hit more) with conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=10.2 -c pytorch
  3. Update Pip with: pip install --upgrade pip
  4. Install FastAI with pip install fastai
  5. Install fastbook for the course with: pip install -Uqq fastbook
  6. Install graphwiz with: pip install graphviz

The main fix is installing pytorch 1.7.1 which is looks like everything is now defaulting to 1.8 which I believe caused my issues. It’s possible one could uninstall Pytorch, FastAI, etc and just start at that point. Running the Conda installs resulted it going through some complex environment handling ultimately failing each time after wasting 30 minutes on each attempt. pip looks to be much cleaner.

Hopefully this helps at least 1 other person!

2 Likes

Thanks, at least for me, it worked with one note:
I had to change “pip install -Uqq fastbook”
with
“pip install -Uqq fastbook --user”
no need to reinstall everything just a new environment have solved the problem.

THANK YOU!!!

I uninstalled everything and followed your exact instructions. Everything worked, almost!

2 caveats:

  1. “graphviz” doesnt work. PATH has to be modified to include -

C:\Users<your-account-name>\miniconda3\Library\bin\graphviz

Procedure-
Open Windows Settings
search for “env” in search box
Edit environment variables for your account
Under "User Variables for your “account name”
Double Click “Path” in list
Add “New” entry
C:\Users<your-account-name>\miniconda3\Library\bin\graphviz

  1. “pillow” version has to be downgraded by using the following cmd

>conda install pillow=8.2

Pillow Issue: https://forums.fast.ai/t/runtimeerror-could-not-infer-dtype-of-pilimage/89697

My setup

  • Windows 10 (fully patched)
  • Nvidia GTX 1080

conda install -c fastai fastbook works for me.

1 Like