Howto: installation on Windows

Hello, everybody. I’m new to deep learning and at the very beginning I got some problems. I did the steps(1, 2, 3) and during conda env update I got such errors:
Exception:
Traceback (most recent call last):
File “D:\Anaconda\envs\fastai\lib\site-packages\pip_vendor\pkg_resources_ init .py”, line 2869, in dep_map
return self.
dep_map
File "D:\Anaconda\envs\fastai\lib\site-packages\pip_vendor\pkg_resources
init
.py", line 2663, in getattr
raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “D:\Anaconda\envs\fastai\lib\site-packages\pip_vendor\packaging\requirements.py”, line 93, in init
req = REQUIREMENT.parseString(requirement_string)
File “D:\Anaconda\envs\fastai\lib\site-packages\pip_vendor\pyparsing.py”, line 1632, in parseString
raise exc
File “D:\Anaconda\envs\fastai\lib\site-packages\pip_vendor\pyparsing.py”, line 1622, in parseString
loc, tokens = self._parse( instring, 0 )
File “D:\Anaconda\envs\fastai\lib\site-packages\pip_vendor\pyparsing.py”, line 1379, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File “D:\Anaconda\envs\fastai\lib\site-packages\pip_vendor\pyparsing.py”, line 3395, in parseImpl
loc, exprtokens = e._parse( instring, loc, doActions )
File “D:\Anaconda\envs\fastai\lib\site-packages\pip_vendor\pyparsing.py”, line 1383, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File “D:\Anaconda\envs\fastai\lib\site-packages\pip_vendor\pyparsing.py”, line 3183, in parseImpl
raise ParseException(instring, loc, self.errmsg, self)
pip._vendor.pyparsing.ParseException: Expected stringEnd (at char 33), (line:1, col:34)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “D:\Anaconda\envs\fastai\lib\site-packages\pip_vendor\pkg_resources_ init _.py”, line 2949, in init
super(Requirement, self). init (requirement_string)
File “D:\Anaconda\envs\fastai\lib\site-packages\pip_vendor\packaging\requirements.py”, line 97, in init
requirement_string[e.loc:e.loc + 8]))
pip._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at “’; extra '”

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “D:\Anaconda\envs\fastai\lib\site-packages\pip_internal\basecommand.py”, line 141, in main
status = self.run(options, args)
File “D:\Anaconda\envs\fastai\lib\site-packages\pip_internal\commands\install.py”, line 299, in run
resolver.resolve(requirement_set)
File “D:\Anaconda\envs\fastai\lib\site-packages\pip_internal\resolve.py”, line 102, in resolve
self.resolve_one(requirement_set, req)
File “D:\Anaconda\envs\fastai\lib\site-packages\pip_internal\resolve.py”, line 306, in resolve_one
set(req_to_install.extras) - set(dist.extras)
File "D:\Anaconda\envs\fastai\lib\site-packages\pip_vendor\pkg_resources
init
.py", line 2826, in extras
return [dep for dep in self. dep_map if dep]
File “D:\Anaconda\envs\fastai\lib\site-packages\pip_vendor\pkg_resources_ init
.py”, line 2871, in dep_map
self.
dep_map = self. compute_dependencies()
File “D:\Anaconda\envs\fastai\lib\site-packages\pip_vendor\pkg_resources_ init
.py”, line 2881, in compute_dependencies
reqs.extend(parse_requirements(req))
File “D:\Anaconda\envs\fastai\lib\site-packages\pip_vendor\pkg_resources_ init
.py”, line 2942, in parse_requirements
yield Requirement(line)
File “D:\Anaconda\envs\fastai\lib\site-packages\pip_vendor\pkg_resources_ init
.py”, line 2951, in init
raise RequirementParseError(str(e))
pip._vendor.pkg_resources.RequirementParseError: Invalid requirement, parse error at “’; extra '”

I’m running windows 10-x.64 with Cuda 9.0

Could anybody help me with these problems?

i am having the same issue. please let me if you were able to resolve it

I’m running windows 10-x.64 with Cuda 8.0

I was able to get the cpu version set up by commenting the #- conda-forge::jupyter_contrib_nbextensions on environment-cpu.yml file. so somehow it seems like the issue is with the GPU.

I was able to make it work for GPU as well following are some of the steps i did.

  • Installed cuda 9.0 and cudann
  • installed pytorch from https://github.com/peterjc123/pytorch-scripts as i was not able to find windows whl for version less than 0.4
  • installed conda install -c anaconda bcolz
  • Pip install Fastai

Then everything works.

