質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

解決済

1回答

13720閲覧

pythonでscikit-learnがインストールできない

kojiiwama

総合スコア5

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

0グッド

0クリップ

投稿2019/11/16 07:39

Python学習の初心者ですが、scikit-learnのインストールの時点でつまずいております。

教科書通り、インストールしてもうまく行きません。何が原因なのでしょうか。

#使用したコード
pip3 install scikit-learn

#エラー内容
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/qb/vdgjhwl12rq90xp7pt45pg840000gn/T/pip-install-zfps1x41/scikit-learn/setup.py'"'"'; file='"'"'/private/var/folders/qb/vdgjhwl12rq90xp7pt45pg840000gn/T/pip-install-zfps1x41/scikit-learn/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/qb/vdgjhwl12rq90xp7pt45pg840000gn/T/pip-record-3lr05tls/install-record.txt --single-version-externally-managed --compile
cwd: /private/var/folders/qb/vdgjhwl12rq90xp7pt45pg840000gn/T/pip-install-zfps1x41/scikit-learn/
Complete output (60 lines):
Partial import of sklearn during the build process.
C compiler: x86_64-apple-darwin13.4.0-clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9

compile options: '-c' extra options: '-fopenmp' x86_64-apple-darwin13.4.0-clang: test_openmp.c x86_64-apple-darwin13.4.0-clang -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs objects/test_openmp.o -o test_openmp -fopenmp ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd Undefined symbols for architecture x86_64: "___stack_chk_fail", referenced from: _main in test_openmp.o "___stack_chk_guard", referenced from: _main in test_openmp.o "_printf", referenced from: _.omp_outlined. in test_openmp.o ld: symbol(s) not found for architecture x86_64 clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation) Traceback (most recent call last): File "<string>", line 1, in <module> File "/private/var/folders/qb/vdgjhwl12rq90xp7pt45pg840000gn/T/pip-install-zfps1x41/scikit-learn/setup.py", line 290, in <module> setup_package() File "/private/var/folders/qb/vdgjhwl12rq90xp7pt45pg840000gn/T/pip-install-zfps1x41/scikit-learn/setup.py", line 286, in setup_package setup(**metadata) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/distutils/core.py", line 137, in setup config = configuration() File "/private/var/folders/qb/vdgjhwl12rq90xp7pt45pg840000gn/T/pip-install-zfps1x41/scikit-learn/setup.py", line 174, in configuration config.add_subpackage('sklearn') File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 1033, in add_subpackage config_list = self.get_subpackage(subpackage_name, subpackage_path, File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 999, in get_subpackage config = self._get_configuration_from_setup_py( File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 941, in _get_configuration_from_setup_py config = setup_module.configuration(*args) File "sklearn/setup.py", line 76, in configuration maybe_cythonize_extensions(top_path, config) File "/private/var/folders/qb/vdgjhwl12rq90xp7pt45pg840000gn/T/pip-install-zfps1x41/scikit-learn/sklearn/_build_utils/__init__.py", line 42, in maybe_cythonize_extensions with_openmp = check_openmp_support() File "/private/var/folders/qb/vdgjhwl12rq90xp7pt45pg840000gn/T/pip-install-zfps1x41/scikit-learn/sklearn/_build_utils/openmp_helpers.py", line 140, in check_openmp_support raise CompileError(err_message) distutils.errors.CompileError: *** It seems that scikit-learn cannot be built with OpenMP support. - Make sure you have followed the installation instructions: https://scikit-learn.org/dev/developers/advanced_installation.html - If your compiler supports OpenMP but the build still fails, please submit a bug report at: https://github.com/scikit-learn/scikit-learn/issues - If you want to build scikit-learn without OpenMP support, you can set the environment variable SKLEARN_NO_OPENMP and rerun the build command. Note however that some estimators will run in sequential mode and their `n_jobs` parameter will have no effect anymore. *** ----------------------------------------

#補足情報
そのほかのインストールは問題なくできました。
pip3 install numpy
pip3 install scipy
pip3 install matplotlib

開発環境
python 3.80

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

python 3.8は出たばかりのバージョンなので、まだ主要ライブラリでも対応が済んでいないものがあります。

おおまかな目安ですが、少なくともあと数ヵ月は3.7以前を使った方が無難です。一度python3.8をアンインストールし、3.7系の最新バージョンなどを導入し直してください。

投稿2019/11/16 07:56

hayataka2049

総合スコア30933

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

kojiiwama

2019/11/16 15:42

python3.8をアンインストールし、python3.7をインストールすることでscikit-learnをインストールすることができました。 問題解決のために訪問してきた方へ アンインストールは以下のサイトを参考にしました。 https://qiita.com/Ryooota/items/798ff9450487e1cf1218 また、python3.7インストール後、pipを最新版に更新する必要がありました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問