Fastai2 on Windows

thank you Farid, that would be fantastic. i am just starting to use WSL Ubuntu on Windows… i have lots of issues, some silly questions expected xD

i installed miniconda 3 and did editable fastai2 intall and tried to run jupyter notebook but got error message below. however the notebook runs when i copy and pase the localhost url, so that’s OK for now :slight_smile:

also tried to install cuda drivers as per this instruction but it run out of free space on this Ubuntu WSL. not sure how to increase the disk size on the WSL Ubuntu. like for example i can’t see my other drives that i can access via Windows.
Edit: i was simply running out of space on my disk xD, but as explained below WSL at the moment doesn’t support GPU so will not work anyway.
Windows C drive is mounted at /mnt/c/ on WSL :wink:

thanks a lot!

@miwojc, I would uninstall the miniconda 3 version, and would install the full version of Anaconda.

Here is a video tutorial on how to install Anaconda on ubuntu.

and Here are the instructions that I wrote down while installing mine:

How to install Anaconda 3 on Windows Subsystem Linux
====================================================

$ curl -O https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh

$ sha256sum Anaconda3-2019.10-Linux-x86_64.sh

it will print this :
46d762284d252e51cd58a8ca6c8adc9da2eadc82c342927b2f66ed011d1d8b53 Anaconda3-2019.10-Linux-x86_64.sh

$ bash Anaconda3-2019.10-Linux-x86_64.sh
$ source ~/.bashrc

$ conda list

If you want to install the latest version of Anaconda (for ubuntu), check this link

2 Likes

thank you.
for some reason (anaconda loads a lot of stuff i don’t need) i prefer to use miniconda, which is same but with less packages loaded by default. i use miniconda on native ubuntu installs and it works great with fastai. however if this would fix my issue i am fine to install anaconda!

apart from installing Anaconda and fastai2 did you have to install cuda drivers separately?

Unfortunately, I never used miniconda.

You don’t have to install cuda because it isn’t supported by WSL for now. When, I need to use the GPU, I use the Anaconda version that I installed on Windows: I have the 2 versions installed on the same machine. I also use VSCode, and that way I can open my 2 repos side by side. I always test my project on the 2 platforms.

1 Like

thanks for quick answer!
shame i thought WSL Ubuntu will make use of GPU :frowning:
edit: link to github discussion on adding GPU support to WSL, but for now there is no timeframe set for this… https://github.com/Microsoft/WSL/issues/829

i did try using fastai with GPU on Windows in the past but it had issues, like was very slow compared to with same GPU on linux. Probably had something do to with number of workers but also was kind of hanging in between epochs. i should give it a try now and see if things changed!

You can check this topic that I created a couple of days ago. Check out Nicolas’ 'blog post that he published. I didn’t have the chance to try yet (low priority for now).

If you are successful in doing that, please post your findings.

1 Like

That has certainly been my experience too. And I too hope to see GPU used by WSL2 sometime, but for now I’ll use an Azure VM with Ubuntu and GPU.

1 Like

Thanks Miwojc, I was wondering about that; being confused enough, is enough! I shall heed your advice. Thankfully I haven’t purchased it yet, despite the countless drip-feed follow-ups. I remain unsure as to the depth of coverage despite the claims.
Also, I have discovered and started reading pjh and Silvan’s EXCELLENT BOOK - this is by far the best preparatory activity in anticipation of the course. As well, reading some (or ALL) of Rachael’s work is magic.
Thanks Miwojc - some of my best friends are Polish!,
Cheers, p

1 Like

Salut,
I hope this post is rightly placed here…
I have starfted with fastai and executed the following command in the python shell:
from fastai.vision import *
from fastai.callbacks.one_cycle import *
path = untar_data(URLs.MNIST_SAMPLE)
data = ImageDataBunch.from_folder(path)
model = simple_cnn((3,16,16,2))
learn = Learner(data, model)
learn.metrics=[accuracy]
learn.fit(1)

It works fine but when I copy it into a file test.py and call python I get an error when learn.fit(1) starts.
File “C:\Program Files\Python37\lib\multiprocessing\spawn.py”, line 136, in _check_not_importing_main
is not going to be frozen to produce an executable.’’’)
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