I think I might be closer to getting install. I was getting shapely error. I tried all the upgrade pip/conda and nothing worked. However, I went into Anaconda navigator and added into FastAI env via there. Now I’m erroring on Fiona. I will attempt to resolve it via Navigator environment as well. Visual Studio failed on Fiona with cpl_conv.h not found.

Update
Installing Fiona via Navigator resolved. I was able to complete the conda env update with no errors but listed two incompatibilities.

Going back to conda env update, I have 2 warnings only
I am getting error on batchsampler when trying to import fastai. Resolved it by updating torch but I think I had the right version.

Now erroring on dataclasses. Tried update env. I have two warnings:

pexpect 4.6.0 requires ptyprocess>=0.5, which is not installed.
spacy 2.0.12 has requirement regex==2017.4.5, but you’ll have regex 2018.7.11 which is incompatible.

Updated python.exe -m pip install --upgrade pip

pip install dataclasses

Now erroring on BatchSampler. Not an easy install.

3 Likes

change to symlink to the old fastai …\old\fastai as mentioned here. It seems that changes have been made to make use of pytorch 0.4.1 features but the setup process is still using 0.3.1, hence the errors in importing

1 Like

Hi,
Really great installation instructions.
I tried it and did exactly what was described.in Unfortunately I have a problem to import the libraries:
I get the following error message

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

Thanks,
Ritika

Did you get it to work yet? Getting the same error and unable to fix it.

Or maybe @pverma found a solution?

Would love to run it on my Windows desktop PC so I don’t have to rent a server…

Hello!

I have successfully created the fastai envionment for this course…
It was very painful, I had been trying for 10 days and the solution was very simple indeed.
The catch is pay attention to the error printed in the cmd and install C++ support packages in your system.
I have tried almost everything but none was working. Once I was done with the C++ stuff, everything went smoothly.

The steps that I followed were:

  1. Install visual studio with workload “Desktop development with C++”. I used Visual Studio 2017.
  2. Follow first 4 steps of Jenemy top post.
  3. add this line to the environment.yml file below the dependencies line
  • conda-forge::fiona>=1.7.13
  1. follow Jeremy 5 to 8 steps.

It will work.

I am using Win 7 64 bit, NVIDIA quadro P5000.

1 Like

I am trying to setup fastai environment on my local machine and was following the new instructions i.e. cloning the repo https://github.com/fastai/fastai and on running conda env update, I am facing the below ResolvePackageNotFound: error.

image

I even tried installing testpath version 0.4.2 still facing the same issue.

1 Like

yes, conda is slow to update - it’s on conda-forge or pip. please try again after git pull

Hi @stas,

I tried conda env update after doing git pull, but now am facing some different issue -

Collecting pyproj (from geopandas>=0.3.0->plotnine->-r C:\Users\Divyojyoti Sinha\fastai\condaenv.mnwiukfl.requirements.txt (line 9))
  Using cached https://files.pythonhosted.org/packages/29/72/5c1888c4948a0c7b736d10e0f0f69966e7c0874a660222ed0a2c2c6daa9f/pyproj-1.9.5.1.tar.gz
    Complete output from command python setup.py egg_info:
    using bundled proj4..
    Traceback (most recent call last):
      File "C:\Users\Divyojyoti Sinha\Anaconda3\envs\fastai\lib\site-packages\setuptools\msvc.py", line 489, in _find_latest_available_vc_ver
        return self.find_available_vc_vers()[-1]
    IndexError: list index out of range

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\DIVYOJ~1\AppData\Local\Temp\pip-install-fv1hjxsm\pyproj\setup.py", line 72, in <module>
        objects = cc.compile(['nad2bin.c', 'src/pj_malloc.c'])
      File "C:\Users\Divyojyoti Sinha\Anaconda3\envs\fastai\lib\distutils\_msvccompiler.py", line 345, in compile
        self.initialize()
      File "C:\Users\Divyojyoti Sinha\Anaconda3\envs\fastai\lib\distutils\_msvccompiler.py", line 238, in initialize
        vc_env = _get_vc_env(plat_spec)
      File "C:\Users\Divyojyoti Sinha\Anaconda3\envs\fastai\lib\site-packages\setuptools\msvc.py", line 185, in msvc14_get_vc_env
        return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
      File "C:\Users\Divyojyoti Sinha\Anaconda3\envs\fastai\lib\site-packages\setuptools\msvc.py", line 843, in __init__
        self.si = SystemInfo(self.ri, vc_ver)
      File "C:\Users\Divyojyoti Sinha\Anaconda3\envs\fastai\lib\site-packages\setuptools\msvc.py", line 485, in __init__
        self.vc_ver = vc_ver or self._find_latest_available_vc_ver()
      File "C:\Users\Divyojyoti Sinha\Anaconda3\envs\fastai\lib\site-packages\setuptools\msvc.py", line 492, in _find_latest_available_vc_ver
        raise distutils.errors.DistutilsPlatformError(err)
    distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\DIVYOJ~1\AppData\Local\Temp\pip-install-fv1hjxsm\pyproj\

