{
  "id": 21864,
  "title": "Installing XGBOOST in Python for Windows",
  "url": "/competitions/facebook-v-predicting-check-ins/discussion/21864",
  "author_name": "",
  "post_date": "2016-06-24T04:50:04.517Z",
  "votes": null,
  "comment_count": 13,
  "views": 1798,
  "content": "<p>Does anyone know why this is so difficult and if there is an easy way? I spent half a day trying to download and install xgboost for Python, following every piece of instruction I possibly could. Eventually, I just got frustrated and went to R: </p>\n\n<p>install.packages(&quot;xgbooost&quot;)\nlibrary(xgboost)</p>\n\n<p>And I was done. </p>\n\n<p>So, now I'm rewriting a lot of my code in R to build a model with xgboost. </p>\n\n<p>Seriously, I tried all of these different links and nothing I did worked to install xgboost for Python.  </p>\n\n<p>Resources: </p>\n\n<ol>\n<li><p>Visual Studio method: <a href=\"https://www.kaggle.com/c/otto-group-product-classification-challenge/forums/t/13043/run-xgboost-from-windows-and-python\">https://www.kaggle.com/c/otto-group-product-classification-challenge/forums/t/13043/run-xgboost-from-windows-and-python</a></p></li>\n<li><p>Binaries from Guido: <a href=\"https://github.com/gatapia/py_ml_utils/tree/master/lib\">https://github.com/gatapia/py_ml_utils/tree/master/lib</a></p></li>\n<li><p>Liberty Mutual Competition: <a href=\"https://www.kaggle.com/c/liberty-mutual-group-property-inspection-prediction/forums/t/15742/clear-instructions-to-install-xgboost-in-python\">https://www.kaggle.com/c/liberty-mutual-group-property-inspection-prediction/forums/t/15742/clear-instructions-to-install-xgboost-in-python</a></p></li>\n<li><p>Mad Over Data: <a href=\"http://madoverdata.com/machine-learning/installing-xgboost-in-windows/\">http://madoverdata.com/machine-learning/installing-xgboost-in-windows/</a></p></li>\n</ol>",
  "messages": [
    {
      "id": "124976",
      "postDate": "06/24/2016 04:50:04",
      "content": "<p>Does anyone know why this is so difficult and if there is an easy way? I spent half a day trying to download and install xgboost for Python, following every piece of instruction I possibly could. Eventually, I just got frustrated and went to R: </p>\n\n<p>install.packages(&quot;xgbooost&quot;)\nlibrary(xgboost)</p>\n\n<p>And I was done. </p>\n\n<p>So, now I'm rewriting a lot of my code in R to build a model with xgboost. </p>\n\n<p>Seriously, I tried all of these different links and nothing I did worked to install xgboost for Python.  </p>\n\n<p>Resources: </p>\n\n<ol>\n<li><p>Visual Studio method: <a href=\"https://www.kaggle.com/c/otto-group-product-classification-challenge/forums/t/13043/run-xgboost-from-windows-and-python\">https://www.kaggle.com/c/otto-group-product-classification-challenge/forums/t/13043/run-xgboost-from-windows-and-python</a></p></li>\n<li><p>Binaries from Guido: <a href=\"https://github.com/gatapia/py_ml_utils/tree/master/lib\">https://github.com/gatapia/py_ml_utils/tree/master/lib</a></p></li>\n<li><p>Liberty Mutual Competition: <a href=\"https://www.kaggle.com/c/liberty-mutual-group-property-inspection-prediction/forums/t/15742/clear-instructions-to-install-xgboost-in-python\">https://www.kaggle.com/c/liberty-mutual-group-property-inspection-prediction/forums/t/15742/clear-instructions-to-install-xgboost-in-python</a></p></li>\n<li><p>Mad Over Data: <a href=\"http://madoverdata.com/machine-learning/installing-xgboost-in-windows/\">http://madoverdata.com/machine-learning/installing-xgboost-in-windows/</a></p></li>\n</ol>",
      "rawMarkdown": "Does anyone know why this is so difficult and if there is an easy way? I spent half a day trying to download and install xgboost for Python, following every piece of instruction I possibly could. Eventually, I just got frustrated and went to R: \r\n\r\ninstall.packages(\"xgbooost\")\r\nlibrary(xgboost)\r\n\r\nAnd I was done. \r\n\r\nSo, now I'm rewriting a lot of my code in R to build a model with xgboost. \r\n\r\nSeriously, I tried all of these different links and nothing I did worked to install xgboost for Python.  \r\n\r\nResources: \r\n\r\n1. Visual Studio method: https://www.kaggle.com/c/otto-group-product-classification-challenge/forums/t/13043/run-xgboost-from-windows-and-python\r\n\r\n2. Binaries from Guido: https://github.com/gatapia/py_ml_utils/tree/master/lib\r\n\r\n3. Liberty Mutual Competition: https://www.kaggle.com/c/liberty-mutual-group-property-inspection-prediction/forums/t/15742/clear-instructions-to-install-xgboost-in-python\r\n\r\n4. Mad Over Data: http://madoverdata.com/machine-learning/installing-xgboost-in-windows/",
      "votes": null
    },
    {
      "id": "124977",
      "postDate": "06/24/2016 05:31:30",
      "content": "<p>It's a real pain.</p>\n\n<p>I recently went through this, and I found these two pages helpful:</p>\n\n<p>Which xgboost to download:\n<a href=\"https://github.com/dmlc/xgboost/issues/1267\">https://github.com/dmlc/xgboost/issues/1267</a></p>\n\n<p>How to do the make:\n<a href=\"https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_For_Anaconda_on_Windows?lang=en\">https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_For_Anaconda_on_Windows?lang=en</a></p>\n\n<p>I hope that helps!</p>\n\n<p>Personally, I'm migrating to Linux.</p>",
      "rawMarkdown": "It's a real pain.\r\n\r\nI recently went through this, and I found these two pages helpful:\r\n\r\nWhich xgboost to download:\r\nhttps://github.com/dmlc/xgboost/issues/1267\r\n\r\nHow to do the make:\r\nhttps://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_For_Anaconda_on_Windows?lang=en\r\n\r\nI hope that helps!\r\n\r\nPersonally, I'm migrating to Linux.",
      "votes": null
    },
    {
      "id": "124978",
      "postDate": "06/24/2016 05:32:58",
      "content": "<p>Thanks for sharing, Michael! Super helpful. </p>\n\n<p>I'm using Canopy for Python, but I may switch over to Anaconda I suppose if it's easier.</p>",
      "rawMarkdown": "Thanks for sharing, Michael! Super helpful. \r\n\r\nI'm using Canopy for Python, but I may switch over to Anaconda I suppose if it's easier.",
      "votes": null
    },
    {
      "id": "125007",
      "postDate": "06/24/2016 14:41:46",
      "content": "<p>I was able to get XGBoost working using the same IBM page that Michael referred (found the same page a few weeks ago).  I am using anaconda.  </p>\n\n<p>For me the issue turned out to be that I needed to build using MinGW instead of visual studio community edition.  </p>\n\n<p>One other issue I hit.  I found that MinGW had problems installing with my proxy at work so I ended up using <a href=\"https://chocolatey.org/\">chocolatey</a> to install MinGW.  Once I got MinGW installed, I was able to build it and run it without too much issue.</p>\n\n<p>It was much easier to install on ubuntu (my other laptop).  :-)</p>\n\n<p>Good luck.</p>",
      "rawMarkdown": "I was able to get XGBoost working using the same IBM page that Michael referred (found the same page a few weeks ago).  I am using anaconda.  \r\n\r\nFor me the issue turned out to be that I needed to build using MinGW instead of visual studio community edition.  \r\n\r\nOne other issue I hit.  I found that MinGW had problems installing with my proxy at work so I ended up using [chocolatey][1] to install MinGW.  Once I got MinGW installed, I was able to build it and run it without too much issue.\r\n\r\nIt was much easier to install on ubuntu (my other laptop).  :-)\r\n\r\nGood luck.\r\n\r\n\r\n  [1]: https://chocolatey.org/",
      "votes": null
    },
    {
      "id": "125024",
      "postDate": "06/24/2016 19:16:46",
      "content": "<p>Okay, I've tried following the IBM instructions. I installed Anaconda so I am trying to install xgboost for it.</p>\n\n<p>I am able to do the following: </p>\n\n<ol>\n<li><p>Clone xgboost from GitHub into the correct folder using Git Bash.</p></li>\n<li><p>Install MinGW and include in PATH system variable with TDM-GCC-64 (see mingw32-make PNG file attached).</p></li>\n</ol>\n\n<p>I get my first error when trying to run each submodule explicitly. When I type 'make -j4' after using cd to go to 'dmlc-core'. I've attached the error message below.</p>\n\n<p>Any help would be GREATLY appreciated!!!</p>",
      "rawMarkdown": "Okay, I've tried following the IBM instructions. I installed Anaconda so I am trying to install xgboost for it.\r\n\r\nI am able to do the following: \r\n\r\n1. Clone xgboost from GitHub into the correct folder using Git Bash.\r\n\r\n2. Install MinGW and include in PATH system variable with TDM-GCC-64 (see mingw32-make PNG file attached).\r\n\r\nI get my first error when trying to run each submodule explicitly. When I type 'make -j4' after using cd to go to 'dmlc-core'. I've attached the error message below.\r\n\r\nAny help would be GREATLY appreciated!!!",
      "votes": null
    },
    {
      "id": "125026",
      "postDate": "06/24/2016 19:26:53",
      "content": "<p>I think with the 9a48a40 build of XGBoost you can just use 'make -j4' directly, and don't need to build the submodules explicitly. </p>",
      "rawMarkdown": "I think with the 9a48a40 build of XGBoost you can just use 'make -j4' directly, and don't need to build the submodules explicitly.",
      "votes": null
    },
    {
      "id": "125030",
      "postDate": "06/24/2016 19:51:49",
      "content": "<p>@TenaciousTerrier I use version 0.4\n<a href=\"https://github.com/dmlc/xgboost/releases/tag/v0.40\">https://github.com/dmlc/xgboost/releases/tag/v0.40</a>\nIn the windows directory find the VS project\nCopy all the resulting compiling files to wrapper directory\nRun python setup.py install from wrapper directory.</p>",
      "rawMarkdown": "TenaciousTerrier I use version 0.4\r\nhttps://github.com/dmlc/xgboost/releases/tag/v0.40\r\nIn the windows directory find the VS project\r\nCopy all the resulting compiling files to wrapper directory\r\nRun python setup.py install from wrapper directory.",
      "votes": null
    },
    {
      "id": "125031",
      "postDate": "06/24/2016 20:03:54",
      "content": "<p>@Michael Hartman - Not sure if I'm being dull, but what do you mean? I took your advice and tried skipping these commands: \n$ git submodule init\n$ git submodule update</p>\n\n<p>And then entering 'make -j4' into the Git Bash terminal after cloning the xgboost path. I got the same error as before. </p>\n\n<p>@Alex I followed these steps, but I'm not sure if what I'm doing is correct. Could you advise? \n1. Download zip folder, unzip on Desktop\n2. Open xgboost.vs from inside folder with Microsoft Visual Studio 2013\n3. Build Solution</p>\n\n<p>I get the following error: \nError   1   error C1083: Cannot open include file: 'Rinternals.h': No such file or directory    C:\\Users\\thep3\\Desktop\\xgboost-0.40\\r-package\\src\\xgboost_assert.c  3   1   xgboost</p>",
      "rawMarkdown": "Michael Hartman - Not sure if I'm being dull, but what do you mean? I took your advice and tried skipping these commands: \r\n$ git submodule init\r\n$ git submodule update\r\n\r\nAnd then entering 'make -j4' into the Git Bash terminal after cloning the xgboost path. I got the same error as before. \r\n\r\n@Alex I followed these steps, but I'm not sure if what I'm doing is correct. Could you advise? \r\n1. Download zip folder, unzip on Desktop\r\n2. Open xgboost.vs from inside folder with Microsoft Visual Studio 2013\r\n3. Build Solution\r\n\r\nI get the following error: \r\nError\t1\terror C1083: Cannot open include file: 'Rinternals.h': No such file or directory\tC:\\Users\\thep3\\Desktop\\xgboost-0.40\\r-package\\src\\xgboost_assert.c\t3\t1\txgboost",
      "votes": null
    },
    {
      "id": "125032",
      "postDate": "06/24/2016 20:26:18",
      "content": "<p>I hit this same issue.  </p>\n\n<p>Edit:  I found the history.  Here is the exact commands that worked for me:</p>\n\n<pre><code>git clone --recursive https://github.com/dmlc/xgboost\n  338  cd xgboost\n  339  git checkout 9a48a40\n  340  git submodule init\n  341  git submodule update\n  342  cp make/mingw64.mk config.mk\n  343  make -j4\n  344  cd python-package/\n  345  python setup.py install\n</code></pre>\n\n<p>It came down to making sure that I had a clean build.  I removed the directory and rechecked it out and then these steps worked for me.</p>",
      "rawMarkdown": "I hit this same issue.  \r\n\r\nEdit:  I found the history.  Here is the exact commands that worked for me:\r\n\r\n    git clone --recursive https://github.com/dmlc/xgboost\r\n      338  cd xgboost\r\n      339  git checkout 9a48a40\r\n      340  git submodule init\r\n      341  git submodule update\r\n      342  cp make/mingw64.mk config.mk\r\n      343  make -j4\r\n      344  cd python-package/\r\n      345  python setup.py install\r\n\r\nIt came down to making sure that I had a clean build.  I removed the directory and rechecked it out and then these steps worked for me.",
      "votes": null
    },
    {
      "id": "125033",
      "postDate": "06/24/2016 20:51:31",
      "content": "<p>Larry, you are the best!!! This definitely worked. I did not get any error message when I ran it, and the program created new folders in my directory. </p>\n\n<p>It looks like it created 2 new folders in the python-package folder: </p>\n\n<ol>\n<li>xgboost</li>\n<li>xgboost.egg-info</li>\n</ol>\n\n<p>Outside of the xgboost folder it created another folder: </p>\n\n<ol>\n<li>xgboost-0.4-py2.7.egg</li>\n</ol>\n\n<p>How were you able to import xgboost in your IDE from here?</p>\n\n<p>Thanks again!!!</p>",
      "rawMarkdown": "Larry, you are the best!!! This definitely worked. I did not get any error message when I ran it, and the program created new folders in my directory. \r\n\r\nIt looks like it created 2 new folders in the python-package folder: \r\n\r\n1. xgboost\r\n2. xgboost.egg-info\r\n\r\nOutside of the xgboost folder it created another folder: \r\n\r\n1. xgboost-0.4-py2.7.egg\r\n\r\nHow were you able to import xgboost in your IDE from here?\r\n\r\nThanks again!!!",
      "votes": null
    },
    {
      "id": "125034",
      "postDate": "06/24/2016 20:55:40",
      "content": "<p>@TenaciousTerrier: I meant what Larry said. :-)</p>\n\n<p>If you've done all the steps Larry lists, you should just be able to import it like this:\nimport xgboost</p>\n\n<p>Here's a simple test (taken from: <a href=\"https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_For_Anaconda_on_Windows?lang=en\">https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_For_Anaconda_on_Windows?lang=en</a>)</p>\n\n<p>import xgboost as xgb\nimport numpy as np</p>\n\n<p>data = np.random.rand(5,10) # 5 entities, each contains 10 features\nlabel = np.random.randint(2, size=5) # binary target\ndtrain = xgb.DMatrix( data, label=label)</p>\n\n<p>dtest = dtrain</p>\n\n<p>param = {'bst:max_depth':2, 'bst:eta':1, 'silent':1, 'objective':'binary:logistic' }\nparam['nthread'] = 4\nparam['eval_metric'] = 'auc'</p>\n\n<p>evallist  = [(dtest,'eval'), (dtrain,'train')]</p>\n\n<p>num_round = 10\nbst = xgb.train( param, dtrain, num_round, evallist )</p>\n\n<p>bst.dump_model('dump.raw.txt')</p>",
      "rawMarkdown": "TenaciousTerrier: I meant what Larry said. :-)\r\n\r\nIf you've done all the steps Larry lists, you should just be able to import it like this:\r\nimport xgboost\r\n\r\nHere's a simple test (taken from: https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_For_Anaconda_on_Windows?lang=en)\r\n\r\nimport xgboost as xgb\r\nimport numpy as np\r\n\r\ndata = np.random.rand(5,10) # 5 entities, each contains 10 features\r\nlabel = np.random.randint(2, size=5) # binary target\r\ndtrain = xgb.DMatrix( data, label=label)\r\n\r\ndtest = dtrain\r\n\r\nparam = {'bst:max_depth':2, 'bst:eta':1, 'silent':1, 'objective':'binary:logistic' }\r\nparam['nthread'] = 4\r\nparam['eval_metric'] = 'auc'\r\n\r\nevallist  = [(dtest,'eval'), (dtrain,'train')]\r\n\r\nnum_round = 10\r\nbst = xgb.train( param, dtrain, num_round, evallist )\r\n\r\nbst.dump_model('dump.raw.txt')",
      "votes": null
    },
    {
      "id": "125035",
      "postDate": "06/24/2016 20:58:34",
      "content": "<p>@TenaciousTerrier did you use the xgboost_wrapper.vcxproj in xgboost-0.40\\windows\\xgboost_wrapper?</p>",
      "rawMarkdown": "TenaciousTerrier did you use the xgboost_wrapper.vcxproj in xgboost-0.40\\windows\\xgboost_wrapper?",
      "votes": null
    },
    {
      "id": "125036",
      "postDate": "06/24/2016 21:00:42",
      "content": "<p>Hey guys, this is really awesome! Thanks for all the help! I was getting really frustrated. </p>\n\n<p>I restarted Anaconda and it loaded just fine =)</p>\n\n<p>-Thomas</p>",
      "rawMarkdown": "Hey guys, this is really awesome! Thanks for all the help! I was getting really frustrated. \r\n\r\nI restarted Anaconda and it loaded just fine =)\r\n\r\n-Thomas",
      "votes": null
    },
    {
      "id": "125038",
      "postDate": "06/24/2016 21:04:58",
      "content": "<p>Hi,</p>\n\n<p>I found the following description very helpful. </p>\n\n<p>It is with tdm-gcc and mentioned the importance of installing openmp.\nAnd as last step:</p>\n\n<pre><code>cd&nbsp;python&#8208;package&nbsp;&nbsp;\npython&nbsp;setup.py&nbsp;install&nbsp;\n</code></pre>\n\n<p>With that it simply worked.</p>\n\n<p><a href=\"https://dnc1994.com/2016/03/installing-xgboost-on-windows/\">https://dnc1994.com/2016/03/installing-xgboost-on-windows/</a></p>\n\n<p>All the best. </p>",
      "rawMarkdown": "Hi,\r\n\r\nI found the following description very helpful. \r\n\r\nIt is with tdm-gcc and mentioned the importance of installing openmp.\r\nAnd as last step:\r\n\r\n    cd python‐package  \r\n    python setup.py install \r\n\r\nWith that it simply worked.\r\n\r\nhttps://dnc1994.com/2016/03/installing-xgboost-on-windows/\r\n\r\nAll the best.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 124977,
      "author_name": "zeroblue",
      "author_url": "",
      "post_date": "06/24/2016 05:31:30",
      "content": "<p>It's a real pain.</p>\n\n<p>I recently went through this, and I found these two pages helpful:</p>\n\n<p>Which xgboost to download:\n<a href=\"https://github.com/dmlc/xgboost/issues/1267\">https://github.com/dmlc/xgboost/issues/1267</a></p>\n\n<p>How to do the make:\n<a href=\"https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_For_Anaconda_on_Windows?lang=en\">https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_For_Anaconda_on_Windows?lang=en</a></p>\n\n<p>I hope that helps!</p>\n\n<p>Personally, I'm migrating to Linux.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 124978,
      "author_name": "tenaciousterrier",
      "author_url": "",
      "post_date": "06/24/2016 05:32:58",
      "content": "<p>Thanks for sharing, Michael! Super helpful. </p>\n\n<p>I'm using Canopy for Python, but I may switch over to Anaconda I suppose if it's easier.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 125007,
      "author_name": "larryfreeman",
      "author_url": "",
      "post_date": "06/24/2016 14:41:46",
      "content": "<p>I was able to get XGBoost working using the same IBM page that Michael referred (found the same page a few weeks ago).  I am using anaconda.  </p>\n\n<p>For me the issue turned out to be that I needed to build using MinGW instead of visual studio community edition.  </p>\n\n<p>One other issue I hit.  I found that MinGW had problems installing with my proxy at work so I ended up using <a href=\"https://chocolatey.org/\">chocolatey</a> to install MinGW.  Once I got MinGW installed, I was able to build it and run it without too much issue.</p>\n\n<p>It was much easier to install on ubuntu (my other laptop).  :-)</p>\n\n<p>Good luck.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 125024,
      "author_name": "tenaciousterrier",
      "author_url": "",
      "post_date": "06/24/2016 19:16:46",
      "content": "<p>Okay, I've tried following the IBM instructions. I installed Anaconda so I am trying to install xgboost for it.</p>\n\n<p>I am able to do the following: </p>\n\n<ol>\n<li><p>Clone xgboost from GitHub into the correct folder using Git Bash.</p></li>\n<li><p>Install MinGW and include in PATH system variable with TDM-GCC-64 (see mingw32-make PNG file attached).</p></li>\n</ol>\n\n<p>I get my first error when trying to run each submodule explicitly. When I type 'make -j4' after using cd to go to 'dmlc-core'. I've attached the error message below.</p>\n\n<p>Any help would be GREATLY appreciated!!!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 125026,
      "author_name": "zeroblue",
      "author_url": "",
      "post_date": "06/24/2016 19:26:53",
      "content": "<p>I think with the 9a48a40 build of XGBoost you can just use 'make -j4' directly, and don't need to build the submodules explicitly. </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 125030,
      "author_name": "drarfc",
      "author_url": "",
      "post_date": "06/24/2016 19:51:49",
      "content": "<p>@TenaciousTerrier I use version 0.4\n<a href=\"https://github.com/dmlc/xgboost/releases/tag/v0.40\">https://github.com/dmlc/xgboost/releases/tag/v0.40</a>\nIn the windows directory find the VS project\nCopy all the resulting compiling files to wrapper directory\nRun python setup.py install from wrapper directory.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 125031,
      "author_name": "tenaciousterrier",
      "author_url": "",
      "post_date": "06/24/2016 20:03:54",
      "content": "<p>@Michael Hartman - Not sure if I'm being dull, but what do you mean? I took your advice and tried skipping these commands: \n$ git submodule init\n$ git submodule update</p>\n\n<p>And then entering 'make -j4' into the Git Bash terminal after cloning the xgboost path. I got the same error as before. </p>\n\n<p>@Alex I followed these steps, but I'm not sure if what I'm doing is correct. Could you advise? \n1. Download zip folder, unzip on Desktop\n2. Open xgboost.vs from inside folder with Microsoft Visual Studio 2013\n3. Build Solution</p>\n\n<p>I get the following error: \nError   1   error C1083: Cannot open include file: 'Rinternals.h': No such file or directory    C:\\Users\\thep3\\Desktop\\xgboost-0.40\\r-package\\src\\xgboost_assert.c  3   1   xgboost</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 125032,
      "author_name": "larryfreeman",
      "author_url": "",
      "post_date": "06/24/2016 20:26:18",
      "content": "<p>I hit this same issue.  </p>\n\n<p>Edit:  I found the history.  Here is the exact commands that worked for me:</p>\n\n<pre><code>git clone --recursive https://github.com/dmlc/xgboost\n  338  cd xgboost\n  339  git checkout 9a48a40\n  340  git submodule init\n  341  git submodule update\n  342  cp make/mingw64.mk config.mk\n  343  make -j4\n  344  cd python-package/\n  345  python setup.py install\n</code></pre>\n\n<p>It came down to making sure that I had a clean build.  I removed the directory and rechecked it out and then these steps worked for me.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 125033,
      "author_name": "tenaciousterrier",
      "author_url": "",
      "post_date": "06/24/2016 20:51:31",
      "content": "<p>Larry, you are the best!!! This definitely worked. I did not get any error message when I ran it, and the program created new folders in my directory. </p>\n\n<p>It looks like it created 2 new folders in the python-package folder: </p>\n\n<ol>\n<li>xgboost</li>\n<li>xgboost.egg-info</li>\n</ol>\n\n<p>Outside of the xgboost folder it created another folder: </p>\n\n<ol>\n<li>xgboost-0.4-py2.7.egg</li>\n</ol>\n\n<p>How were you able to import xgboost in your IDE from here?</p>\n\n<p>Thanks again!!!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 125034,
      "author_name": "zeroblue",
      "author_url": "",
      "post_date": "06/24/2016 20:55:40",
      "content": "<p>@TenaciousTerrier: I meant what Larry said. :-)</p>\n\n<p>If you've done all the steps Larry lists, you should just be able to import it like this:\nimport xgboost</p>\n\n<p>Here's a simple test (taken from: <a href=\"https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_For_Anaconda_on_Windows?lang=en\">https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_For_Anaconda_on_Windows?lang=en</a>)</p>\n\n<p>import xgboost as xgb\nimport numpy as np</p>\n\n<p>data = np.random.rand(5,10) # 5 entities, each contains 10 features\nlabel = np.random.randint(2, size=5) # binary target\ndtrain = xgb.DMatrix( data, label=label)</p>\n\n<p>dtest = dtrain</p>\n\n<p>param = {'bst:max_depth':2, 'bst:eta':1, 'silent':1, 'objective':'binary:logistic' }\nparam['nthread'] = 4\nparam['eval_metric'] = 'auc'</p>\n\n<p>evallist  = [(dtest,'eval'), (dtrain,'train')]</p>\n\n<p>num_round = 10\nbst = xgb.train( param, dtrain, num_round, evallist )</p>\n\n<p>bst.dump_model('dump.raw.txt')</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 125035,
      "author_name": "drarfc",
      "author_url": "",
      "post_date": "06/24/2016 20:58:34",
      "content": "<p>@TenaciousTerrier did you use the xgboost_wrapper.vcxproj in xgboost-0.40\\windows\\xgboost_wrapper?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 125036,
      "author_name": "tenaciousterrier",
      "author_url": "",
      "post_date": "06/24/2016 21:00:42",
      "content": "<p>Hey guys, this is really awesome! Thanks for all the help! I was getting really frustrated. </p>\n\n<p>I restarted Anaconda and it loaded just fine =)</p>\n\n<p>-Thomas</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 125038,
      "author_name": "justfor",
      "author_url": "",
      "post_date": "06/24/2016 21:04:58",
      "content": "<p>Hi,</p>\n\n<p>I found the following description very helpful. </p>\n\n<p>It is with tdm-gcc and mentioned the importance of installing openmp.\nAnd as last step:</p>\n\n<pre><code>cd&nbsp;python&#8208;package&nbsp;&nbsp;\npython&nbsp;setup.py&nbsp;install&nbsp;\n</code></pre>\n\n<p>With that it simply worked.</p>\n\n<p><a href=\"https://dnc1994.com/2016/03/installing-xgboost-on-windows/\">https://dnc1994.com/2016/03/installing-xgboost-on-windows/</a></p>\n\n<p>All the best. </p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "124976": "Does anyone know why this is so difficult and if there is an easy way? I spent half a day trying to download and install xgboost for Python, following every piece of instruction I possibly could. Eventually, I just got frustrated and went to R: \r\n\r\ninstall.packages(\"xgbooost\")\r\nlibrary(xgboost)\r\n\r\nAnd I was done. \r\n\r\nSo, now I'm rewriting a lot of my code in R to build a model with xgboost. \r\n\r\nSeriously, I tried all of these different links and nothing I did worked to install xgboost for Python.  \r\n\r\nResources: \r\n\r\n1. Visual Studio method: https://www.kaggle.com/c/otto-group-product-classification-challenge/forums/t/13043/run-xgboost-from-windows-and-python\r\n\r\n2. Binaries from Guido: https://github.com/gatapia/py_ml_utils/tree/master/lib\r\n\r\n3. Liberty Mutual Competition: https://www.kaggle.com/c/liberty-mutual-group-property-inspection-prediction/forums/t/15742/clear-instructions-to-install-xgboost-in-python\r\n\r\n4. Mad Over Data: http://madoverdata.com/machine-learning/installing-xgboost-in-windows/",
    "124977": "It's a real pain.\r\n\r\nI recently went through this, and I found these two pages helpful:\r\n\r\nWhich xgboost to download:\r\nhttps://github.com/dmlc/xgboost/issues/1267\r\n\r\nHow to do the make:\r\nhttps://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_For_Anaconda_on_Windows?lang=en\r\n\r\nI hope that helps!\r\n\r\nPersonally, I'm migrating to Linux.",
    "124978": "Thanks for sharing, Michael! Super helpful. \r\n\r\nI'm using Canopy for Python, but I may switch over to Anaconda I suppose if it's easier.",
    "125007": "I was able to get XGBoost working using the same IBM page that Michael referred (found the same page a few weeks ago).  I am using anaconda.  \r\n\r\nFor me the issue turned out to be that I needed to build using MinGW instead of visual studio community edition.  \r\n\r\nOne other issue I hit.  I found that MinGW had problems installing with my proxy at work so I ended up using [chocolatey][1] to install MinGW.  Once I got MinGW installed, I was able to build it and run it without too much issue.\r\n\r\nIt was much easier to install on ubuntu (my other laptop).  :-)\r\n\r\nGood luck.\r\n\r\n\r\n  [1]: https://chocolatey.org/",
    "125024": "Okay, I've tried following the IBM instructions. I installed Anaconda so I am trying to install xgboost for it.\r\n\r\nI am able to do the following: \r\n\r\n1. Clone xgboost from GitHub into the correct folder using Git Bash.\r\n\r\n2. Install MinGW and include in PATH system variable with TDM-GCC-64 (see mingw32-make PNG file attached).\r\n\r\nI get my first error when trying to run each submodule explicitly. When I type 'make -j4' after using cd to go to 'dmlc-core'. I've attached the error message below.\r\n\r\nAny help would be GREATLY appreciated!!!",
    "125026": "I think with the 9a48a40 build of XGBoost you can just use 'make -j4' directly, and don't need to build the submodules explicitly.",
    "125030": "TenaciousTerrier I use version 0.4\r\nhttps://github.com/dmlc/xgboost/releases/tag/v0.40\r\nIn the windows directory find the VS project\r\nCopy all the resulting compiling files to wrapper directory\r\nRun python setup.py install from wrapper directory.",
    "125031": "Michael Hartman - Not sure if I'm being dull, but what do you mean? I took your advice and tried skipping these commands: \r\n$ git submodule init\r\n$ git submodule update\r\n\r\nAnd then entering 'make -j4' into the Git Bash terminal after cloning the xgboost path. I got the same error as before. \r\n\r\n@Alex I followed these steps, but I'm not sure if what I'm doing is correct. Could you advise? \r\n1. Download zip folder, unzip on Desktop\r\n2. Open xgboost.vs from inside folder with Microsoft Visual Studio 2013\r\n3. Build Solution\r\n\r\nI get the following error: \r\nError\t1\terror C1083: Cannot open include file: 'Rinternals.h': No such file or directory\tC:\\Users\\thep3\\Desktop\\xgboost-0.40\\r-package\\src\\xgboost_assert.c\t3\t1\txgboost",
    "125032": "I hit this same issue.  \r\n\r\nEdit:  I found the history.  Here is the exact commands that worked for me:\r\n\r\n    git clone --recursive https://github.com/dmlc/xgboost\r\n      338  cd xgboost\r\n      339  git checkout 9a48a40\r\n      340  git submodule init\r\n      341  git submodule update\r\n      342  cp make/mingw64.mk config.mk\r\n      343  make -j4\r\n      344  cd python-package/\r\n      345  python setup.py install\r\n\r\nIt came down to making sure that I had a clean build.  I removed the directory and rechecked it out and then these steps worked for me.",
    "125033": "Larry, you are the best!!! This definitely worked. I did not get any error message when I ran it, and the program created new folders in my directory. \r\n\r\nIt looks like it created 2 new folders in the python-package folder: \r\n\r\n1. xgboost\r\n2. xgboost.egg-info\r\n\r\nOutside of the xgboost folder it created another folder: \r\n\r\n1. xgboost-0.4-py2.7.egg\r\n\r\nHow were you able to import xgboost in your IDE from here?\r\n\r\nThanks again!!!",
    "125034": "TenaciousTerrier: I meant what Larry said. :-)\r\n\r\nIf you've done all the steps Larry lists, you should just be able to import it like this:\r\nimport xgboost\r\n\r\nHere's a simple test (taken from: https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_For_Anaconda_on_Windows?lang=en)\r\n\r\nimport xgboost as xgb\r\nimport numpy as np\r\n\r\ndata = np.random.rand(5,10) # 5 entities, each contains 10 features\r\nlabel = np.random.randint(2, size=5) # binary target\r\ndtrain = xgb.DMatrix( data, label=label)\r\n\r\ndtest = dtrain\r\n\r\nparam = {'bst:max_depth':2, 'bst:eta':1, 'silent':1, 'objective':'binary:logistic' }\r\nparam['nthread'] = 4\r\nparam['eval_metric'] = 'auc'\r\n\r\nevallist  = [(dtest,'eval'), (dtrain,'train')]\r\n\r\nnum_round = 10\r\nbst = xgb.train( param, dtrain, num_round, evallist )\r\n\r\nbst.dump_model('dump.raw.txt')",
    "125035": "TenaciousTerrier did you use the xgboost_wrapper.vcxproj in xgboost-0.40\\windows\\xgboost_wrapper?",
    "125036": "Hey guys, this is really awesome! Thanks for all the help! I was getting really frustrated. \r\n\r\nI restarted Anaconda and it loaded just fine =)\r\n\r\n-Thomas",
    "125038": "Hi,\r\n\r\nI found the following description very helpful. \r\n\r\nIt is with tdm-gcc and mentioned the importance of installing openmp.\r\nAnd as last step:\r\n\r\n    cd python‐package  \r\n    python setup.py install \r\n\r\nWith that it simply worked.\r\n\r\nhttps://dnc1994.com/2016/03/installing-xgboost-on-windows/\r\n\r\nAll the best."
  },
  "source": "meta"
}