Howto: installation on Windows


(Jeremy Howard) #1

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. 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 ..\..\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

How to set up Windows 10 for fast.ai
ModuleNotFoundError: No module named 'fastai'
Another treat! Early access to Intro To Machine Learning videos
Personal DL box
Deep Learning Brasília - Revisão (lições 1, 2, 3 e 4)
Part 2 Lesson 8 wiki
OSError When Reading From CSV File in Lesson3-Rossmann
ModuleNotFoundError: No module named 'fastai'
How to ask for help
Remote Jupyter access of home DL rig
Another treat! Early access to Intro To Machine Learning videos
Another treat! Early access to Intro To Machine Learning videos
Set-up on Windows Server Thread
Deep Learning Brasília - Lição 4
(Andrea de Luca) #2

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?


(Jeremy Howard) #3

It was one line of code.


(Jeremy Howard) #4

You are indeed.


(Rudy Khalil) #5

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


(Gerardo Garcia) #6

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


(Jeremy Howard) #7

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


(Andrea de Luca) #8

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?


(Gerardo Garcia) #9

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

Thanks @Jeremy


(Jeremy Howard) #10

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


(Jeremy Howard) #11

Rebooting fixed that for me


#12

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


(Gerardo Garcia) #13

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

image


(Jeremy Howard) #14

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


(Gerardo Garcia) #15

I’m not running Developer Mode on this PC


(Andrea de Luca) #16

@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).


(Andrea de Luca) #17

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

Thanks.


(Charin) #18

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


(Andrea de Luca) #19

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:


#20

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.