Xgboost: ImportError:numpy.distutils.coreという名前のモジュールがありません(Ubuntu xgboostのインストール)

作成日 2016年02月11日  ·  17コメント  ·  ソース: dmlc/xgboost

私はUbuntuの新規ユーザーであり、最近Windows10と一緒にUbuntu14.04デスクトップバージョンをダウンロードしました。

私のPC構成は次のとおりです:4 GB RAM、64ビット

ターミナルから次のコマンドを使用してAnacondaをインストールしました(Webサイトからダウンロードした後)。
bash Anaconda3-2.5.0-Linux-x86_64.sh

インストールは成功しました。

今私のubuntuターミナルで、私はhttp://xgboost.readthedocs.org/en/latest/build.html#building-on-ubuntu-debianで指示された手順に従いました

  1. 最近のGNUC ++コンパイラをインストールしました->成功しました
  2. git clone --recursive https://github.com/dmlc/xgboost cd xgboost; make -j4
    ビルドも成功し、「libxgboost.so」をビルドできました。
  3. sudo apt-get install python-setuptools (成功)
  4. cd python-package
  5. sudo python setup.py install

5.コマンドは、数行後にエラーを返します。 エラーは次のとおりです。

'ImportError:numpy.distutils.coreという名前のモジュールがありません'

xgboostをインストールできるように、このエラーを取り除く方法を誰かが提案できますか?

手順5の後の完全なログは次のとおりです。

