-1

I am using PyCharm and Python 3.6 for 32-bit Windows.

I try to install the xgboost library for python by going on Pycharm to File -> Default Settings and choosing a virtual ennviroment interpreter used by all my projects (C:\Users\User\PycharmProjects\Project_name\venv\Scripts\python.exe) instead of the local(C:\Users\User\AppData\Local\Programs\Python\Python36-32\python.exe).

However, I am getting the following error:

Collecting xgboost
  Using cached https://files.pythonhosted.org/packages/83/3a/8570f4e8e19acd3a5a75abc920964182a4b64db2ee0f041fb77b48447c6b/xgboost-0.72.tar.gz

No files/directories in C:\Users\User\AppData\Local\Temp\pycharm-packaging\xgboost\pip-egg-info (from PKG-INFO)

I am getting the same exactly error when I enter at the command prompt window

C:\Users\User>PycharmProjects\Sentdex_ML\venv\Scripts\pip install xgboost

I have also read a relevant StackOverflow post (How to install xgboost package in python (windows platform)?) and followed the (most upvoted) answer of @brettlyman.

Specifically, I donwloaded xgboost-0.72-cp36-cp36m-win32.whl and I entered at the command prompt

pip install xgboost-0.72-cp36-cp36m-win32.whl

However, in this way I successfuly installed xgboost on my local interpreter and not on my virtual enviroment interpreter which I am actually using. (Therefore @Moses' answer regarding Windows was not useful either - How do I install a .whl file in a PyCharm virtualenv?)

How can I install xgboost on my virtual enviroment?

When I enter pip3 install xgboost at the command promt window then I am getting the following:

Requirement already satisfied: xgboost in c:\users\User\appdata\local\programs\python\python36-32\lib\site-packages
Requirement already satisfied: numpy in c:\users\User\appdata\local\programs\python\python36-32\lib\site-packages (from xgboost)
Requirement already satisfied: scipy in c:\users\User\appdata\local\programs\python\python36-32\lib\site-packages (from xgboost)

Therefore, by entering this it is again verified that xgboost is installed at my local interpreter (but not on my virtual enviroment).

Outcast
  • 4,967
  • 5
  • 44
  • 99
  • Have you tried using `pip`? – kilojoules Jun 27 '18 at 20:33
  • Thank you for your comment. I answered your question at the end of my post. What do you think? – Outcast Jun 27 '18 at 20:38
  • I think you haven't properly linked Pycharm to the right python. Your question is about linking Pycharm to Python, not installing xgboost. – kilojoules Jun 27 '18 at 21:23
  • Haha, ok. This is pretty obvious. The question is what do I have to do to do it properly. Also, keep in mind please that I was capable of installing directly from the Pycharm Project Interpreter window many other ibraries (sk-learn, keras etc) on my virtual enviroment so it has also something to do with `xgboost`. – Outcast Jun 27 '18 at 21:37
  • I would start a new one about linking Pycharm and pip to the same thing, Just my two cents. – kilojoules Jun 27 '18 at 23:32
  • @Poete_Maudit You are supposed to **activate** the virtual environment, and then use pip. Not just try to run pip from the virtual env directory like you've done. The answer I gave clearly states this. – Moses Koledoye Jun 28 '18 at 12:50
  • Oh, apologies for this @Moses. Yes, you certainly write this at your post but it was not so clear to me when I was reading this. Consider to re-edit your post a little bit but in general your answer is absolutely right. Thanks! – Outcast Jun 28 '18 at 14:39
  • @Poete_Maudit Ok, answer updated. – Moses Koledoye Jun 28 '18 at 15:31
  • That's great! (To be honest the phrase at your post "And then for Windows systems:" was also quite confusing. If I am right you really mean 'or for Windows systems:" since at least in my case I am not doing anything with any POSIX and I think that the question itself at this post does not mention it.) – Outcast Jun 28 '18 at 16:15

1 Answers1

1

Ok I figured out how to do this and finally xgboost is properly installed on my virtual enviroment.

Specifically I did the following:

  1. I downloaded xgboost .whl file from this url
  2. I opened the command prompt (cmd)
  3. I activated the specific virtual enviroment by entering C:\Users\User\PycharmProjects\Project_name\venv\Scripts\activate at the cmd
  4. then I entered/went at the cmd to the folder directory where the .whl file is stored
  5. finally I entered pip install xgboost-0.72-cp36-cp36m-win32.whl in this directory at the cmd

Thanks to @brettyman and @Moses because a combination of their answers at How to install xgboost package in python (windows platform)? and at How do I install a .whl file in a PyCharm virtualenv? respectively solved my problem.

Outcast
  • 4,967
  • 5
  • 44
  • 99