Soy un nuevo usuario de Ubuntu y recientemente descargué la versión de escritorio de Ubuntu 14.04 junto con Windows 10.
Las configuraciones de mi PC son: 4 GB de RAM, 64 bits
Instalé Anaconda usando el siguiente comando desde la terminal (después de descargar desde el sitio web):
bash Anaconda3-2.5.0-Linux-x86_64.sh
La instalación fue exitosa.
Ahora en mi terminal de ubuntu, seguí los pasos que se indican en http://xgboost.readthedocs.org/en/latest/build.html#building -on-ubuntu-debian
git clone --recursive https://github.com/dmlc/xgboost cd xgboost; make -j4
sudo apt-get install python-setuptools
(Exitoso)cd python-package
sudo python setup.py install
El comando 5. devuelve un error después de varias líneas. El error es el siguiente:
'ImportError: ningún módulo llamado numpy.distutils.core'
¿Alguien puede sugerir cómo deshacerse de este error para que pueda instalar xgboost?
El registro completo después del paso 5 es el siguiente:
_sidvash @ sidvash-HP-Pavilion-g6-Notebook-PC: ~ / xgboost / python-package $ sudo python setup.py install
Instale libxgboost desde: ['/home/sidvash/xgboost/python-package/xgboost/../../lib/libxgboost.so']
ejecutando instalar
ejecutando bdist_egg
ejecutando egg_info
escribir requisitos en xgboost.egg-info / require.txt
escribiendo xgboost.egg-info / PKG-INFO
escribir nombres de nivel superior en xgboost.egg-info / top_level.txt
escribir enlaces_dependencia en xgboost.egg-info / dependency_links.txt
leyendo el archivo de manifiesto 'xgboost.egg-info / SOURCES.txt'
leyendo la plantilla de manifiesto 'MANIFEST.in'
advertencia: no se encontraron archivos que coincidan con '_' en el directorio 'xgboost / include'
advertencia: no se encontraron archivos que coincidan con '_' en el directorio 'xgboost / src'
advertencia: no se han encontrado archivos previamente incluidos que coincidan con 'xgboost / build / _' en ninguna parte de la distribución
advertencia: no se han encontrado archivos previamente incluidos que coincidan con 'xgboost / _. o' en ninguna parte de la distribución
advertencia: no se han encontrado archivos previamente incluidos que coincidan con '_.pyo' en ninguna parte de la distribución
advertencia: no se han encontrado archivos previamente incluidos que coincidan con '_.pyc' en ninguna parte de la distribución
escribiendo el archivo de manifiesto 'xgboost.egg-info / SOURCES.txt'
instalar el código de la biblioteca para construir / bdist.linux-x86_64 / egg
ejecutando install_lib
ejecutando build_py
creando build / bdist.linux-x86_64 / egg
creando build / bdist.linux-x86_64 / egg / xgboost
copiando build / lib.linux-x86_64-2.7 / xgboost / libpath.py -> build / bdist.linux-x86_64 / egg / xgboost
copiando build / lib.linux-x86_64-2.7 / xgboost / VERSION -> build / bdist.linux-x86_64 / egg / xgboost
copiando build / lib.linux-x86_64-2.7 / xgboost / build-python.sh -> build / bdist.linux-x86_64 / egg / xgboost
copiando build / lib.linux-x86_64-2.7 / xgboost / __ init__.py -> build / bdist.linux-x86_64 / egg / xgboost
copiando build / lib.linux-x86_64-2.7 / xgboost / training.py -> build / bdist.linux-x86_64 / egg / xgboost
copiando build / lib.linux-x86_64-2.7 / xgboost / compat.py -> build / bdist.linux-x86_64 / egg / xgboost
copiando build / lib.linux-x86_64-2.7 / xgboost / core.py -> build / bdist.linux-x86_64 / egg / xgboost
copiando build / lib.linux-x86_64-2.7 / xgboost / sklearn.py -> build / bdist.linux-x86_64 / egg / xgboost
copiando build / lib.linux-x86_64-2.7 / xgboost / plotting.py -> build / bdist.linux-x86_64 / egg / xgboost
compilación de bytes / bdist.linux-x86_64 / egg / xgboost / libpath.py a libpath.pyc
compilación de bytes compilación / bdist.linux-x86_64 / egg / xgboost / init .py a init .pyc
compilación de compilación de bytes / bdist.linux-x86_64 / egg / xgboost / training.py a training.pyc
compilación de compilación de bytes / bdist.linux-x86_64 / egg / xgboost / compat.py a compat.pyc
compilación de compilación de bytes / bdist.linux-x86_64 / egg / xgboost / core.py a core.pyc
compilación de bytes / bdist.linux-x86_64 / egg / xgboost / sklearn.py a sklearn.pyc
compilación de bytes / bdist.linux-x86_64 / egg / xgboost / plotting.py a plotting.pyc
instalar los datos del paquete en build / bdist.linux-x86_64 / egg
ejecutando install_data
copiando /home/sidvash/xgboost/python-package/xgboost/../../lib/libxgboost.so -> build / bdist.linux-x86_64 / egg / xgboost
creando build / bdist.linux-x86_64 / egg / EGG-INFO
copiando xgboost.egg-info / PKG-INFO -> build / bdist.linux-x86_64 / egg / EGG-INFO
copiando xgboost.egg-info / SOURCES.txt -> build / bdist.linux-x86_64 / egg / EGG-INFO
copiando xgboost.egg-info / dependency_links.txt -> build / bdist.linux-x86_64 / egg / EGG-INFO
copiando xgboost.egg-info / not-zip-safe -> build / bdist.linux-x86_64 / egg / EGG-INFO
copiando xgboost.egg-info / require.txt -> build / bdist.linux-x86_64 / egg / EGG-INFO
copiando xgboost.egg-info / top_level.txt -> build / bdist.linux-x86_64 / egg / EGG-INFO
creando 'dist / xgboost-0.4-py2.7.egg' y agregando 'build / bdist.linux-x86_64 / egg'
eliminando 'build / bdist.linux-x86_64 / egg' (y todo lo que hay debajo)
Procesando xgboost-0.4-py2.7.egg
eliminando '/usr/local/lib/python2.7/dist-packages/xgboost-0.4-py2.7.egg' (y todo lo que hay debajo)
creando /usr/local/lib/python2.7/dist-packages/xgboost-0.4-py2.7.egg
Extrayendo xgboost-0.4-py2.7.egg a /usr/local/lib/python2.7/dist-packages
xgboost 0.4 ya es la versión activa en easy-install.pth
/Usr/local/lib/python2.7/dist-packages/xgboost-0.4-py2.7.egg instalado
Procesamiento de dependencias para xgboost == 0.4
Buscando scipy
Leyendo https://pypi.python.org/simple/scipy/
Mejor partido: scipy 0.17.0
Descargando https://pypi.python.org/packages/source/s/scipy/scipy-0.17.0.zip#md5 = 28a4fe29e980804db162524f10873211
Procesando scipy-0.17.0.zip
Escribiendo /tmp/easy_install-2YPTnH/scipy-0.17.0/setup.cfg
Ejecutando scipy-0.17.0 / setup.py -q bdist_egg --dist-dir /tmp/easy_install-2YPTnH/scipy-0.17.0/egg-dist-tmp-z4NE5c
Rastreo (llamadas recientes más última):
Archivo "setup.py", línea 39, en
url = 'https: //github.com/dmlc/xgboost')
Archivo "/usr/lib/python2.7/distutils/core.py", línea 151, en la configuración
dist.run_commands ()
Archivo "/usr/lib/python2.7/distutils/dist.py", línea 953, en run_commands
self.run_command (cmd)
Archivo "/usr/lib/python2.7/distutils/dist.py", línea 972, en run_command
cmd_obj.run ()
Archivo "/usr/lib/python2.7/dist-packages/setuptools/command/install.py", línea 73, en ejecución
self.do_egg_install ()
Archivo "/usr/lib/python2.7/dist-packages/setuptools/command/install.py", línea 96, en do_egg_install
cmd.run ()
Archivo "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", línea 381, en ejecución
self.easy_install (especificación, no self.no_deps)
Archivo "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", línea 597, en easy_install
return self.install_item (None, spec, tmpdir, deps, True)
Archivo "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", línea 648, en install_item
self.process_distribution (spec, dist, deps)
Archivo "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", línea 694, en process_distribution
[requisito], self.local_index, self.easy_install
Archivo "/usr/lib/python2.7/dist-packages/pkg_resources.py", línea 620, en resolución
dist = best [req.key] = env.best_match (req, ws, instalador)
Archivo "/usr/lib/python2.7/dist-packages/pkg_resources.py", línea 858, en best_match
return self.obtain (req, installer) # intenta descargar / instalar
Archivo "/usr/lib/python2.7/dist-packages/pkg_resources.py", línea 870, en obtener
instalador de devolución (requisito)
Archivo "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", línea 616, en easy_install
return self.install_item (spec, dist.location, tmpdir, deps)
Archivo "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", línea 646, en install_item
dists = self.install_eggs (especificación, descarga, tmpdir)
Archivo "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", línea 834, en install_eggs
return self.build_and_install (setup_script, setup_base)
Archivo "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", línea 1040, en build_and_install
self.run_setup (setup_script, setup_base, args)
Archivo "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", línea 1025, en run_setup
run_setup (setup_script, args)
Archivo "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", línea 50, en run_setup
lambda: execfile (
Archivo "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", línea 100, en ejecución
return func ()
Archivo "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", línea 52, en
{' archivo ': setup_script, ' nombre ': ' principal '}
Archivo "setup.py", línea 265, en
Archivo "setup.py", línea 253, en setup_package
ImportError: Ningún módulo llamado numpy.distutils`_
¿Estás seguro de que estás usando Python correcto?
Tratar
which python
o
readlink -f `which python`
para determinar si está usando Anaconda o no.
Hola,
Gracias por comentar.
que Python devuelve lo siguiente:
/ inicio / sidvash / anaconda3 / bin / python
@brickerino : Acabo de actualizar el registro completo después del paso 5 en la descripción. Por favor, vea si eso ayuda.
El mensaje muestra que no está teniendo numpy, verifique si su PYTHON_PATH apunta a la ruta del paquete anaconda. Además, asegúrese de instalar conda numpy si aún no lo ha hecho
@phunterlau :
Verifiqué python_path usando el siguiente comando:
python -c "import sys; print (sys.path)"
Devuelve :
['', '/home/sidvash/anaconda3/lib/python35.zip', '/home/sidvash/anaconda3/lib/python3.5', '/home/sidvash/anaconda3/lib/python3.5/plat- linux ',' /home/sidvash/anaconda3/lib/python3.5/lib-dynload ',' /home/sidvash/anaconda3/lib/python3.5/site-packages ',' / home / sidvash / anaconda3 / lib /python3.5/site-packages/Sphinx-1.3.5-py3.5.egg ',' /home/sidvash/anaconda3/lib/python3.5/site-packages/cryptography-1.0.2-py3.5- linux-x86_64.egg ',' /home/sidvash/anaconda3/lib/python3.5/site-packages/setuptools-19.6.2-py3.5.egg ']
Esto me parece bien. Sin embargo, veo en mi primera publicación que la ruta "/usr/lib/python2.7/dist-packages" aparece en varias líneas en el error y no estoy seguro de si esto también debería estar allí en la ruta de Python o no. ¿Podrías sugerir algo?
También ejecuté "conda install numpy" que devolvió lo siguiente :
Usando el sitio de API de Anaconda Cloud https://api.anaconda.org
Obteniendo metadatos del paquete: ....
Resolución de especificaciones del paquete: ......................
Plan de paquete para instalación en environment / home / sidvash / anaconda3:
Se descargarán los siguientes paquetes:
| paquete | construir |
| --- | --- |
| wheel-0.29.0 | py35_0 82 KB |
Se ACTUALIZARÁN los siguientes paquetes:
wheel: 0.26.0-py35_1 --> 0.29.0-py35_0
Continuar ([y] / n)? y
Obteniendo paquetes ...
rueda-0.29.0-p 100% | ############################## | Tiempo: 0:00:01 50,38 kB / s
Extrayendo paquetes ...
[COMPLETO] | ############################################ ##### | 100%
Desvinculando paquetes ...
[COMPLETO] | ############################################ ##### | 100%
Vinculando paquetes ...
[COMPLETO] | ############################################ ##### | 100
Intenté instalar sudo python setup.py después de instalar esto, pero no tuve suerte, sigue siendo el mismo error
bueno, tienes python del sistema y anaconda, y python 2 3 ambos, y tienes la herramienta de configuración del sistema, por lo que algunos env se han equivocado. puedo sugerir la creación de un virtualenv e instalar numpy scikit-learn y xgboost
@phunterlau : Gracias por tu comentario. Realmente aprecio tu ayuda.
Soy un novato en Ubuntu y no quiero estropear más las cosas.
¿Podría decirme un proceso paso a paso para hacer esto?
Sé que puedo crear un virtualenv usando lo siguiente: (no se recomienda instalar virtualenv con conda)
conda create -n <env_name> python=3.5 anaconda
Y luego, ¿cómo debo instalar numpy scikit-learn y xgboost en este entorno?
Puedo activar el env por:
source activate <env_name>
¿Debería continuar con más instalaciones de la siguiente manera?
pip install numpy
pip install scikit-learn
¿Y para xgboost debería repetir todos estos pasos?
git clone --recursive https://github.com/dmlc/xgboost cd xgboost; make -j4
cd python-package;
sudo python setup.py install
Bien, hice lo siguiente pero sigo recibiendo exactamente el mismo error:
conda create -n snakes python=3.5 numpy pandas scikit-learn
sidvash:~$ source activate snakes
discarding /home/sidvash/anaconda3/bin from PATH
prepending /home/sidvash/anaconda3/envs/snakes/bin to PATH
cd xgboost/python-package
sudo python setup.py install
Por alguna razón, la instalación sigue refiriéndose a "/usr/lib/python2.7/dist-packages"
Lo solucioné siguiendo los pasos a continuación:
Funcionó como por arte de magia. No probé esto antes, ya que se mencionó en el sitio de github que debe instalar desde github para obtener la última versión.
Publiqué esta pregunta en el desbordamiento de pila y alguien sugirió esto. Aquí está el enlace:
http://stackoverflow.com/questions/35332300/importerror-no-module-named-numpy-distutils-core-ubuntu-xgboost-installation/35493714#35493714
De todos modos, muchas gracias por su ayuda chicos: @brickerino @phunterlau
Me alegro de que pip install xgboost
ayudó :-)
Si 'pip install xgboost' no funciona para usted, este problema también se puede solucionar haciendo
sudo -s
python setup.py install
El problema es que 'sudo python' usará Python del sistema en lugar de Python de anacoda.
Más detalles: http://stackoverflow.com/questions/30626160/anaconda-python-not-available-from-sudo
@ knguyen0105 Bien funcionó para mí .... gracias tío .... :)
@ knguyen0105 dando error
"/home/ashish/anaconda2/bin/../lib/libgomp.so.1: no se encontró la versión` GOMP_4.0 '(requerida por /home/ashish/anaconda2/lib/python2.7/site-packages/xgboost /./lib/libxgboost.so) "
alguien puede ayudar
¿Qué se supone que devuelve PYTHON_PATH
?
@ knguyen0105 ¡ Funcionó bien para mí! ¡Gracias!
Gracias knguyen0105, Resumen para Ubuntu, anaconda 2:
@ knguyen0105, muchas gracias
Comentario más útil
Si 'pip install xgboost' no funciona para usted, este problema también se puede solucionar haciendo
El problema es que 'sudo python' usará Python del sistema en lugar de Python de anacoda.
Más detalles: http://stackoverflow.com/questions/30626160/anaconda-python-not-available-from-sudo