1

I'm using AWS for work with Anaconda in it. I don't have permission to install any python library (I mean, I requested it and it's taking ages) so I'm trying to see if there's a way around it.

I'm trying to install xgboost, what I did was to download all .py files in the github repo (only the .py files) for the library, put them in a folder that looks like this:

xgboost package
    |
    + - setup.py
      - xgboost
        |
        + - __init__.py
          - callback.py
          - core.py
             .
             .
             .

I already did this based on this answer

import importlib.util
spec = importlib.util.spec_from_file_location("xgboost", "/path/to/setup/file.py")
foo = importlib.util.module_from_spec(spec)
spec.loader.exec_module(foo)
foo.MyClass()

wouldn't this be enough to use it?

When I run test = xgboost.XGBRegressor() or test = foo.XGBRegressor() it gives me this error

AttributeError: 'xgboost' has no attribute 'XGBRegressor'.

If I try from xgboost import XGBRegressor it gives me

Traceback (most recent call last):

 

  File "<ipython-input-3634-477fa34615c5>", line 1, in <module>

    from xgboost import XGBClassifier

 

  File "D:\Users\Catalina\Documents\xgboost package\xgboost\__init__.py", line 16, in <module>

    from .core import DMatrix, DeviceQuantileDMatrix, Booster

 

  File "D:\Users\Catalina\Documents\xgboost package\xgboost\core.py", line 176, in <module>

    _LIB = _load_lib()

 

  File "D:\Users\Catalina\Documents\xgboost package\xgboost\core.py", line 135, in _load_lib

    lib_paths = find_lib_path()

 

  File "D:\Users\Catalina\Documents\xgboost package\xgboost\libpath.py", line 66, in find_lib_path

    raise XGBoostLibraryNotFound(msg)

 

XGBoostLibraryNotFound: Cannot find XGBoost Library in the candidate path.  List of candidates:

- D:\Users\Catalina\Documents\xgboost package\xgboost\lib\xgboost.dll

- D:\Users\Catalina\Documents\xgboost package\xgboost\..\..\lib\xgboost.dll

- D:\Users\Catalina\Documents\xgboost package\xgboost\../../windows/x64/Release/xgboost.dll

- D:\Users\Catalina\Documents\xgboost package\xgboost\./windows/x64/Release/xgboost.dll

XGBoost Python package path: D:\Users\Catalina\Documents\xgboost package\xgboost

sys.prefix: C:\ProgramData\Anaconda3

See: https://xgboost.readthedocs.io/en/latest/build.html for installing XGBoost.

I have no clue what's going on at this point. Any help is welcome

amestrian
  • 546
  • 3
  • 12
  • I'm not certain, but I believe having the `xgboost` folder (the one containing `__init__.py`) in your projects folder will allow `import xgboost` to work. – clubby789 Sep 17 '20 at 10:55
  • sadly that doesn't work as well. It return the last error – amestrian Sep 17 '20 at 11:17
  • Seems like it might depend on some libraries being installed to the system – clubby789 Sep 17 '20 at 11:18
  • to be fair i checked it on my own laptop's spyder and it is returning the same error... so it must be something that I'm doing wrong but I have no idea at this point – amestrian Sep 17 '20 at 11:27

0 Answers0