Skip to content

xgboost on OSX #306

@mdeceglie

Description

@mdeceglie

Describe the bug
Importing rdtools causes an error on mac when everything has been installed with pip

Full error message and traceback

---------------------------------------------------------------------------
XGBoostError                              Traceback (most recent call last)
<ipython-input-1-1cb1b3438ad7> in <module>()
      3 import numpy as np
      4 import pvlib
----> 5 import rdtools
      6 get_ipython().magic('matplotlib inline')

/Users/mdecegli/opt/anaconda3/envs/xgboost/lib/python3.7/site-packages/rdtools/__init__.py in <module>()
     10 from rdtools.aggregation import aggregation_insol
     11 from rdtools.clearsky_temperature import get_clearsky_tamb
---> 12 from rdtools.filtering import csi_filter
     13 from rdtools.filtering import poa_filter
     14 from rdtools.filtering import tcell_filter

/Users/mdecegli/opt/anaconda3/envs/xgboost/lib/python3.7/site-packages/rdtools/filtering.py in <module>()
      8 from numbers import Number
      9 import rdtools
---> 10 import xgboost as xgb
     11 
     12 # Load in the XGBoost clipping model using joblib.

/Users/mdecegli/opt/anaconda3/envs/xgboost/lib/python3.7/site-packages/xgboost/__init__.py in <module>()
      7 import os
      8 
----> 9 from .core import DMatrix, DeviceQuantileDMatrix, Booster, DataIter
     10 from .training import train, cv
     11 from . import rabit  # noqa

/Users/mdecegli/opt/anaconda3/envs/xgboost/lib/python3.7/site-packages/xgboost/core.py in <module>()
    201 
    202 # load the XGBoost library globally
--> 203 _LIB = _load_lib()
    204 
    205 

/Users/mdecegli/opt/anaconda3/envs/xgboost/lib/python3.7/site-packages/xgboost/core.py in _load_lib()
    192 
    193 Error message(s): {os_error_list}
--> 194 """)
    195     lib.XGBGetLastError.restype = ctypes.c_char_p
    196     lib.callback = _get_log_callback_func()

XGBoostError: 
XGBoost Library (libxgboost.dylib) could not be loaded.
Likely causes:
  * OpenMP runtime is not installed
    - vcomp140.dll or libgomp-1.dll for Windows
    - libomp.dylib for Mac OSX
    - libgomp.so for Linux and other UNIX-like OSes
    Mac OSX users: Run `brew install libomp` to install OpenMP runtime.

  * You are running 32-bit Python on a 64-bit OS

Error message(s): ['dlopen(/Users/mdecegli/opt/anaconda3/envs/xgboost/lib/python3.7/site-packages/xgboost/lib/libxgboost.dylib, 6): Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib\n  Referenced from: /Users/mdecegli/opt/anaconda3/envs/xgboost/lib/python3.7/site-packages/xgboost/lib/libxgboost.dylib\n  Reason: image not found']

To Reproduce
Install rdtools using pip on osx

Expected behavior
Import successful

possible solution
The error can be avoided by installing xgboost with conda. Perhaps we can catch the error and offer that suggestion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions