Windows 10 install guide for fastai v3

Hello, my guide on How to install fastai v1 on Windows 10. Hope it can help.

7 Likes

thanks @pierreguillou for the guide. after following it i have successfully imported fastai library, however i cannot go past this instruction (lesson1-pets.ipynb)
image
it stays there with “*” forever :frowning:
any idea how to fix this? thanks!

Hello @miwojc. I do not know what is happening but first of all, you need to check your installation.
For that, run the following command in your Anaconda Prompt terminal (after activation of your fastai environment):

python -m fastai.utils.show_install

You should get something like:

=== Software ===
python        : 3.6.8
fastai        : 1.0.46
fastprogress  : 0.1.19
torch         : 1.0.0
torch cuda    : 9.0 / is available
torch cudnn   : 7005 / is enabled

=== Hardware ===
torch devices : 1
  - gpu0      : GeForce GTX 1070

=== Environment ===
platform      : Windows-10-10.0.17134-SP0
conda env     : fastai_v1
python        : C:\user_path\Anaconda3\envs\fastai_v1\python.exe
sys.path      :
C:\user_path\Anaconda3\envs\fastai_v1\python36.zip
C:\user_path\Anaconda3\envs\fastai_v1\DLLs
C:\user_path\Anaconda3\envs\fastai_v1\lib
C:\user_path\Anaconda3\envs\fastai_v1
C:\user_path\Anaconda3\envs\fastai_v1\lib\site-packages
no nvidia-smi is found

If yes, I believe that your fastai installation is well done. My advice would be to restart your computer and see if you can reproduce the same error.

3 Likes

You most likely will have to downgrade your pytorch installation.

2 Likes

@pierreguillou , your guide is really great! Thanks for sharing!

1 Like

This is most likely the torch 1.0.1 hang issue.

To falsify that can you please do a ‘conda list’ and report back the pytorch version?

If it is pytorch 1.0.1 please do conda uninstal pytorch followed by conda install pytorch==1.0.0 - that should get rid of the hang.

In antly case it’s currently filed here. I should get to in a day or 2 but if someone else has spare cycles they are welcome to take it up.

2 Likes

thank you @pierreguillou @partho @ilovescience
i have downgraded torch
installed torchvision
upgraded conda and fastai (fastai updated to 1.0.38)
changed regex for windows

and was able to train network, however it kind of hangs in between epochs, once in epoch it run fast but in between epochs there is a long wait time like 2 minutes or so. it took 6 minutes to train on 2070
image
not sure what could be the issue?

=== Software ===
python        : 3.6.8
fastai        : 1.0.38
fastprogress  : 0.1.20
torch         : 1.0.0
torch cuda    : 9.0 / is available
torch cudnn   : 7005 / is enabled

=== Hardware ===
torch devices : 1
  - gpu0      : GeForce RTX 2070

=== Environment ===
platform      : Windows-10-10.0.17134-SP0
conda env     : fastai
python        : C:\Users\pc\Anaconda3\envs\fastai\python.exe
sys.path      :
C:\Users\pc\Anaconda3\envs\fastai\python36.zip
C:\Users\pc\Anaconda3\envs\fastai\DLLs
C:\Users\pc\Anaconda3\envs\fastai\lib
C:\Users\pc\Anaconda3\envs\fastai
C:\Users\pc\Anaconda3\envs\fastai\lib\site-packages
C:\Users\pc\Anaconda3\envs\fastai\lib\site-packages\win32
C:\Users\pc\Anaconda3\envs\fastai\lib\site-packages\win32\lib
C:\Users\pc\Anaconda3\envs\fastai\lib\site-packages\Pythonwin
no nvidia-smi is found

Hi @pierreguillou @partho @ilovescience , I got kind of a similar problem here. Execution is very slow and freezes at creat_cnn comand. Then I did a “torch.cuda.is_available()” command and it returned “false”.
My laptop is a MSI GS65 with GTX 1070.
My installation is:

=== Software ===
python       : 3.6.8
fastai       : 1.0.46
fastprogress : 0.1.20
torch        : 1.0.1
torch cuda   : 10.0 / is **Not available**

=== Hardware ===
No GPUs available

=== Environment ===
platform     : Windows-10-10.0.17134-SP0
conda env    : fastai_v1
python       : C:\Users\Fernando\Anaconda3\envs\fastai_v1\python.exe
sys.path     :
C:\Users\Fernando\Anaconda3\envs\fastai_v1\python36.zip
C:\Users\Fernando\Anaconda3\envs\fastai_v1\DLLs
C:\Users\Fernando\Anaconda3\envs\fastai_v1\lib
C:\Users\Fernando\Anaconda3\envs\fastai_v1
C:\Users\Fernando\Anaconda3\envs\fastai_v1\lib\site-packages
no supported gpus found on this system

Any idea on how to fix this? Thanks !

[ EDIT ] : better code in this post.


