前提・実現したいこと
「Pythonで始める機械学習」の書籍で学習を行なっていますが、
jupyter notebookを利用してsklearnをインポートした際、エラーが発生します。
以下で同様の質問をされている方がおり、回答にmklでビルドしたnumpyが必要となるとありますが、どれをインストールすれば良いのかわからない状況です。
https://teratail.com/questions/94575
発生している問題・エラーメッセージ
ImportError Traceback (most recent call last)
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/__check_build/init.py in <module>
43 try:
---> 44 from ._check_build import check_build # noqa
45 except ImportError as e:
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/__check_build/_check_build.cpython-39-darwin.so, 2): Symbol not found: ____chkstk_darwin
Referenced from: /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/__check_build/../.dylibs/libomp.dylib (which was built for Mac OS X 10.15)
Expected in: /usr/lib/libSystem.B.dylib
in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/__check_build/../.dylibs/libomp.dylib
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-1-0f8fe9defe1d> in <module>
----> 1 import sklearn
2 print(sklearn.version)
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/init.py in <module>
79 # it and importing it first would fail if the OpenMP dll cannot be found.
80 from . import _distributor_init # noqa: F401
---> 81 from . import __check_build # noqa: F401
82 from .base import clone
83 from .utils._show_versions import show_versions
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/__check_build/init.py in <module>
44 from ._check_build import check_build # noqa
45 except ImportError as e:
---> 46 raise_build_error(e)
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/__check_build/init.py in raise_build_error(e)
29 else:
30 dir_content.append(filename + '\n')
---> 31 raise ImportError("""%s
32 ___________________________________________________________________________
33 Contents of %s:
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/__check_build/_check_build.cpython-39-darwin.so, 2): Symbol not found: ____chkstk_darwin
Referenced from: /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/__check_build/../.dylibs/libomp.dylib (which was built for Mac OS X 10.15)
Expected in: /usr/lib/libSystem.B.dylib
in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/__check_build/../.dylibs/libomp.dylib
Contents of /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/__check_build:
init.py pycache _check_build.cpython-39-darwin.so
setup.py
It seems that scikit-learn has not been built correctly.
If you have installed scikit-learn from source, please do not forget
to build the package before using it: run python setup.py install
or
make
in the source directory.
If you have used an installer, please check that it is suited for your
Python version, your operating system and your platform.
エラーメッセージ
該当のソースコード
import sklearn
試したこと
numpyとscikit-learnをアンインストール後、再度インストールを実施しました。
またpipのupgrade等も実施しました。
補足情報(FW/ツールのバージョンなど)
Mac OS:10.13.6
python:3.9.0
jupyter notebook:6.1.5
pip:0.3.3
scikit-learn:0.24.0
scipy:1.6.0
numpy:1.19.5
ここにより詳細な情報を記載してください。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2021/01/19 11:59