I've successfully installed Xgboost in windows with Pycharm Python, and it is working.
However, in Jupyter NoteBook, it is not working.
import xgboost as xgb
---> 12 import xgboost as xgb
ModuleNotFoundError: No module named 'xgboost'
> !pip install xgboost
Ideally, you should install packages in the location in your PYTHONPATH (which is where python looks). Usually pip does this, however its possible that jupyter, and pycharm are using different version. Try:
import sys print sys.executable
import os print os.environ['PYTHONPATH'].split(os.pathsep)
in both pycharm and jupyter.
You can then try one of two things:
install the package with the right version of pip:
/path/to/python /path/to/pip install PackageName
dynamically hacking your python path in python:
import sys sys.path.append(r"C:\Users\sifangyou\xgboost\python-package") import xgboost
Whether 2 works depends on what magic happens when xgboost is installed. (Its possible that it may not by usable without running the install steps).