CondaValueError: pip returned an error

Looks like some issue with your pip/system configuration (unrelated to fastai), as usual google it, which for example suggests: https://stackoverflow.com/a/36025294/9201239 - see if it helps, and then if searching more specifically this one suggests how you can avail your system of compiler tools.

I’m not sure though why is it trying to compile pyproj when it’s available on conda, e.g.: conda install -c anaconda pyproj.

Thanks a lot @stas ,

I was able to install fastai on my machine and was able to execute from fastai.imports import * on jupyter notebook, but am facing the below issue while trying to import the other modules and I feel all these modules are present in the old directory of fastai.

Should I import these modules from old directory?

first, perhaps you could share what changes you applied to fix the installation issue, so that others in your situation will know how to accomplish that themselves.

second, I’d say, first, start with running an existing notebook, like courses/dl1/lesson1.ipynb. which is perhaps is what you’re doing (please give us as many details as possible in the future, we can’t always guess).

there is a symlink courses/dl1/fastai -> ../../old/fastai/ which should point to the v0 version of fastai and should find the right set of fastai modules.

if somehow this doesn’t work, try:

import sys
print(sys.path)

and you will now know what directories python is searching. then you can see whether it finds old/fastai library.

Perhaps the symlink is not working under windows? I remember it wasn’t working the past, perhaps it’s still the case.

update: Jeremy moved it into the right thread, so please read the first post for what you need to do. On windows the symlinks working differently.

1 Like

spent the last 1 1/2 days trying to get up and running with lesson 1. after a bit of work and updating C++, reinstalling all of anaconda (p36), running prompt using admin rights, and manually installing shapely, the conda env update step ran successfully and I followed the rest of instructions.

When I got into jupyter notebook and opened lesson 1 ipynb, I get a “Kernel Dead” message with the following log:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\web.py", line 1512, in _execute
    result = yield result
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\gen.py", line 1055, in run
    value = future.result()
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\concurrent.py", line 238, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 4, in raise_exc_info
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\gen.py", line 1063, in run
    yielded = self.gen.throw(*exc_info)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\notebook\services\sessions\handlers.py",     line 73, in post
    type=mtype))
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\gen.py", line 1055, in run
    value = future.result()
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\concurrent.py", line 238, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 4, in raise_exc_info
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\gen.py", line 1063, in run
    yielded = self.gen.throw(*exc_info)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-    packages\notebook\services\sessions\sessionmanager.py", line 79, in create_session
    kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\gen.py", line 1055, in run
    value = future.result()
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\concurrent.py", line 238, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 4, in raise_exc_info
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\gen.py", line 1063, in run
    yielded = self.gen.throw(*exc_info)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-    packages\notebook\services\sessions\sessionmanager.py", line 92, in start_kernel_for_session
    self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\gen.py", line 1055, in run
    value = future.result()
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\concurrent.py", line 238, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 4, in raise_exc_info
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\gen.py", line 307, in wrapper
    yielded = next(result)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-    packages\notebook\services\kernels\kernelmanager.py", line 160, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\jupyter_client\multikernelmanager.py", line     110, in start_kernel
    km.start_kernel(**kwargs)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\jupyter_client\manager.py", line 259, in     start_kernel
    **kw)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\jupyter_client\manager.py", line 204, in _launch_kernel
    return launch_kernel(kernel_cmd, **kw)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\jupyter_client\launcher.py", line 128, in     launch_kernel
    proc = Popen(cmd, **kwargs)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\subprocess.py", line 997, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

Any idea? I can’t tell from here what is missing?

UPDATE: Thinking tornado needed to be installed I tried conda install -n fastai tornado. This ran successfully, but still receiving same message as before :frowning:

UPDATE: Removed the fastai environment and going to try conda env update again fresh to see if I missed something along the way…

After the refresh of the fastai conda env, got this warning:

  The script plasma_store.exe is installed in 'C:\ProgramData\Anaconda3\envs\fas
tai\Scripts' which is not on PATH.
    Consider adding this directory to PATH or, if you prefer to suppress this warn
ing, use --no-warn-script-location.
    The script pbr.exe is installed in 'C:\ProgramData\Anaconda3\envs\fastai\Scrip
ts' which is not on PATH.
    Consider adding this directory to PATH or, if you prefer to suppress this warn
