2016-03-29 15 views
11

Sto usando Anaconda. Sono passato a Python2 (versione 2.7.11).problema di installazione di xgboost con anaconda

python -V 
Python 2.7.11 :: Continuum Analytics, Inc. 

Ho usato il seguente comando per installare xgboost in anaconda.

conda install -c https://conda.anaconda.org/akode xgboost 

Ho quindi controllato che xgboost sia installato.

Eseguire python nel terminale, importare xgboost e ho ricevuto i seguenti errori.

import xgboost as xgb 

Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "//anaconda/envs/wen2/lib/python2.7/site-packages/xgboost.py", line 82, in <module> 
    xglib = load_xglib() 
    File "//anaconda/envs/wen2/lib/python2.7/site-packages/xgboost.py", line 59, in load_xglib 
    lib = ctypes.cdll.LoadLibrary(lib_path[0]) 
    File "//anaconda/envs/wen2/lib/python2.7/ctypes/__init__.py", line 443, in LoadLibrary 
    return self._dlltype(name) 
    File "//anaconda/envs/wen2/lib/python2.7/ctypes/__init__.py", line 365, in __init__ 
    self._handle = _dlopen(self._name, mode) 
OSError: dlopen(//anaconda/envs/wen2/lib/python2.7/site-packages/libxgboostwrapper.so, 6): Library not loaded: @rpath/./libgomp.1.dylib 
    Referenced from: //anaconda/envs/wen2/lib/python2.7/site-packages/libxgboostwrapper.so 
    Reason: image not found 

Non ho idea di cosa fare dopo.

risposta

1

Hai provato a utilizzare pip?
source activate yourenvironment
pip install xgboost

3

Innanzitutto è necessario costruire la biblioteca attraverso "fare", allora è possibile installare utilizzando prompt di anaconda.

Prima seguire la guida ufficiale con la seguente procedura (in Git Bash su Windows):

git clone --recursive https://github.com/dmlc/xgboost 
git submodule init 
git submodule update 

install TDM-GCC here

alias make='mingw32-make' 
cp make/mingw64.mk config.mk; make -j4 

Ultimo, fare la richiesta anaconda seguente utilizzando:

cd xgboost\python-package 
python setup.py install 

Fai riferimento anche a queste grandi risorse:

Official Guide

Installing Xgboost on Windows

Installing XGBoost For Anaconda on Windows

13

L'immagine pacchetto si scarica è danneggiato. cosa si dovrebbe fare:

Innanzitutto rimuovere il pacchetto xgboost con (nel terminale):

conda remove xgboost

quindi reinstallare con un altro pacchetto a https://anaconda.org/aterrel/xgboost Quindi, solo scrivere:

conda install py-xgboost

Poi puoi controllare l'installazione nella console python:

import xgboost

Dovrebbe essere ok.

+0

sembra che installerebbe xgboost che non è aggiornato, insieme a sklearn versione 0.16.1 (non aggiornato) – avloss

+1

Questo non ha funzionato per me. La mia versione python è 3.5.2 e l'errore che ottengo è: 'bash-4.3 $ python -V Python 3.5.2 :: Anaconda 4.2.0 (x86_64) (/ Users/xxx/anaconda) bash-4.3 $ conda installare aterrel -c xgboost Recupero pacchetto di metadati ......... Risoluzione specifiche del pacchetto: .... UnsatisfiableError: Le seguenti specifiche sono stati trovati ad essere in conflitto: - python 3.5 * - xgboost Utilizzare "info condominio " per vedere le dipendenze per ogni pacchetto. ' –

+1

Ok, quello che dovresti fare ora è' conda install py-xgboost' come 0.4.0 è una vecchia versione di xgboost –

0

Ho avuto un problema simile

>>> import xgboost 
/usr/local/anaconda2/lib/python2.7/site-packages/sklearn/cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20. 
    "This module will be removed in 0.20.", DeprecationWarning) 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/usr/local/anaconda2/lib/python2.7/site-packages/xgboost/__init__.py", line 11, in <module> 
    from .core import DMatrix, Booster 
    File "/usr/local/anaconda2/lib/python2.7/site-packages/xgboost/core.py", line 112, in <module> 
    _LIB = _load_lib() 
    File "/usr/local/anaconda2/lib/python2.7/site-packages/xgboost/core.py", line 106, in _load_lib 
    lib = ctypes.cdll.LoadLibrary(lib_path[0]) 
    File "/usr/local/anaconda2/lib/python2.7/ctypes/__init__.py", line 440, in LoadLibrary 
    return self._dlltype(name) 
    File "/usr/local/anaconda2/lib/python2.7/ctypes/__init__.py", line 362, in __init__ 
    self._handle = _dlopen(self._name, mode) 
OSError: /usr/local/anaconda2/bin/../lib/libgomp.so.1: version `GOMP_4.0' not found (required by /usr/local/anaconda2/lib/python2.7/site-packages/xgboost/./lib/libxgboost.so) 

Nel mio caso il problema è che ho installato xgboost con un utente normale.Così ho fatto

sudo su 
pip uninstall xgboost 
pip install xgboost 
python 
>>> import xgboost 
/usr/local/anaconda2/lib/python2.7/site-packages/sklearn/cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20. 
    "This module will be removed in 0.20.", DeprecationWarning) 
>>> ~ 

Spero che questo possa aiutare!

0

nei miei ubuntu 14.04,
prima: l'installazione anaconda
secondo: git clone del xgboost, e fare e installare, complie il pacchetto python
terzo: impostare il xgboost con anaconda. per esempio:
1) cd yourpath/xgboost/python-package
2) a trovare anaconda percorso python python:
anaconda/bin/python setup.py install

5

Ho avuto lo stesso errore. Ho disinstallato xgboost completamente da pip unistall. poi installato indietro da:

conda install -c bioconda xgboost=0.6a2 

Questo sembra risolvere il problema

+0

Grazie, il tuo suggerimento ha funzionato per me. Sai cosa significa "bioconda" nel tuo comando? – user1700890

1

Library not loaded: @rpath/./libgomp.1.dylib

Questa è la chiave.

Nel mio caso, si tratta di "libreria non caricato: /usr/local/opt/gcc/lib/gcc/6/libgomp.1.dylib"

controllo il mio percorso "/ usr/local/opt/gcc/lib/gcc " e c'è solo una cartella denominata 7 lì, nessuna 6.
Quindi uso" sudo find/-name libgomp.1.dylib "per trovare tutte le versioni di gcc che ho installato, con Ho scoperto che esiste una versione 6 in un'altra posizione.
Quindi creo una cartella denominata 6 in "/ usr/local/opt/gcc/lib/gcc" e copia i file di gcc 6 lì. Infine, "import xgboost" funziona senza errori.

Problemi correlati