Cannot import xgboost in Jupyter notebook

October 16, 2024 | No comments

Getting this simple problem while importing Xgboost on Jupyter notebook

Sometimes when we try to import xgboost in Jupyter notebook it does not work and throws error. This page contains the step taken to solve the issue successfully.

Issue: Cannot import xgboost in Jupyter notebook

In this case it was a Jupyter note book that was installed locally on Mac.

Error: Following error seen in Jupyter notebook

XGBoost Library ({libname}) could not be loaded. 225 Likely causes: 226 * OpenMP runtime is not installed 227 - vcomp140.dll or libgomp-1.dll for Windows 228 - libomp.dylib for Mac OSX 229 - libgomp.so for Linux and other UNIX-like OSes 230 Mac OSX users: Run `brew install libomp` to install OpenMP runtime. 231 232 * You are running 32-bit Python on a 64-bit OS

Solution

Install libomp
Go to the terminal and install libomp with following command
brew install libomp

Summary

After installing libomp the import of Xgboost worked in Jupyter notebook. Please note that if we dont have brew installed we need to install brew first.

No comments :

Post a Comment

Please leave your message queries or suggetions.