• Register
0 votes

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

Please log in or register to answer this question.

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
1 answer 77 views
Problem: I am trying to install python package rpy2 with pip install on Ubuntu 16.04: pip install rpy2==2.2.7 but get error message (see full output below): Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-EuOI6K/unroll/
asked Jan 10 Mashhoodch 13k points
0 votes
3 answers 292 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, 2020 LizzyM 6.1k points
0 votes
1 answer 16 views
Problem: How to fix this error: socket.error: command python setup.py egg_info failed HELP! I need help understanding this error: command python setup.py egg_info failed Can someone please help fix this, I am new in python() : command python setup.py egg_info failed
asked Mar 1 Mashhoodch 13k points
0 votes
1 answer 5 views
Problem: What went wrong that caused the error?
asked Apr 11 salim1 60.6k points
0 votes
1 answer 23 views
command "python setup.py egg_info" failed with error code 1 in
asked Feb 16 ArifulIslam 7.5k points
2 votes
1 answer 58 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, 2020 LizzyM 6.1k points
0 votes
1 answer 126 views
Problem: Please help me that how to install pip for python 2.7?
asked Mar 18 Ifra 37.2k points
0 votes
1 answer 5 views
Problem: What am I supposed to do here? >Command python setup.py egg_info failed with error code.
asked 13 hours ago Rada Gracelynn 6.7k points
0 votes
1 answer 8 views
Problem: I've looked on the internet, please, but nothing helpful has been discovered.
asked Apr 13 zayed1 61.8k points
1 vote
1 answer 29 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, 2020 morrisBson 3.2k points