Though there is another question on the same issue, the solution stated there does not work for me. Hence this is not a duplicate or re-post. And I am posting my issue and implementation specifics here.
I am currently working on PyCharm on a simple ML prediction task where I'd like to use xgboost. I have performed the following so far.
cd into the virtual environment folder
$ cd My_Project
Activate the venv
source myproject/bin/activate
pip install xgboost
$ sudo pip install xgboost
Upgrade installation
$ sudo pip install --upgrade xgboost
I also added the xgboost module to the project interpreter in pycharm with Python 3.6.
The python file that I'm trying to run has the following imports.
from numpy import loadtxt
from xgboost import XGBClassifier
from sklearn.model_selection import train_test_split
But as I run the script, I get this error.
from xgboost import XGBClassifier ImportError: No module named 'xgboost'
Specifications
- Ubuntu 16.04
- PyCharm
- Python 3.6
- File name :
classifxg.py
(NOTxgboost.py
- which is said to cause this No module error according to the other question on stackoverflow)
Any help in this regard will be much appreciated.