I do not unxderstand why I can run code interactively but not as a python file
Ciao, mathias

2 Likes

rgs)
478 # We may need to call lazy init again if we are a forked child
479 # del _CudaBase.new
–> 480 return super(_CudaBase, cls).new(cls, *args, **kwargs)
481
482

RuntimeError: CUDA error: the launch timed out and was terminated

getting this error on Window10, suspect is the dataloader num_workers issue, but I have tried to set num_workers=0, no luck yet.

Hi guys, I’m trying to run the FastAI2 pets lesson 1 after installing it in a Win10 (editable install), every time I try to load the main libraries I get an error stating that: name ‘log_args’ is not defined. Any chance anyone has some insight to provide?

from fastai2.basics import *
from fastai2.callback.all import *
from fastai2.vision.all import *
from nbdev.showdoc import *

---------------------------------------------------------------------------

NameError Traceback (most recent call last)
in
----> 1 from fastai2.basics import *
2 from fastai2.callback.all import *
3 from fastai2.vision.all import *
4 from nbdev.showdoc import *

d:\fai2\fastai2\fastai2\basics.py in
----> 1 from .data.all import *
2 from .optimizer import *
3 from .callback.core import *
4 from .learner import *
5 from .metrics import *

d:\fai2\fastai2\fastai2\data\all.py in
----> 1 from …torch_basics import *
2 from .core import *
3 from .load import *
4 from .external import *
5 from .transforms import *

d:\fai2\fastai2\fastai2\torch_basics.py in
3 from .torch_imports import *
4 from .torch_core import *
----> 5 from .layers import *

d:\fai2\fastai2\fastai2\layers.py in
271
272 # Cell
–> 273 @log_args
274 @funcs_kwargs
275 class BaseLoss():

NameError: name ‘log_args’ is not defined

I tried updating the libraries with git pull and tried importing functions in a more verbose way but I can’t get it to go.

If you use an editable install of fastai2, you also need an editable install of fastcore, and you have to make sure you are always updating them both together.

2 Likes

Seem to be getting the same error too. Running on Google Colab. Had been working a few days ago. Should be using the latest master because did a fresh install. Looks like that line was also changed 2 days ago.

NameError                                 Traceback (most recent call last)
<ipython-input-4-97b9dd603d64> in <module>()
----> 1 from fastai2.vision.all import *

4 frames
/usr/local/lib/python3.6/dist-packages/fastai2/layers.py in <module>()
    271 
    272 # Cell
--> 273 @log_args
    274 @funcs_kwargs
    275 class BaseLoss():

NameError: name 'log_args' is not defined
1 Like

You need to install the most recent version of fastcore along with this (the dev version ideally)

3 Likes

ah, okay got it, it’s working for me now. Thanks!

I downgraded pytorch to 1.2.0 as recommended. It seems working, then I update fastai2, it downgrade my fastcore and have the following error. It unstalled my fastcore, but it seems install the same version again. Any idea to fix it?
ERROR: fastai2 0.0.17 has requirement torch>=1.3.0, but you’ll have torch 1.2.0 which is incompatible.
ERROR: fastai2 0.0.17 has requirement torchvision>=0.5, but you’ll have torchvision 0.4.0 which is incompatible. I updated my fastcore and the nameError ‘log_args’ is not defined’ and now this error shown up again. Current fastcore=0.1.17.

fastai requires PyTorch 1.3.1 minimum, so you need to install this version (or wait for PyTorch to release it if it’s not available already).
As for the log_args, it’s because you need to do an editable install of fastcore to go with your editable install of fastai2.

1 Like

You need to install the PyTorch 1.4 release for Windows.

1 Like

I think Windows may not be appropriate for DL practice. Although I use Windows for DL, I find it better to train the methods in Cloud or Linux environment.

OK.
I just want to clarify the following side note from Jeremy is for Colab in Window and not window in general. I will try the latest pytorch. Thanks.

A side note for windows:
Currently, pytorch==1.2.0 torchvision==0.4.0 is recomended and working (1.3.1 is not available on offical pytorch site and 1.4 is most recent but not working properly.)
In