Hello @NandoBr. You have the wrong Pytorch version (torch : 1.0.1). You must have 1.0.0.
You can run the 2 following lines to solve the problem (inspiration from the post of @partho) :

conda uninstall pytorch
conda install fastai pytorch=1.0.0 -c fastai -c pytorch -c conda-forge

The first line will uninstall fastai, pytorch and torchvision.
The second one will install the right versions of fastai (the official one), pytorch (1.0.0) and torchvision (note: conda install fastai pytorch=1.0.0 -c fastai -c pytorch could be enough, but the addition of the conda-forge channel allows to get for sure the official version of fastai).

I’ve updated my medium post with them.

2 Likes

Hi @partho. Just to say you are right in the process (uninstall pytorch and then, install version 1.0.0 of pytorch) but the right lines are the following ones because conda uninstall pytorch uninstall as well fastai and torchvision:

conda uninstall pytorch
conda install fastai pytorch=1.0.0 -c fastai -c pytorch -c conda-forge

Hi @pierreguillou. Thanks for your medium post it is very useful. I followed your instructions and installed the following environment:

=== Software ===
python        : 3.6.8
fastai        : 1.0.46
fastprogress  : 0.1.20
torch         : 1.0.0
torch cuda    : 9.0 / is available
torch cudnn   : 7005 / is enabled

=== Hardware ===
torch devices : 1
  - gpu0      : GeForce GTX 1080

=== Environment ===
platform      : Windows-10-10.0.16299-SP0
conda env     : fastai_v1
python        : C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\python.exe
sys.path      :
C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\python36.zip
C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\DLLs
C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib
C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1
C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages
no nvidia-smi is found

When I run any notebook I get an error which points to a problem with tornado and nbconvert.
Here are their versions:

# Name                    Version                   Build  Channel
tornado                   6.0.1            py36hfa6e2cd_0    conda-forge

(fastai_v1) C:\sandbox\course-v3>conda list nbconvert
# packages in environment at C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1:
#
# Name                    Version                   Build  Channel
nbconvert                 5.3.1                    py36_0

There is in fact a bug report for this already:

I’m curious what versions of fastai, nbconvert, and tornado you are using successfully. Any suggestions on how to change/downgrade versions would be appreciated! When I try to uninstall tornado it wants to uninstall fastai and many other dependencies.

Exception details below:

