How to set up Windows 10 for

(Jeremy Howard (Admin)) #63

Well if they read that far they’d certainly have demonstrated their commitment… :wink:

(Andrea de Luca) #64

A true ordeal indeed… :japanese_ogre::blush:


@jkashish18 Instead of setting path using “sys” use
set PYTHONPATH=/path to fastai directory

(Andrea de Luca) #66

Guys, before you venture in a windows installation, please be advised that you will have to cope with serious frustration if you are not willing to spend a lot of time experimenting. And I don’t mean experimenting with deep learning, which is fun, but rather with os and string manipulation.

Want an example?

Look at what happens for Lesson 1: I want to do the most basic task, that is, read a dir output and put the filenames in a file. Except under windows it is not that easy.


As you may see, it spits out a lot of garbage other than the filenames. Ok, no problem with a bit of slicing:


Except that the filenames are not all of the same length, so you risk of having spaces where they shouldn’t be, or having filenames truncated, e.g.:


But the best has yet to come. Want to plot an image? Good.

You already observed that you have to switch / with \ for windows pathnames, otherwise you get errors. In the following example, I’ll try to use Unix style slashes:


Now, look at what happens when I try to plot an image:

As you may see at the bottom, the pathname is completely wrong, regardless of the command we issued, which was syntactically correct. Well then, let’s try with Unix style:

Et voila’, it works! (I cannot explain why, although I suspect it’s because we are using string formatting here…)

So the gist is it doesn’t matter if you manage to concoct a successful windows env for fastai. Be prepared to be creative in overcoming a ton of problems which will follow… :wink:

Hopefully, @jeremy and @rachel will release windows-specific nbs along with pytorch 0.4, but until then, we must make shift for ourselves. :face_with_monocle:


If you want to use windows pathnames correctly, use a double backslash (that is, escape): C:\\foo\\bar
If you want a dir output similar to ls, try dir /B

(Jeremy Howard (Admin)) #67

All the python stuff should work fine with linux-style paths. So best approach is to avoid shell commands and use only python functions. That way the notebooks can all be cross-platform. I’m happy to accept PRs that make this change BTW.

(Andrea de Luca) #68

Thanks for your feedback and advices, @jeremy! :slight_smile:

(ecdrid) #69

Yep I have figured these out …
But when we try to use inbuilt methods for training and all, it will fail …(had tried it out)

Also we can use
Path as data\\kaggle\\dogscats\\

(Andrea de Luca) #70

I bet it says

Expected object of type Variable[torch.cuda.LongTensor] but found type Variable[torch.cuda.IntTensor] for argument #1 'target'

It’s another windows related issue.

Check that (@jeremy replies to that fella) :

You have to patch fastai library (check the related functions) and perform a manual cast to long (.long()).

Mh, I wonder if that will force the GPU to use its crippled double-precision cores…

Don’t know… I’m starting to having doubts about the feasibility of a windows setup for, at least till official pytorch for windows will be released. I mean, we can edit the code and solve the issue, it will be even instructive, but the day after we will have to cope with another issue, and so on… :confused::smirk:

(ecdrid) #71

But it works perfectly fine for the ML course …( Tried and tested)…

Yep running DL course on Windows is disastrous…
It’s better to use the Linux Subplatform on Windows or do a dual-boot…

(Andrea de Luca) #72

You mean WSL? Cuda won’t work.

Problem is that I have to run stuff on windows while studying DL.

Probably I got to build another box for Linux. Damn, I’m not made of money.


Really great installation instructions.
I tried it and did exactly what was described. Unfortunately I have a problem to import the libraries:
I know that this question has been asked before, but the proposed solution (changing kernel) was not my problem.
I get the follwoing error message in my notebook:

Any Idea what might went wrong, or what I should check?


I don’t think it’s a good idea to replace Linux specific shell commands with Windows shell commands. Why using shell commands that only work in Jupyter notenbooks iso pure python commands that are independent from the os and works everywhere?

(Jeremy Howard (Admin)) #76

Yes that was my suggestion too :slight_smile:

(Jeremy Howard (Admin)) #77

No it won’t impact that. LongTensor is to ints (mainly for target labels) not floats, so this issue doesn’t effect training times at all. Note that LongTensor is what is used automatically on Linux.

(Jeremy Howard (Admin)) #78

I’ve just pushed some updates such that all the linux-specific shell commands in lesson1.ipynb have been removed and replaced with windows-compatible windows functions.

(Jeremy Howard (Admin)) #79

OK I’ve nearly got this all working on Windows without any special install steps (other than mklink). Will try to post something by end of day.

(Andrea de Luca) #80

Thanks @jeremy. Good to know… Patching the code is now a much more attractive option.

You are incredibly supportive given that windows users are, after all, a minority. Thanks a lot :slight_smile:

Does that mean that you patched the code (.long())? :open_mouth::crazy_face:

(Andrea de Luca) #81


Yes, I see you selected the right kernel.

Please just do import fastai. Then copy & paste the output you get.
If fastai installation went on without errors, it is nearly impossible that you cannot import it.

(ecdrid) #82

Thanks a lot for making our life’s simpler…


Hi, Thanks for your quick response.
after I did the installation again I managed to import “fastai.imports”.
But in the next step I get the following dll error message.

any idea, what the reason might be?
Thanks in advance