_sidvash @ sidvash-HP-Pavilion-g6-Notebook-PC:〜/ xgboost / python-package $ sudo python setup.py install
libxgboostを次の場所からインストールします:['/ home / sidvash / xgboost / python-package / xgboost /../../ lib / libxgboost.so']
インストールの実行
bdist_eggを実行しています
egg_infoを実行しています
xgboost.egg-info / requires.txtへの要件の書き込み
xgboost.egg-info / PKG-INFOを書く
トップレベルの名前をxgboost.egg-info / top_level.txtに書き込む
xgboost.egg-info / dependency_links.txtへのdependency_linksの書き込み
マニフェストファイルの読み取り 'xgboost.egg-info / SOURCES.txt'
マニフェストテンプレート「MANIFEST.in」を読み取る
警告:ディレクトリ 'xgboost / include'の下に '_'に一致するファイルが見つかりません
警告:ディレクトリ 'xgboost / src'の下の '_'に一致するファイルが見つかりません
警告:「xgboost / build / _」に一致する以前に含まれていたファイルがディストリビューションのどこにも見つかりません
警告:「xgboost/_。o」に一致する以前に含まれていたファイルがディストリビューションのどこにも見つかりません
警告:「_。pyo」に一致する以前に含まれていたファイルがディストリビューションのどこにも見つかりません
警告:「_。pyc」に一致する以前に含まれていたファイルがディストリビューションのどこにも見つかりません
マニフェストファイルの書き込み 'xgboost.egg-info / SOURCES.txt'
ライブラリコードをbuild / bdist.linux-x86_64 / eggにインストールする
install_libを実行しています
build_pyを実行しています
build / bdist.linux-x86_64 / eggを作成しています
build / bdist.linux-x86_64 / egg / xgboostの作成
build / lib.linux-x86_64-2.7 / xgboost /libpath.py->build / bdist.linux-x86_64 / egg / xgboostをコピーします
build / lib.linux-x86_64-2.7 / xgboost / VERSION->ビルド/bdist.linux-x86_64/egg/xgboostをコピーします
build / lib.linux-x86_64-2.7 / xgboost / build-python.sh-> build / bdist.linux-x86_64 / egg / xgboostをコピーします
build / lib.linux-x86_64-2.7 / xgboost / __ init __。py-> build / bdist.linux-x86_64 / egg / xgboostをコピーします
build / lib.linux-x86_64-2.7 / xgboost /training.py-> build / bdist.linux-x86_64 / egg / xgboostをコピーします
build / lib.linux-x86_64-2.7 / xgboost / compat.py-> build / bdist.linux-x86_64 / egg / xgboostをコピーします
build / lib.linux-x86_64-2.7 / xgboost /core.py->build / bdist.linux-x86_64 / egg / xgboostをコピーします
build / lib.linux-x86_64-2.7 / xgboost / sklearn.py-> build / bdist.linux-x86_64 / egg / xgboostをコピーします
build / lib.linux-x86_64-2.7 / xgboost / plotting.py-> build / bdist.linux-x86_64 / egg / xgboostをコピーします
バイトコンパイルbuild / bdist.linux-x86_64 / egg / xgboost /libpath.pyからlibpath.pyc
バイトコンパイルビルド/ bdist.linux-x86_64版/卵/ xgboost / initのの.pyへのinitに.pyc
バイトコンパイルbuild / bdist.linux-x86_64 / egg / xgboost /training.pyからtraining.pyc
バイトコンパイルbuild / bdist.linux-x86_64 / egg / xgboost /compat.pyからcompat.pyc
バイトコンパイルbuild / bdist.linux-x86_64 / egg / xgboost /core.pyからcore.pyc
バイトコンパイルbuild / bdist.linux-x86_64 / egg / xgboost /sklearn.pyからsklearn.pyc
バイトコンパイルbuild / bdist.linux-x86_64 / egg / xgboost /plotting.pyからplotting.pyc
パッケージデータをbuild / bdist.linux-x86_64 / eggにインストールする
install_dataを実行しています
/ home / sidvash / xgboost / python-package / xgboost /../../ lib / libxgboost.so-> build / bdist.linux-x86_64 / egg / xgboostをコピーします
build / bdist.linux-x86_64 / egg / EGG-INFOを作成しています
xgboost.egg-info / PKG-INFO-> build / bdist.linux-x86_64 / egg / EGG-INFOをコピーしています
xgboost.egg-info / SOURCES.txtをコピー-> build / bdist.linux-x86_64 / egg / EGG-INFO
xgboost.egg-info / dependency_links.txtをコピー-> build / bdist.linux-x86_64 / egg / EGG-INFO
xgboost.egg-info / not-zip-safe-> build / bdist.linux-x86_64 / egg / EGG-INFOをコピーします
xgboost.egg-info / requires.txtをコピー-> build / bdist.linux-x86_64 / egg / EGG-INFO
xgboost.egg-info / top_level.txtをコピー-> build / bdist.linux-x86_64 / egg / EGG-INFO
'dist / xgboost-0.4-py2.7.egg'を作成し、それに 'build / bdist.linux-x86_64 / egg'を追加します
'build / bdist.linux-x86_64 / egg'(およびその下のすべて)を削除します
xgboost-0.4-py2.7.eggを処理しています
'/usr/local/lib/python2.7/dist-packages/xgboost-0.4-py2.7.egg'(およびその下のすべて)を削除します
/usr/local/lib/python2.7/dist-packages/xgboost-0.4-py2.7.eggを作成します
xgboost-0.4-py2.7.eggを/usr/local/lib/python2.7/dist-packagesに抽出しています
xgboost 0.4は、easy-install.pthですでにアクティブなバージョンです。