E 17:15:24.511 NotebookApp] Uncaught exception GET /notebooks/nbs/dl1/00_notebook_tutorial.ipynb (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/notebooks/nbs/dl1/00_notebook_tutorial.ipynb', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\tornado\web.py", line 1697, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\tornado\web.py", line 3174, in wrapper
        return method(self, *args, **kwargs)
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\notebook\notebook\handlers.py", line 59, in get
        get_custom_frontend_exporters=get_custom_frontend_exporters
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\notebook\base\handlers.py", line 462, in render_template
        return template.render(**ns)
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\jinja2\asyncsupport.py", line 76, in render
        return original_render(self, *args, **kwargs)
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\jinja2\environment.py", line 1008, in render
        return self.environment.handle_exception(exc_info, True)
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\jinja2\environment.py", line 780, in handle_exception
        reraise(exc_type, exc_value, tb)
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\jinja2\_compat.py", line 37, in reraise
        raise value.with_traceback(tb)
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\notebook\templates\notebook.html", line 1, in top-level template code
        {% extends "page.html" %}
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\notebook\templates\page.html", line 154, in top-level template code
        {% block header %}
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\notebook\templates\notebook.html", line 120, in block "header"
        {% for exporter in get_custom_frontend_exporters() %}
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\notebook\notebook\handlers.py", line 19, in get_custom_frontend_exporters
        from nbconvert.exporters.base import get_export_names, get_exporter
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\nbconvert\__init__.py", line 7, in <module>
        from . import postprocessors
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\nbconvert\postprocessors\__init__.py", line 5, in <module>
        from .serve import ServePostProcessor
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\nbconvert\postprocessors\serve.py", line 19, in <module>
        class ProxyHandler(web.RequestHandler):
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\nbconvert\postprocessors\serve.py", line 21, in ProxyHandler
        @web.asynchronous
    AttributeError: module 'tornado.web' has no attribute 'asynchronous'
[E 17:15:24.526 NotebookApp] {
      "Host": "localhost:8888",
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
      "Accept-Language": "en-US,en;q=0.5",
      "Accept-Encoding": "gzip, deflate",
      "Referer": "http://localhost:8888/tree/nbs/dl1",
      "Connection": "keep-alive",
      "Cookie": "username-localhost-8888=\"2|1:0|10:1551737682|23:username-localhost-8888|44:NWIwYjA5OTlhOGY1NGE5ZDg0ODhmYzBjM2NkMDc2N2Y=|d8ee8e494b7789f8ff2961c53344a3cb4003df5e89c5526312d0b95b605add10\"; _xsrf=2|7026f6dd|d73694ff5614dc301cc7515c72703e9d|1551734957",
      "Upgrade-Insecure-Requests": "1"
    }
[E 17:15:24.526 NotebookApp] 500 GET /notebooks/nbs/dl1/00_notebook_tutorial.ipynb (::1) 109.39ms referer=http://localhost:8888/tree/nbs/dl1

Thank you!

Hi @turntwo463.

I have fastai 1.0.46 installed and in my fastai environment, I have the following versions of tornado and nbconvert:

(fastai_v1) C:\user_path>conda list nbconvert
# packages in environment at C:\user_path\Anaconda3\envs\fastai_v1:
#
# Name                    Version                   Build  Channel
nbconvert                 5.3.1                    py36_0

(fastai_v1) C:\user_path>conda list tornado
# packages in environment at C:\user_path\Anaconda3\envs\fastai_v1:
#
# Name                    Version                   Build  Channel
tornado                   5.1.1            py36hfa6e2cd_0

I do not know why you have tornado version 6.0.1.

You could try:

conda uninstall tornado
conda install fastai pytorch=1.0.0 -c fastai -c pytorch -c conda-forge

Hi @pierreguillou

I believe tornado 6 release came out in the last day or two. So if the fastai build specifies to get the latest version, I believe that is how I wind up with tornado 6.

I already started with the command:

conda install fastai pytorch=1.0.0 -c fastai -c pytorch -c conda-forge

so don’t think that will help.

Sounds like I may need to dig into the fastai build scripts and hardcode dependencies to the older versions of tornado and nbconvert. Does that make sense?

Thanks again.

Hi @pierreguillou

I was able to get the notebook running by uninstalling/reinstalling tornado, and then reinstalling several dependencies that were removed as part of the tornado uninstall.

I’m not claiming this is the optimal approach, but here are my steps:

conda uninstall tornado
conda install tornado=5.1.1
conda install fastai pytorch=1.0.0 -c fastai -c pytorch -c conda-forge
conda install nbconvert
conda install jupyter -c conda-forge

Hey @pierreguillou, you will need to do conda uninstall --force

this long wait between epochs seems to be related to pytorch issue on windows, documented here Unexplained long delay between batches with little/no CPU, GPU, or Disk activity
i have set num_workers=0 and now epochs start instantly and there is no long wait but the epochs take longer. so in total it took 10 minutes. which is worse than before…
image

1 Like

Hello @partho. Thanks for your return. Could you confirm that the following code is correct in order to uninstall pytorch, install the pytorch version 1.0.0 and keep installed fastai and torchvision ?

conda uninstall pytorch --force
conda install pytorch=1.0.0

[ EDIT ] I tested and it works great! With conda uninstall pytorch --force, no need to reinstall all libraries but just pytorch. Thanks Partho :slight_smile:

Hi @miwojc. I’ve updated my medium post with num_workers=0 in the databunch in order to improve the training time by epoch on windows pytorch but I wrote that others parameters could alter this as well.
If @sgugger could give us his point of view, it would be very helpul :slight_smile:

Thanks @pierreguillou,
Your instructions solved my problem about GPU not available(described in post above ).
In my case, I downgraded pytorch version from 1.0.1 to 1.0.0 with the command below:

conda uninstall pytorch
conda install fastai pytorch=1.0.0 -c fastai -c pytorch -c conda-forge

Be aware that the command “conda uninstall pytorch” will remove fastai, pytorch and torchvision.
That’s why , in the second command above, you have to install fastai and pytorch.

Now , Fastai is running smoothly on my windows 10 laptop with 1070 GPU.
My installation is like this:

=== Software ===
python        : 3.6.8
fastai        : 1.0.46
fastprogress  : 0.1.20
torch         : 1.0.0
torch cuda    : 9.0 / is available
torch cudnn   : 7005 / is enabled

=== Hardware ===
torch devices : 1
  - gpu0      : GeForce GTX 1070 with Max-Q Design

=== Environment ===
platform      : Windows-10-10.0.17134-SP0
conda env     : fastai_v1
python        : C:\Users\Fernando\Anaconda3\envs\fastai_v1\python.exe
sys.path      :
C:\Users\Fernando\Anaconda3\envs\fastai_v1\python36.zip
C:\Users\Fernando\Anaconda3\envs\fastai_v1\DLLs
C:\Users\Fernando\Anaconda3\envs\fastai_v1\lib
C:\Users\Fernando\Anaconda3\envs\fastai_v1
C:\Users\Fernando\Anaconda3\envs\fastai_v1\lib\site-packages
no nvidia-smi is found
1 Like

Hello @NandoBr. Thank you for your message and happy to read that you have solved your problem :slight_smile:

An improvement: thanks to @partho, there is a simplest solution to change the pytorch version without removing then reinstalling all libraries.

conda uninstall pytorch --force
conda install pytorch=1.0.0

I’ve updated my medium post with this code.