2

On my 3.7 venv xgboost was working fine, but when I changed to python 3.8 venv inheriting all of the packages from 3.7 venv, the interpreter can't find the module. Also I get error while trying to install it via PyCharm settings:

      ERROR: Command errored out with exit status 1: 'C:\Users\exemed\PycharmProjects\test2\venv\venv38\Scripts\python.exe'
     -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\exemed\\AppData\\Local\\Temp\\pycharm-packaging\\xgboost\\setup.py'"'"'; 
    __file__='"'"'C:\\Users\\exemed\\AppData\\Local\\Temp\\pycharm-packaging\\xgboost\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);
    code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');
    f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\exemed\AppData\Local\Temp\pip-record-3_ddvcjb\install-record.txt' 
--single-version-externally-managed --compile --install-headers 'C:\Users\exemed\PycharmProjects\test2\venv\venv38\include\site\python3.8\xgboost' 
    Check the logs for full command output.
Alexander Golys
  • 683
  • 8
  • 23

1 Answers1

2

This might not be a perfect solution, but I'm just offering some things to try based on what I've seen in the past. Also note, that usually when you have more than one version of python installed on your machine it will cause you a headache at one point or another.

First thing I'd check is run $ python -V to make sure your PATH is in fact configured for python 3.8. I'm led to believe its an issue with "which pip".

  • If so, then also go ahead and try: $ python -m pip install xgboost
  • If that doesn't work, then also go ahead and try: $ python-3.8 -m pip install xgboost
  • If both fail, then last effort here. try: $ pip3.8 install xgboost

Reference

If none of those work, then its probably the PATH that's struggling with the new install of pip & python. Go into settings > Edit System Environment Variables and go set "python" to point at the directory where python 3.8 is installed. do the same for "pip" and you're good.

Third, you might have a dependency issue. First, check whether you need C++ build tools installed for xgboost and if so, then install those and try again.

Fourth: you might have a dependency issue with already installed libraries. Go to your python 3.7 environment and run $ pip freeze > requirements.txt to get a list of all the libraries you have installed, then cd to that directory while in the python 3.8 environment, then run $ pip install -r requirements.txt. I hope one of these suggestions points you in the right direction!

ImTryingMyBest
  • 372
  • 1
  • 4