Windows 10 install guide for fastai v3

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      :
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\", 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\", 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\", line 59, in get
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\notebook\base\", line 462, in render_template
        return template.render(**ns)
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\jinja2\", 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\", 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\", 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\", 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\", 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\", line 7, in <module>
        from . import postprocessors
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\nbconvert\postprocessors\", line 5, in <module>
        from .serve import ServePostProcessor
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\nbconvert\postprocessors\", line 19, in <module>
        class ProxyHandler(web.RequestHandler):
      File "C:\Users\lproc\AppData\Local\Continuum\anaconda3\envs\fastai_v1\lib\site-packages\nbconvert\postprocessors\", line 21, in ProxyHandler
    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…

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

I encountered the same problem as the person starting this thread: whatever I try: conda: command not found. I do see a lot of conda files in the directory fastai/conda.

Did you encounter any of this at all?

I think perhaps anaconda is not correctly added to your PATH variable?

Thanks so much for the guide, it allowed me to open the fastai Jupyter notebook after following it. Hopefully I don’t get any errors running the course! I’ll report back when I’m through it all.

1 Like

Happy :slight_smile:

1 Like

Hi, I am trying to install Fast AI from a windows host PC onto AWS and after the SSH phase, I try to

conda update conda

I get a error of “conda: command not found”

Did you find a solution?

I did the whole ML in 2018 and I didn’t have any problems back then…

The new conda install is not added to path by default anymore. So try to add it to your path.

Thank you for the reply but I’ve found out that I needed to

source ~/.bashrc


conda update conda

Hello @pierreguillou,
I’m having the same issue with ModuleNotFoundError: No module named 'torch' when I run the first cell. In the Anaconda3 Prompt I entered python -m fastai.utils.show_install and got:
C:\Users\92175\Anaconda3\python.exe: Error while finding module specification for 'fastai.utils.show_install' (ModuleNotFoundError: No module named 'fastai.utils')

However when I click on Environments in Anaconda Navigator, I see fastai as one of them, and I have all 5 packages installed (torch, pytorch, torchvision, etc). Any idea what might be wrong?

“show_install” moved.
From a repl or notebook, you can import it and run it as follows:
from fastai import test_utils; fastai.test_utils.show_install(1)
or from a shell prompt you can run
python -c "from fastai import test_utils; fastai.test_utils.show_install(1)"

Did you drop a symbolic link to fastai/fastai in the course folder?

Not doing this caused a similar problem for me.