ImportError: No module named numpy.distutils.core (Ubuntu xgboost installation)

Siddharth Vashishtha picture Siddharth Vashishtha · Feb 11, 2016 · Viewed 11.5k times · Source

I recently downloaded Ubuntu 14.04 desktop version alongside Windows 10.

My PC configs are: 4 GB RAM, 64 bit

I installed Anaconda after downloading the file using: bash Anaconda3-2.5.0-Linux-x86_64.sh

Installation was successful.

Now in my ubuntu terminal, I follwed steps as instructed on http://xgboost.readthedocs.org/en/latest/build.html#building-on-ubuntu-debian

  1. Installed a recent GNU C++ compiler -->successful
  2. git clone --recursive https://github.com/dmlc/xgboost cd xgboost; make -j4

Building was also successful and I could build 'libxgboost.so'

  1. sudo apt-get install python-setuptools (Successful)
  2. cd python-package
  3. sudo python setup.py install

The 5. command returns an error after a lot of lines:

'ImportError: No module named numpy.distutils.core'

Can anyone suggest how to get rid of this error so that I can install xgboost ?

Answer

Jacob picture Jacob · Feb 18, 2016

I had the same problem today. I believe the issue is the instructions you listed are out of date for Python installs, as they are now enabled with pip install.

Delete the xgboost directory that your above install attempt created, and then execute:

pip install xgboost

It should all work with one command. See also the Python Specific XGBoost Install Instructions.