ing, use --no-warn-script-location.
    The script kg.exe is installed in 'C:\ProgramData\Anaconda3\envs\fastai\Script
s' which is not on PATH.
    Consider adding this directory to PATH or, if you prefer to suppress this warn
ing, use --no-warn-script-location.

Added this to system variable PATH, but still same issue with dead kernel after activating fastai, adding link, and running jupyter notebook:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\web.py", line 1512, in _execute
    result = yield result
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\gen.py", line 1055, in run
    value = future.result()
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\concurrent.py", line 238, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 4, in raise_exc_info
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\gen.py", line 1063, in run
    yielded = self.gen.throw(*exc_info)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\notebook\services\sessions\handlers.py",     line 73, in post
    type=mtype))
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\gen.py", line 1055, in run
    value = future.result()
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\concurrent.py", line 238, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 4, in raise_exc_info
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\gen.py", line 1063, in run
    yielded = self.gen.throw(*exc_info)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-    packages\notebook\services\sessions\sessionmanager.py", line 79, in create_session
    kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\gen.py", line 1055, in run
    value = future.result()
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\concurrent.py", line 238, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 4, in raise_exc_info
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\gen.py", line 1063, in run
    yielded = self.gen.throw(*exc_info)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-    packages\notebook\services\sessions\sessionmanager.py", line 92, in start_kernel_for_session
    self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\gen.py", line 1055, in run
    value = future.result()
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\concurrent.py", line 238, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 4, in raise_exc_info
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\tornado\gen.py", line 307, in wrapper
    yielded = next(result)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-    packages\notebook\services\kernels\kernelmanager.py", line 160, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\jupyter_client\multikernelmanager.py", line     110, in start_kernel
    km.start_kernel(**kwargs)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\jupyter_client\manager.py", line 259, in     start_kernel
    **kw)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\jupyter_client\manager.py", line 204, in _launch_kernel
    return launch_kernel(kernel_cmd, **kw)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\site-packages\jupyter_client\launcher.py", line 128, in     launch_kernel
    proc = Popen(cmd, **kwargs)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "C:\ProgramData\Anaconda3\envs\fastai\lib\subprocess.py", line 997, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

If you’re on lesson 1, you probably don’t want to be setting up this from scratch on Windows - have you considered just using Paperspace? Everything is set up and ready to go there. Once you get going, you can come back and set up Windows if you find you’re needing to do so.

Definitely Considered! Just have this gaming rig with a Nvidia card in it and wanted to put some neural nets through it other than games :smiley:

to follow up to my prior issue, looks like it was a self-inflicted anaconda wound! After searching around for “jupyter kernel dead won’t restart” I landed on:

Apparently after multiple installs of anaconda you end up with a few kernel.json files (check the two highlighted)

when I compare the paths inside, the one in \envs\fastai… had the path:
C:/ProgramData/Anaconda3//envs/fastai/bin/python

while the main one in \share\jupyter… had:
C:\\ProgramData\\Anaconda3\\python.exe

After replacing the path from the fastai kernels.json with the one that contained the .exe , voila! Now the notebook successfully loads with a ready kernel!

Albeit another error on not finding spacy when trying to import

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-c51a52575a56> in <module>()
      1 # This file contains all the main external libs we'll use
----> 2 from fastai.imports import *

~\Documents\GitHub\fastai\courses\dl1\fastai\__init__.py in <module>()
----> 1 from .basic_train import *
      2 from .callback import *
      3 from .callbacks import *
      4 from .core import *
      5 from .data import *

~\Documents\GitHub\fastai\courses\dl1\fastai\basic_train.py in <module>()
      1 "Provides basic training and validation with `Learner`"
----> 2 from .torch_core import *
      3 from .data import *
      4 from .callback import *
      5 

~\Documents\GitHub\fastai\courses\dl1\fastai\torch_core.py in <module>()
      1 "Utility functions to help deal with tensors"
----> 2 from .imports.torch import *
      3 from .core import *
      4 
      5 AffineMatrix = Tensor

~\Documents\GitHub\fastai\courses\dl1\fastai\imports\__init__.py in <module>()
----> 1 from .core import *
      2 from .torch import *

~\Documents\GitHub\fastai\courses\dl1\fastai\imports\core.py in <module>()
      4 import abc, collections, hashlib, itertools, json, operator
      5 import mimetypes, inspect, typing, functools
----> 6 import html, re, spacy, requests
      7 
      8 from abc import abstractmethod, abstractproperty

ModuleNotFoundError: No module named 'spacy'

I tried to conda install -n fastai spacy and ran successfully, but still got the same error log

1 Like

switched link to …\old\fastai\ and getting this error