# How to set up Windows 10 for fast.ai

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

(Andrea de Luca) #64

A true ordeal indeed…

#65

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

#### 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:

#### 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…

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

### Footnote:

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
Etc…

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

(ecdrid) #69

Yep I have figured these out …
But when we try to use fast.ai 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'

### Check that (@jeremy replies to that fella) :

#### Don’t know… I’m starting to having doubts about the feasibility of a windows setup for fast.ai, 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…

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

#73

Hi,
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?
Regards
Mike

#75

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?

Yes that was my suggestion too

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.

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.

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

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

(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…

#83

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?