Skip to content Skip to sidebar Skip to footer

How Do I Install Libsvm For Python Under Windows 7?

Would like to know how to install libsvm for python under windows 7? I downloaded the livsvm zip, but I don't understand the instructions included. I have placed the libsvm.dll in

Solution 1:

SOLVED: 1. Navigate to http://www.lfd.uci.edu/~gohlke/pythonlibs/#libsvm 2. Download the .whl file of libsvm corresponding to your OS. 3. Open command prompt and navigate to that folder containing the downloaded .whl file. 4. Type the following command in command prompt- pip install libsvm-3.20-cp27-none-win32.whl

NOTE: Type name of your .whl file after pip install

Solution 2:

I think there's no need to place the dll in the C:\windows\system32 directory unless you're using old versions of Windows (XP and older).

Make sure that:

  • You launch your python test script containing from svmutil import * inside the libsvm\python directory
  • You still have a copy of the libsvm dll in the libsvm\windows directory (if you moved it to C:\windows\system32, put a copy back in the libsvm\windows directory)

This works on my computer.

Solution 3:

The best way I found to install libSVM on Windows, alongside other Python libraries, is to use unofficial Windows binaries, here:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#libsvm

This page provides 32- and 64-bit Windows binaries of many scientific open-source extension packages for the official CPython distribution of the Python programming language.

Most binaries are built from source code found on PyPI or in the projects public revision control systems. Source code changes, if any, have been submitted to the project maintainers or are included in the packages.

Many binaries depend on Numpy-MKL 1.8 and/or the Microsoft Visual C++ 2008 (64 bit or 32 bit, for CPython 2.6 to 3.2) or Visual C++ 2010 (64 bit or 32 bit, for CPython 3.3 and 3.4) redistributable packages.

Solution 4:

I had a bunch of problems with this too on Windows 7 and libsvm 3.18, and none of the solutions above worked. It just couldn't find or didn't like the ../windows/libsvm.dll file no matter what file path gymnastics I tried. I was also running into 32-bit vs. 64-bit incompatibilities (my python is 64 bit).

I bracing myself for the pain of trying to recompile from visual studio, but this ended up being unnecessary. What ended up working for me was simply installing scikit-learn, which has libsvm included and nicely wrapped inside (http://scikit-learn.org/stable/index.html).

If you're using the Anaconda distro, like I was, this is extremely painless. Simply type conda install scikit-learn at a command line.

You can then import sklearn.svm.libsvm as svm and call it like just like you would libsvm, if you wish to ignore the other aspects of scikit-learn. It just works.

Solution 5:

I know you asked this question 1 year ago, but I'd still like to post my solution, in case other people may benefit.

  1. Put libsvm to any place. Mine in C:\Python27\Lib\site-packages\libsvm-3.17

  2. Set PYTHONPATH in windows environment. Go to System Properties -> Advanced -> Environment variables. Add new variable, named PYTHONPATH, set value to C:\Python27\Lib\site-packages\libsvm-3.17\python.

Post a Comment for "How Do I Install Libsvm For Python Under Windows 7?"