1

I am facing the same problem as mentioned in this question while installing scikit learn from C:\Python34\Lib\site-packages\sklearn.

My OS is Windows 8.1 and Python 3.4. I have checked that vcvars32.bat is inside C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools and the vcvarsall.bat file is located C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC

My question is which Windows SDK do I need to download and what steps do I need to follow to build sklearn for Windows 8.1 and Python 3.4.

Community
  • 1
  • 1
Shreya Roy
  • 13
  • 4
  • Do you specifically want to build sklearn? Would you be happy to download a pre-built version instead? – mfitzp Feb 24 '15 at 14:34

1 Answers1

1

Building Python packages for Windows is not a lot of fun, and unless you have specific reasons for wishing to do so (enabling certain build options, compatibility issues, etc.) it is best avoided.

The Windows Binaries for Python Extension Packages site has a pre-built versions of most scientific Python packages, including sklearn, available for download. If you prefer, there are also .exe installer builds available on Sourceforge.

Download an installer an run it to install the package to C:\Python34\Lib\site-packages\sklearn. Once the installation is complete you don't need to do anything else to use the package (there is no need for example to run python setup.py on pre-built packages). Simply open up a Python shell and import the package as normal.

>>> import sklearn

If there is no output, the package is installed!

mfitzp
  • 15,275
  • 7
  • 50
  • 70
  • I am working on a project which requires the use of neural network ..That's why I require scikit- learn built on my pc..Please help me out . – Shreya Roy Feb 24 '15 at 16:47
  • What happens if you install one of the pre-built scikit-learn packages? Does it not work? – mfitzp Feb 24 '15 at 16:49
  • Sorry,Sir I did not get what u mean by pre-built scikit-learn package.. I downloaded scikti-learn from from http://sourceforge.net/projects/scikit-learn/files/scikit-learn-0.15.1.win32-py3.4.exe/download..And now I am trying to install it.. – Shreya Roy Feb 24 '15 at 16:52
  • If you follow the link [sklearn](http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-learn) (the page will take a while to load) you can see packages that have already been built for Python 3.4 and Windows 8.1 (choose between `cp34‑none‑win32.whl` for 32bit or `cp34‑none‑win_amd64.whl` for 64 bit). These installers give you exactly the same install as you would get from building from source. – mfitzp Feb 24 '15 at 18:34
  • I have already installed it..and now I am trying to run its setup file..plz read my question ..all the details of the folder where the setup file is located is given..but while running the setup file the problem is arising – Shreya Roy Feb 24 '15 at 18:38
  • I have read your question. You stated that you are trying to install `sklearn` from `C:\Python34\Lib\site-packages\sklearn` which makes no sense. If the package is in that location it is *already installed*. You do not need to run `setup.py`. What happens if you type `import sklearn` in a Python shell? – mfitzp Feb 24 '15 at 19:07
  • Sry,I am trying to run setup.py from the folder location.. import sklearn is not throwing any error..Well then dont I need to successfully run the setup.py from the mentioned directory with command python setup.py install?? – Shreya Roy Feb 24 '15 at 20:01
  • No. Running `setup.py` is required to *build* the package and *install* it into the `site-packages` folder. If it is already in the `site-packages` folder it is already built and installed. What happens if you type `import sklearn` in a Python shell? – mfitzp Feb 24 '15 at 20:04
  • Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit (In tel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import sklearn >>> import a hello world! >>> import b Traceback (most recent call last): File "", line 1, in ImportError: No module named 'b' >>> import sklearn >>> – Shreya Roy Feb 24 '15 at 20:37
  • It looks like `import sklearn` works? Why are you trying to `import b`? – mfitzp Feb 24 '15 at 20:40
  • I think yes.. What u say Sir> – Shreya Roy Feb 24 '15 at 20:43
  • If `import sklearn` doesn't give an error *then it is installed!* ...when you `import` a package there should be no output. – mfitzp Feb 24 '15 at 20:44
  • Ok,Sir, tomorrow I will start writing code ..If I face any trouble ,I will post..nd Thank u so much for the help :).. – Shreya Roy Feb 24 '15 at 20:49
  • @ShreyaRoy No problem and good luck with sklearn! :) Please consider accepting my answer (green tick top left) also. I've edited it to reflect the additional information, so hopefully will be useful to anyone else with the same problem. – mfitzp Feb 24 '15 at 20:53
  • I am trying installing sklearn, as mentioned above, I think the installation is complete as the folder exists in site-packages subfolder of Python27\Lib. But when I am running import sklearn in python shell, it's showing error. Can you please help what I should do further. – user3004790 Jun 08 '15 at 06:04
  • @user3004790 What error do you see? Are you running a Python2.7 shell? – mfitzp Jun 13 '15 at 09:02
  • I uninstalled everything and tried gain, then somehow it worked But then I came across the "Anaconda", so I started working on that and my current difficulty is : http://stackoverflow.com/questions/30759190/difficulty-installing-python-modules-after-installing-anaconda – user3004790 Jun 13 '15 at 18:03