2

It was a pain just to install xgboost library, but now other mistake happened on Windows 8.1 64-bit

import xgboost as xgb

Traceback (most recent call last):
  File "C:/Users/Пашка/PycharmProjects/kaggler bank santander/1.py", line 12, in <module>
    import xgboost as xgb
  File "C:\Python34\lib\site-packages\xgboost-0.4-py3.4.egg\xgboost\__init__.py", line 11, in <module>
    from .core import DMatrix, Booster
  File "C:\Python34\lib\site-packages\xgboost-0.4-py3.4.egg\xgboost\core.py", line 83, in <module>
    _LIB = _load_lib()
  File "C:\Python34\lib\site-packages\xgboost-0.4-py3.4.egg\xgboost\core.py", line 77, in _load_lib
    lib = ctypes.cdll.LoadLibrary(lib_path[0])
  File "C:\Python34\lib\ctypes\__init__.py", line 429, in LoadLibrary
    return self._dlltype(name)
  File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application

What can be done? I think it is because of how .py files associated in Windows I guess

paveltr
  • 474
  • 1
  • 8
  • 22
  • Seems like the installation of xgb is not correctly done. Any errors encountered during installation? You may want to use this instructions for installation : http://stackoverflow.com/questions/33749735/how-to-install-xgboost-package-in-python-windows-platform/35119904#35119904 – Deepish Apr 14 '16 at 10:48
  • @Deepish Basically, I followed that instruction, no mistake seemed to appear. After that, I tried to use pre-compiled library when I just put it to my site-packages folder. Its still not working – paveltr Apr 15 '16 at 09:07

2 Answers2

2

I think that probably the simplest (most painless) way to install xgboost can be found here:

https://dnc1994.com/2016/03/installing-xgboost-on-windows/ (Much thanks to the author!)

I downloaded TDM-GCC as recommended by the author prior to following their instructions.

Also, I had similar issues installing xgboost on 32-bit Python but am having no issues using 64-bit Python.

Note: I'm running Python 2.7 on Windows 7.

tauculator
  • 147
  • 7
1

Building on Windows has recently become much simpler:

Install CMake

CMake can be downloaded from here: https://cmake.org/download/

I downloaded the 64 bit zip file: https://cmake.org/files/v3.6/cmake-3.6.2-win64-x64.zip and unzipped it to c:\dev\cmake-3.6.2-win64-x64.

Build XGBoost

To build XGBoost follow these steps:

  • git clone https://github.com/dmlc/xgboost.git
  • cd xgboost
  • git submodule init
  • git submodule update
  • mkdir build
  • cd build
  • C:\dev\cmake-3.6.2-win64-x64\bin\cmake.exe .. -G”Visual Studio 14 2015 * Win64″
  • C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe /t:Clean,Rebuild /p:Configuration=Release xgboost.sln

Or Just Download the Binaries (x64)

Unofficial (mine) Nightly builds here.

Community
  • 1
  • 1
gatapia
  • 3,574
  • 4
  • 40
  • 48