Reputation: 11
I had the xgboost library installed on my mac, but suddenly I get the python error: ModuleNotFoundError: No module named 'xgboost'
That's what I executed:
pip install xgboost
conda install xgboost
pip3 install xgboost
sudo pip3 install xgboost
However, I always get the following error:
Could you give me a hand?
Thank you very much
Upvotes: 0
Views: 2140
Reputation: 196
Make sure you installed below packages on your mac:
brew install cmake
brew install gcc
brew install libomp
brew install openblas
Use below on Mac M1:
arch -arm64 brew install cmake
arch -arm64 brew install gcc
arch -arm64 brew install libomp
arch -arm64 brew install openblas
And also make sure you exported this before running pip install on your terminal:
export PKG_CONFIG_PATH="/opt/homebrew/opt/openblas/lib/pkgconfig"
pip install xgboost
Upvotes: 0
Reputation: 171
I wasn't able to get any version of XGBoost to work on my Mac even with the above, so I wanted to share that it works on an AWS EC2 Linux instance (https://aws.amazon.com/).
Upvotes: 0
Reputation: 2137
If you have package manager Anaconda use:
conda install -c conda-forge xgboost
Or:
$ brew install gcc@5
$ pip install xgboost
If it's already installed, try:
pip install --upgrade setuptools
Or:
python -m pip install --upgrade pip
pip install xgboost
Or:
If you were using pip, try to use pip3 or pip2
pip2 install xgboost
pip3 install xgboost
Here is your issue: https://github.com/dmlc/xgboost/issues/3194
Briefly: Download gboost from:
https://github.com/dmlc/xgboost/files/1851733/xgboost-0.7.post5.tar.gz
then run:
pip3 install xgboost-0.7.post5.tar.gz
Upvotes: 3