Can't install Vowpalwabbit using pip on Window

2019-07-29 04:38发布

问题:

I have python 3.7.0 installed on Windows 10 and I can't install Vowpalwobbit. When I use command:

pip install vowpalwabbit

I get:

Building wheels for collected packages: vowpalwabbit
  Building wheel for vowpalwabbit (setup.py) ... error
  ERROR: Complete output from command 'c:\users\user\appdata\local\programs\python\python37-32\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-0tp3npd1\\vowpalwabbit\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\User\AppData\Local\Temp\pip-wheel-78e8xolx' --python-tag cp37:
  ERROR: running bdist_wheel
  ...
    File "C:\Users\User\AppData\Local\Temp\pip-install-0tp3npd1\vowpalwabbit\setup.py", line 115, in build_extension
      raise Exception('Pre-built vw/python library for Windows is not supported for this python version')
  Exception: Pre-built vw/python library for Windows is not supported for this python version

I tried use Python 3.5.0 and it still didn't work.

回答1:

I'll paste the response I gave on the issue here:

The Python package includes C++ that needs to be built from source, and is made a bit difficult because the dependencies need to be present too. We are working on making the Python install experience better, but in the meantime here is how I was able to get your situation working on Windows 10 1809 from latest vw master. (Things have changed quite a bit since 8.5.0 which is what is on pip)

  • For Python3.7 I used Boost 1.70 (This is the latest version on vcpkg)
  • I used CMake 3.13 and it was able to resolve the Boost 1.70 dependencies

    1. Install vcpkg
    2. Install dependencies with vcpkg

    vcpkg install zlib:x64-windows
    vcpkg install boost-system:x64-windows
    vcpkg install boost-program-options:x64-windows
    vcpkg install boost-test:x64-windows
    vcpkg install boost-align:x64-windows
    vcpkg install boost-foreach:x64-windows
    vcpkg install boost-python:x64-windows
    vcpkg install boost-math:x64-windows
    vcpkg install boost-thread:x64-windows
    
    1. cd <repo_root>/python
    2. python setup.py --vcpkg-root C:\path\to\vcpkg install
      • Where C:\path\to\vcpkg is the root directory of where you cloned vcpkg