Howto: installation on Windows

Whilst Windows isn’t officially supported for fastai or the lessons at this stage, it does seem to be working now so those with the patience and boldness to venture into something a little new and somewhat untested, here’s instructions on getting started running on a GPU on Windows. (NB: most people using Windows on their laptops are advised to use a cloud GPU provider like Paperspace - accessing a cloud provider from Windows is well supported and tested for this course).

  1. You must have an Nvidia GPU installed, and have installed the most recent Nvidia drivers

  2. Install Anaconda (Python 3.6) using the 64-bit graphical installer. Choose the option to install for “this user only”

  3. Install Git for Windows

  4. Run Anaconda Prompt from your start menu, and type:
    git clone https://github.com/fastai/fastai.git

  5. Once the repo is cloned, you’re ready to set up fastai:
    cd fastai
    conda env update

  6. Activate your new environment (NB: you must type this command every time you run Anaconda):
    activate fastai

  7. Install ipython widgets into jupyter:
    jupyter nbextension enable --py widgetsnbextension --sys-prefix

  8. If you are doing the Deep Learning course replace the linux symlink with a Windows one (note that this requires an admin command prompt if you don’t have a fully updated version of Windows 10):
    cd courses\dl1
    del fastai
    mklink /d fastai ..\..\old\fastai
    cd ..\..

  9. If you are doing the Machine Learning course replace the linux symlink with a Windows one (note that this requires an admin command prompt if you don’t have a fully updated version of Windows 10):
    cd courses\ml1
    del fastai
    mklink /d fastai ..\..\old\fastai
    cd ..\..

That’s it! You should be ready to now type jupyter notebook and a notebook will pop up running jupyter. Click through to courses and then dl1 and try lesson1.ipynb. The start of the notebook will show you how to check everything is working. Note that you don’t need to install CUDA, Visual Studio, CuDNN, or anything else (although it’s fine it you have installed some of these things).

If you have any problems, please tell us exactly what your set up is (e.g. Windows and driver versions, type of GPU) and full details of what you did and what errors you saw. Remember that this is a new and unsupported option, so is only recommended if for some reason you can’t use Paperspace or similar, or you’re interested in helping develop and test a the cutting edge!

Additional notes:

  • To use the NLP libraries in lesson 4 and onwards, you’ll need to install Spacy’s English model. To do so, run the Anaconda prompt as admin (i.e. click start, type ‘anaconda’, type ctrl-shift-enter, or right-click anaconda and ‘run as administrator’) and type:
    python -m spacy download en
72 Likes

Thanks, @jeremy, really awesome work. :slight_smile:

May I ask if you patched fastai library to force pytorch for windows to use Long integer tensors, or did you find some other workaround?

Also, I assume it will install pytorch for cuda 9.0. Am I right?

It was one line of code.

4 Likes

You are indeed.

2 Likes

How do you do that?!!! really awesome work. Thanks a lot @jeremy

I’m doing a fresh install and I’m having an issue with the link to fastai under the dl1

On Windows you will need to create a shortcut for it to work.
fastai is showing like a file not like a link :frowning:

BTW, I created the shortcut directly and it did not work

1 Like

Apologies - I forgot that bit. I’ve added that step to the post now. See if that helps.

Strange.

torch.cuda.is_available() returns False.

torch.backends.cudnn.enabled returns True.

I didn’t have cuda 9.0 installed, but it should have been installed when I ran conda env update.

Suggestions?

1 Like

Success!!
In order for you to create the link you will need to have some kind of admin rights on your PC

Thanks @Jeremy

2 Likes

I didn’t need admin when I did it…?

Rebooting fixed that for me

2 Likes

you do need admin, so launching command prompt as admin will do it.

I here is a new link with admin because the fastai was already created
I switched to admin and it worked perfectly fine

image

1 Like

Looks like older versions of Windows require admin for mklink: https://blogs.windows.com/buildingapps/2016/12/02/symlinks-windows-10/

I’m not running Developer Mode on this PC

@jeremy

Something had gone really kablooey. Look at what happens after a reboot. I just open an anaconda prompt:

Obviously, it should look in C:\Program, because no such folder exists.
Pity, I was on the verge of having everything up and running.

It seems that my entire anaconda installation is broken. If I call conda with its absolute path, it just shows me those error messages.

But I understand you cannot provide system specific support, it was just for the record. I’ll figure out something (probably I’ll just have to reinstall anaconda and all the stuff. Damn, I have five envs with a lot of stuff).

Tell me, what version of cuDNN does pytorch 0.3 use? I didn’t quite found this after a quick googling.

Thanks.

Thank you so much! I literally just had a friend asked for this yesterday.

Fixed the big mess by reinstalling anaconda.

Now, I still get False when I call torch.cuda.is_available().

Consider that my CUDAPATH points to system’s cuda 8.0 directory. Now, the presence of cuda 8.0 and cudnn 6 is due to Tensorflow (which I need).

Now, I could try and install TF 1.5 (which works with cuda 9 and cudnn 7), install systemwide cuda 9.0 and change my CUDAPATH to cuda 9.

But I’d like to hear your opinion about that, prior to commit major system changes.

Another option would be to modify fastai (through environment.yml I suppose?) for pytorch/cuda80. Same as before, what do you think about this?

Thanks! :slight_smile:

my opinion, not that it means much, is that it is possible to have multiple versions of cuda installed on the machine. I think the last install takes precedence for cuda_path, but other ones are created per version as shown in this image from one of my machines.

As far as fastai and pytorch, there was a thread that said the developers of pytorch auto compiles the needed cuda files in their packages. Therefore, you do not need to install them separately like above. In fastai’s environment file, you will see pytorch and the necessary cuda90 packages getting installed by themselves and should only affect your fastai env.

Again, I am no know-it-all, but I read it on the internet.

1 Like