• Register
0 votes
327 views

Problem :

When I executed:

pip install xgboost

I got this:

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/w4/w49s3mn91plbhyjwf8qjkpxc0000gn/T/pip-build-61dms1/xgboost/

6 5 3
6,930 points

1 Answer

0 votes

Solution :

The installation instructions do explain how to get the mutli-threaded version of XGBoost. unfortunately they did not work for me.  The following is what worked for me.  i am sharing in case it helps others.  I had to perform the following step:

  • Get Homebrew if it is not installed yet.  Indeed, this is a very useful open source installer for OSX.  Instaling it is straightforward, open a terminal, then paste and execute the instruction available on Homebrew home page. I reproduce it here for convenience:
  • /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Get gcc with open mp.  Just paste and execute the following command in your terminal, once Homebrew installation is completed.
  • brew install gcc --without-multilib    
    This automatically downloads and builds gcc.  It can take a while, it took about 30 minutes for me.  Be patient.
  • Get XGBoost.  Go to where you want in your filesystem, say <directoy>.  Then type the git clone command and execute it:
  • cd <directory>git clone --recursive https://github.com/dmlc/xgboost
    This downloads the XGBoost code into a new directory named xgboost.
  • Next step is to build XGBoost.  By default, the build process will use the default compilers, cc and c++, which do not support the open mp option used for XGBoost multi-threading. We need to tell the system to use the compiler we just installed.  That's the step that was missing from the installation instructions on XGBoost site. 
    There are various ways to do it, here is the one I used. 
  • Go to where we downloaded XGBoost
    cd <directory>/xgboost
  • Then open make/config.mk and uncomment these two lines
  • export CC = gcc
  • export CXX = g++
  • Depending on you g++ installaiton you may need to change the above two lines into:
    export CC = gcc-6
    export CXX = g++-6
  • We then build with the following commands.
  • cd <directory>/xgboost
  • cp make/config.mk .
  • make -j4
  • Once the build is finished, we can use XGBoost with its command line.  I am using Python, hence I performed this final step.  You may need to enter the admin password to execute it.
  • cd python-package; sudo python setup.py install

This concludes the installation. 

I tested it with My Anaconda distribution with Python 3.5.  It worked fine, and I could run XGBoost.  The speedup thanks to multi threading is noticeable, and my Mac Book Pro is now faster than my old PC.   

Further Readings:

9 7 4
38,600 points

Related questions

0 votes
3 answers 190 views
190 views
I am new in python programming. I am tryin gto iinstall some packages with pip commands. I tried to install a package called unroll by using the command: pip[ install unroll but it gives me some error like : "python setup.py egg_info" failed with error code 1 How can I solve this problem? How can I check my pip version? How can I upgrade my pip version?
asked Mar 9 LizzyM 6.1k points
2 votes
1 answer 24 views
24 views
Problem: I am new in programming language. I was trying to setup and then upgrade gcloud using python. I used the command: pip install --upgrade gcloud After that it shows: Collecting gcloud Downloading gcloud-0.18.3.tar.gz (454kB) 100% | ... code 1 in C:\Users\bid\AppData\Local\Temp\pip-build-ppc44asr\googleapis-common-protos\ Whats is happening here can anyone help?
asked Mar 24 LizzyM 6.1k points
1 vote
1 answer 22 views
22 views
Problem : Recently I have started learning Homebrew. Now if I try to run Homebrews brew doctor command on my Mac OS X 10.9.2 I have started receiving the below listed warning message: Warning: Python is installed at /Library/Frameworks/Python.framework Homebrew only ... /usr/local/bin/python. But still if I rerun the brew doctor command I am still facing the same warning message listed above.
asked Apr 4 morrisBson 3.2k points
0 votes
2 answers 614 views
614 views
Problem : On installing Anaconda on Ubantu getting below Python error on miss-typed commands fatal python error: py_initialize: unable to get the locale encoding
asked Oct 21, 2019 peterlaw 6.9k points
1 vote
2 answers 2.1K views
2.1K views
Problem : Getting bellow python and django error 'virtualenv' is not recognized as an internal or external command, operable program or batch file.
asked Nov 8, 2019 peterlaw 6.9k points