XGBoost kills kernel when creating XGBoost.DMatrix

Viewed 506

My jupyter notebook kernel dies without an error message when trying to create an XGBoost DMatrix using:

# Create the XGBoost DMatrix
dtrain = xgb.DMatrix(X_train, y_train)

I’ve tried the following without any luck:

  • processing only 50% or 25% of the dataset
  • deleting libiomp5.dylib as per this thread
  • including import os os.environ['KMP_DUPLICATE_LIB_OK']='True' at the top of the notebook as per this thread
  • updating libomp using brew install libomp
  • reinstalling my mambaforge package manager

I'm at a loss as to where to look at the moment. Any help/input very welcome.

--

MRE to reproduce the error when working with xgboost locally:

# create dummy data
d = {
  'y': [1, 0, 0, 1], 
  'x1': [1, 2, 3, 4],
  'x2': [5, 6, 7, 8],
  'x3': [9, 0, 1, 2]}

df = pd.DataFrame(data=d)
 
# create train/test splits
X, y = df.iloc[:, 1:], df["y"]
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.25, shuffle=True, random_state=2)

# Create the XGBoost DMatrix
dtrain = xgb.DMatrix(X_train, y_train)

I'm working with:

  • a 2020 M1 Macbook Pro
  • Python: 3.9
  • XGBoost: 1.4.2
  • Pandas: 1.3.1
  • Numpy: 1.21.2

NOTE: I've tried downgrading XGBoost. v 1.2.0 creates the DMatrix but fails with the same behaviour (no error message, kernel dies) when calling xgb.train(params,dtrain).

1 Answers

I tried everything and was also facing the same use, what worked for me was to downgrade the version of libomp to 11.1.0

brew uninstall libomp
brew install libomp@11.1.0

And then restart jupyter.

Related