Pas de notes spéciales.
Importation de Chainer et Numpy sur iMac
import numpy
import chainer
Un avertissement apparaît. Il est recommandé d'utiliser d'autres BLAS tels qu'OpenBLAS avec numpy.
/Users/xxx/Library/Python/3.8/lib/python/site-packages/chainer/_environment_check.py:33: UserWarning: Accelerate has been detected as a NumPy backend library.
vecLib, which is a part of Accelerate, is known not to work correctly with Chainer.
We recommend using other BLAS libraries such as OpenBLAS.
For details of the issue, please see
https://docs.chainer.org/en/stable/tips.html#mnist-example-does-not-converge-in-cpu-mode-on-mac-os-x.
Please be aware that Mac OS X is not an officially supported OS.
warnings.warn('''\
Insérez OpenBLAS conformément à la page officielle. https://docs.chainer.org/en/stable/tips.html#mnist-example-does-not-converge-in-cpu-mode-on-mac-os-x.
Use Homebrew to install OpenBLAS.
$ brew install openblas
Uninstall existing NumPy installation
$ pip uninstall numpy
You’ll to create a file called .numpy-site.cfg in your home (~/) directory with the following:
[openblas]
libraries = openblas
library_dirs = /usr/local/opt/openblas/lib
include_dirs = /usr/local/opt/openblas/include
Install NumPy from the source code
pip install --no-binary :all: numpy
Confirm NumPy has been installed with OpenBLAS by running this command:
$ python -c "import numpy; print(numpy.show_config())"
You should see the following information:
blas_mkl_info:
NOT AVAILABLE
blis_info:
NOT AVAILABLE
openblas_info:
libraries = ['openblas', 'openblas']
library_dirs = ['/usr/local/opt/openblas/lib']
language = c
define_macros = [('HAVE_CBLAS', None)]
runtime_library_dirs = ['/usr/local/opt/openblas/lib']
...
Once this is done, you should be able to import chainer without OpenBLAS errors.
résultat
blas_mkl_info:
NOT AVAILABLE
blis_info:
NOT AVAILABLE
openblas_info:
libraries = ['openblas', 'openblas']
library_dirs = ['/usr/local/opt/openblas/lib']
language = c
define_macros = [('HAVE_CBLAS', None)]
blas_opt_info:
libraries = ['openblas', 'openblas']
library_dirs = ['/usr/local/opt/openblas/lib']
language = c
define_macros = [('HAVE_CBLAS', None)]
lapack_mkl_info:
NOT AVAILABLE
openblas_lapack_info:
libraries = ['openblas', 'openblas']
library_dirs = ['/usr/local/opt/openblas/lib']
language = c
define_macros = [('HAVE_CBLAS', None)]
lapack_opt_info:
libraries = ['openblas', 'openblas']
library_dirs = ['/usr/local/opt/openblas/lib']
language = c
define_macros = [('HAVE_CBLAS', None)]
Maintenant, importer le chainer et importer numpy ne donnent plus d'erreur.
Supplément Pour .numpy-site.cfg, créez simplement un fichier texte avec 4 lignes comme officiellement écrit et enregistrez-le dans votre répertoire personnel avec le nom .numpy-site.cfg. Les fichiers commençant par "." Sont des fichiers cachés. Vous pouvez afficher / masquer avec la commande + shift +. Notez que si vous supprimez ce fichier, vous obtiendrez à nouveau une erreur.
Recommended Posts