close

[Solved] ImportError: No module named xgboost

Hello Guys, How are you all? Hope You all Are Fine. Today I am trying to import xgboost but I am facing following error ImportError: No module named xgboost in Python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How ImportError: No module named xgboost Error Occurs?

I am trying to import xgboost but I am facing following error.

ImportError: No module named xgboost

How To Solve ImportError: No module named xgboost Error ?

  1. How To Solve ImportError: No module named xgboost Error ?

    To Solve ImportError: No module named xgboost Error You just need to properly install xgboost from pip. So Just Open terminal and run this command: pip install xgboost. Second solution is Just Use conda install in Anaconda and then use pip install: conda install -c conda-forge xgboost and then pip install xgboost.

  2. ImportError: No module named xgboost

    To Solve ImportError: No module named xgboost Error You just need to properly install xgboost from pip. So Just Open terminal and run this command: pip install xgboost. Second solution is Just Use conda install in Anaconda and then use pip install: conda install -c conda-forge xgboost and then pip install xgboost.

Solution 1: install xgboost from pip

You just need to properly install xgboost from pip. So Just Open terminal and run this command.

pip install xgboost

Solution 2: Use conda install in Anaconda

Just Use conda install in Anaconda and then use pip install.

conda install -c conda-forge xgboost

Then

pip install xgboost

Solution 3: install the whl file directly

Just need to Install the whl file directly.

  1. First of all download and install the whl file directly from here.
  2. just double click on the whl file and install it.
  3. And then run this command.
  4. pip install yourFile.whl (Your filename here)
  5. Now, your error should be fixed.

Solution 4: Use this

git clone --recursive https://github.com/dmlc/xgboost
cd xgboost
sudo cp make/minimum.mk ./config.mk;
sudo make -j4;
sh build.sh
cd python-package
python setup.py install

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read