Debbie
Debbie

Reputation: 969

ImportError: No module named 'xgboost'

This

import sys
from platform import python_version

print(sys.base_prefix)
print(python_version())

outputs this:

 /home/hp/anaconda3/envs/tensorflow
 3.5.4

I tried to install it with the following commands:

conda install py-xgboost

and

conda install -c conda-forge xgboost

Each time I am getting this error:

ImportError: No module named 'xgboost'

OS:

Ubuntu 16.04

Upvotes: 2

Views: 8462

Answers (1)

desertnaut
desertnaut

Reputation: 60369

Although your second attempt should work, your first attempt doesn't look right; as per the documentation, you should use

conda install -c anaconda py-xgboost

after you have activated the respective environment where you want the package installed.

Upvotes: 3

Related Questions