Forums

installing xgboost on PythonAnywhere

I am trying to install xgboost

git clone --recursive https://github.com/dmlc/xgboost
cd xgboost
make -j4
cd /home/lav/xgboost/python-package 
python setup.py install

and geting the following error :

error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
    [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/test-easy-install-14889.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
    /usr/local/lib/python2.7/dist-packages/
Perhaps your account does not have write access to this directory?

i have payed account . how to make xgboost work on PythonAnywhere?

[edited by admin: formatting]

hi- you don't have write access to /usr/local/lib/python2.7/dist-packages/.

You should use the --prefix option when going through the ./configure and ./make steps to specify a directory you can write to. (eg: /home/lav/mydirectory)

@conrad sory ,i dont get it . Where i should usr --prefix . when i clone git ?

It seems the easiest would be to change the last step to be:

cd python-package
python setup.py develop --user

See this

@conrad Thanks a lot i made this step

cd python-package
python setup.py develop --user

and all installed

Adding xgboost 0.6 to easy-install.pth file
Installed /home/lav/xgboost/python-package
Processing dependencies for xgboost==0.6
Searching for scipy==0.18.0
Best match: scipy 0.18.0
Adding scipy 0.18.0 to easy-install.pth file
Using /usr/local/lib/python2.7/dist-packages
Searching for numpy==1.11.1
Best match: numpy 1.11.1
Adding numpy 1.11.1 to easy-install.pth file
Using /usr/local/lib/python2.7/dist-packages
Finished processing dependencies for xgboost==0.6

but xgboost doesn't work anyway . Then i import xgboost i get no erros . but when i am trying methods from xgboost nothing work

import xgboost as xgb 
booster = xgb.Booster()

AttributeError: module 'xgboost' has no attribute 'Booster'

i think i nedd to compile something after -python setup.py develop --user i had tried everything i can but i dont know how to make xgboost work

[edited by admin for formatting]

I just did a quick test and it works for me. Could something be clashing with the installed xgboost package? Do you have a python file called xgboost.py, or maybe a directory named "xgboost" that is clashing with the one you actually want to import?

When I ran "pip install xgboost", it seems to go fine (please see the msg below). But when I ran my python file, I am getting the following error: No module named 'xgboost' Any help will be greatly appreciated.

=========================================
21:23 ~ $ pip install xgboost
Requirement already satisfied (use --upgrade to upgrade): xgboost in ./xgboost/python-package
Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/local/lib/python2.7/dist-packages (from xgboost)
Requirement already satisfied (use --upgrade to upgrade): scipy in /usr/local/lib/python2.7/dist-packages (from xgboost)
22:42 ~ $ python 
Python 2.7.6 (default, Oct 26 2016, 20:30:19) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

[edit by admin: formatting]

How are you running your Python file? Is it from the editor, or by typing "python2.7 myscript.py" in a bash console?