インストール済み/usr/local/lib/python2.7/dist-packages/xgboost-0.4-py2.7.egg
xgboost == 0.4の依存関係を処理しています
scipyを検索しています
https://pypi.python.org/simple/scipy/を読む
ベストマッチ:scipy 0.17.0
https://pypi.python.org/packages/source/s/scipy/scipy-0.17.0.zip#md5 = 28a4fe29e980804db162524f10873211をダウンロードしてい
scipyの処理-0.17.0.zip
/tmp/easy_install-2YPTnH/scipy-0.17.0/setup.cfgの書き込み
scipy-0.17.0 / setup.py -q bdist_egg --dist-dir / tmp / easy_install-2YPTnH / scipy-0.17.0 / egg-dist-tmp-z4NE5cを実行しています
トレースバック(最後の最後の呼び出し):
ファイル「setup.py」、39行目、
url = 'https://github.com/dmlc/xgboost')
セットアップ中のファイル "/usr/lib/python2.7/distutils/core.py"、行151
dist.run_commands()
run_commandsのファイル "/usr/lib/python2.7/distutils/dist.py"、行953
self.run_command(cmd)
run_commandのファイル "/usr/lib/python2.7/distutils/dist.py"、行972
cmd_obj.run()
ファイル "/usr/lib/python2.7/dist-packages/setuptools/command/install.py"、73行目、実行中
self.do_egg_install()
ファイル「/usr/lib/python2.7/dist-packages/setuptools/command/install.py」、96行目、do_egg_install
cmd.run()
ファイル "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py"、行381、実行中
self.easy_install(spec、self.no_depsではありません)
easy_installのファイル "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py"、行597
self.install_item(None、spec、tmpdir、deps、True)を返します
install_itemのファイル "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py"、行648
self.process_distribution(spec、dist、deps)
process_distributionの694行目のファイル「/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py」
[要件]、self.local_index、self.easy_install
ファイル "/usr/lib/python2.7/dist-packages/pkg_resources.py"、行620、解決中
dist = best [req.key] = env.best_match(req、ws、installer)
ファイル "/usr/lib/python2.7/dist-packages/pkg_resources.py"、行858、best_match
return self.obtain(req、installer)#試してダウンロード/インストール
ファイル "/usr/lib/python2.7/dist-packages/pkg_resources.py"、行870、取得中
インストーラーを返す(要件)
ファイル "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py"、行616、easy_install
self.install_item(spec、dist.location、tmpdir、deps)を返します
install_itemのファイル "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py"、行646
dists = self.install_eggs(spec、download、tmpdir)
install_eggsのファイル "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py"、行834
self.build_and_install(setup_script、setup_base)を返します
build_and_installのファイル "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py"、行1040
self.run_setup(setup_script、setup_base、args)
run_setupのファイル「/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py」、1025行目
run_setup(setup_script、args)
run_setupのファイル "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py"、50行目
ラムダ:execfile(
ファイル "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py"、行100、実行中
func()を返す
ファイル "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py"、52行目
{'ファイル':setup_script、 '名前': 'メイン'}
ファイル "setup.py"、行265、

setup_package内のファイル "setup.py"、行253

ImportError:numpy.distutils`_という名前のモジュールがありません

最も参考になるコメント

'pip install xgboost'が機能しない場合は、次の方法でこの問題を修正することもできます。

sudo -s
python setup.py install 

問題は、「sudopython」がanacodaのpythonの代わりにシステムのPythonを使用することです。

詳細: http

全てのコメント17件

正しいPythonを使用していますか?

試す

which python

また

readlink -f `which python`

Anacondaを使用しているかどうかを判断します。

やあ、

コメントありがとうございます。

どのpythonが以下を返します:
/ home / sidvash / anaconda3 / bin / python

@brickerino :説明のステップ5の後で、ログ全体を更新しました。 それが役立つかどうかを確認してください。

メッセージは、numpyがないことを示しています。PYTHON_PATHがanacondaパッケージパスを指しているかどうかを確認してください。 また、まだの場合は、condaがnumpyをインストールすることを確認してください

@phunterlau
次のコマンドを使用してpython_pathを確認しました。
python -c "import sys; print(sys.path)"

それは戻ります
[''、 '/ 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 ']

これは私には問題ないようです。 ただし、最初の投稿で、パス「/usr/lib/python2.7/dist-packages」がエラーの数行に表示されていることがわかりました。これがPythonパスにも含まれるべきかどうかはわかりません。いいえ。 何か提案してもらえますか?

また、「conda install numpy」を実行すると、次のようになります

Anaconda CloudAPIサイトの使用https://api.anaconda.org
パッケージメタデータの取得:...。
パッケージ仕様の解決:.....................。
環境/ home / sidvash / anaconda3にインストールするためのパッケージプラン:

次のパッケージがダウンロードされます。

| パッケージ| ビルド|
| --- | --- |
| ホイール-0.29.0 | py35_0 82 KB |

次のパッケージが更新されます。

wheel: 0.26.0-py35_1 --> 0.29.0-py35_0

続行しますか([y] / n)? y

パッケージの取得..。
ホイール-0.29.0-p100%| ################################ | 時間:0:00:01 50.38 kB / s
パッケージの抽出..。
[完了] | ############################################## ##### | 100%
パッケージのリンクを解除する..。
[完了] | ############################################## ##### | 100%
パッケージのリンク..。
[完了] | ############################################## ##### | 100

これをインストールした後、sudo python setup.pyのインストールを試みましたが、うまくいきませんでした。それでも同じエラーです。

さて、あなたはシステムとanacondaからのpython、そして両方ともpython 2 3を持っていて、システムのsetuptoolを持っているので、いくつかのenvが台無しになっています。 virtualenvを作成し、numpyscikit-learnとxgboostをインストールすることを提案できます

@phunterlau :コメントありがとうございます。 私は本当にあなたの助けに感謝します。

私はUbuntuの初心者であり、これ以上混乱させたくありません。

これを行うためのステップバイステップのプロセスを教えてください。

以下を使用してvirtualenvを作成できることを知っています:(condaでvirtualenvをインストールすることはお勧めしません)
conda create -n <env_name> python=3.5 anaconda

そして、この環境にnumpy scikit-learnとxgboostをどのようにインストールする必要がありますか?

私は次の方法でenvをアクティブ化できます:
source activate <env_name>

その後、次のようにさらにインストールを続行する必要があります。
pip install numpy
pip install scikit-learn

そしてxgboostの場合、これらすべての手順を繰り返す必要がありますか?
git clone --recursive https://github.com/dmlc/xgboost cd xgboost; make -j4
cd python-package; sudo python setup.py install

さて、私は次のことをしましたが、それでもまったく同じエラーが発生します:
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

何らかの理由で、インストールは引き続き「/usr/lib/python2.7/dist-packages」を参照します

以下の手順に従って整理しました。

  1. 以前にgithubからダウンロードした「xgboost」という名前の現在のディレクトリを削除します。
  2. pip install xgboost

これは魅力のように機能しました。 最新バージョンの場合はgithubからインストールする必要があるとgithubサイトで言及されていたため、以前はこれを試しませんでした。

私はスタックオーバーフローにこの質問を投稿しました、そして誰かがこれを提案しました。 リンクは次のとおりです。
http://stackoverflow.com/questions/35332300/importerror-no-module-named-numpy-distutils-core-ubuntu-xgboost-installation/35493714#35493714

とにかく、あなたの助けてくれてありがとう: @brickerino @phunterlau

pip install xgboost役に立ったことをうれしく思います:-)

'pip install xgboost'が機能しない場合は、次の方法でこの問題を修正することもできます。

sudo -s
python setup.py install 

問題は、「sudopython」がanacodaのpythonの代わりにシステムのPythonを使用することです。

詳細: http

@ knguyen0105私のために

@ knguyen0105エラーが発生する
"/home/ashish/anaconda2/bin/../lib/libgomp.so.1:バージョン` GOMP_4.0 'が見つかりません(/home/ashish/anaconda2/lib/python2.7/site-packages/xgboostで必要) /./lib/libxgboost.so) "

誰か助けてもらえますか?

PYTHON_PATHは何を返すと思いますか?

@ knguyen0105それは私にとってはうまく

ありがとうknguyen0105、Ubuntuの概要、anaconda 2:

  1. http://xgboost.readthedocs.io/en/latest/build.html
  2. sudo -s
    python setup.py install
    それ以外の
    cd python-package; sudo python setup.py install

@ knguyen0105、本当にありがとう

このページは役に立ちましたか?
0 / 5 - 0 評価