I installed Anaconda python on Windows 7, and then installed the xgboost package manually using the instructions here: How to install xgboost package in python (windows platform)? (It did not get installed under anaconda, but in a separate directory)
I put the following in test.py:
import sys
sys.path.append('C:<path>/xgboost/python-package')
import xgboost
When from a command line (say, from cygwin) the import works fine. But, if I use the Spyder IDE or IPython that came with Anaconda, I get
WindowsError Traceback (most recent call last) <ipython-input-14-afdaff4619ce> in <module>()
----> 1 import xgboost
C:...\xgboost\python-package\xgboost\__init__.py in <module>()
9 import os
10
---> 11 from .core import DMatrix, Booster
12 from .training import train, cv
13 from . import rabit
C:...\xgboost\python-package\xgboost\core.py in <module>()
81
82 # load the XGBoost library globally
---> 83 _LIB = _load_lib()
84
85 def _check_call(ret):
C:...\xgboost\python-package\xgboost\core.py in _load_lib()
75 if len(lib_path) == 0:
76 return None
---> 77 lib = ctypes.cdll.LoadLibrary(lib_path[0])
78 lib.XGBGetLastError.restype = ctypes.c_char_p
79 return lib
C:...\Continuum\Anaconda2\lib\ctypes\__init__.pyc in Lo adLibrary(self, name)
441
442 def LoadLibrary(self, name):
--> 443 return self._dlltype(name)
444
445 cdll = LibraryLoader(CDLL)
C:...continuum\Anaconda2\lib\ctypes\__init__.pyc in __ init__(self, name, mode, handle, use_errno, use_last_error)
363
364 if handle is None:
--> 365 self._handle = _dlopen(self._name, mode)
366 else:
367 self._handle = handle
WindowsError: [Error 126] The specified module could not be found
I've checked sys.executable, and I'm running the same python in shell and IPython. printing sys.path shows that the proper location is part of the path in both cases. Any idea what is happening? I'd really like to be able to use the IDE.