xgboost AttributeError: 'module' object has no attribute 'DMatrix' on Mac

Created on 22 Jul 2015  路  10Comments  路  Source: dmlc/xgboost

Most helpful comment

@jakubLangr In my case(maverick) I had script name xgboost.py, renaming solved the issue.

All 10 comments

Bump! I have the same issue. Mac Yosemite using dockerized versions from ipython/scipystack + custom install of XGB.

@jakubLangr In my case(maverick) I had script name xgboost.py, renaming solved the issue.

ah okay, you mean the mv setup.py xgboost.py or the script that I am running? I am using IPython so I wonder how would that work.

Second case, try to run pure 'hello xgboost' from a console first.

Thanks for your help! Ah okay so that is a workaround, but the trouble is that in my set up that is not very practical. Indeed, the only way I could get this to run was very hacky and did not work.
1. create xgboost.py in the root project folder that
2. This file:
- imports xgboost
- this file calls a pythonized version of the notebook
But I still get the same error as before.

Any ideas?

rename your script from xgboost.py to xgboost_sample.py

Still the same error. So why exactly do you think we are getting this error?

in my case it was a name conflict. I'm no good at python, so might be I have to do something when name of a running script and wrapper/module are equaled.

Have you tried a workaround from original issue?

Yes, I have. Now I have managed to solve the issue, but I am not sure how exactly as I have tried many things. In the end, renaming was not necessary. But I have tried playing around with the filepaths quite a bit. Working setup was:

  • git pull in the project folder
  • .ipynb run from top level of project folder

Rename the file name! You might have named xgboost.py in the same dir!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nicoJiang picture nicoJiang  路  4Comments

frankzhangrui picture frankzhangrui  路  3Comments

vkuznet picture vkuznet  路  3Comments

trivialfis picture trivialfis  路  3Comments

wenbo5565 picture wenbo5565  路  3Comments