Help us understand the problem. What is going on with this article?

RuntimeError: CUDA environment is not correctly set up

More than 3 years have passed since last update.

Chainer+GPUはMacで動くのだろうか

El CapitanでChainer+GPUを動かそうとしたらRuntimeError: CUDA environment is not correctly set upと出た。

$ python MLP.py --gpu 0
Traceback (most recent call last):
  File "MLP.py", line 126, in <module>
    x_batch = cuda.to_gpu(x_batch)
  File "/usr/local/var/pyenv/versions/2.7.11/lib/python2.7/site-packages/chainer/cuda.py", line 192, in to_gpu
    check_cuda_available()
  File "/usr/local/var/pyenv/versions/2.7.11/lib/python2.7/site-packages/chainer/cuda.py", line 82, in check_cuda_available
    raise RuntimeError(msg)
RuntimeError: CUDA environment is not correctly set up
(see https://github.com/pfnet/chainer#installation).dlopen(/usr/local/var/pyenv/versions/2.7.11/lib/python2.7/site-packages/cupy/core/core.so, 2): Library not loaded: @rpath/libcublas.7.5.dylib
  Referenced from: /usr/local/var/pyenv/versions/2.7.11/lib/python2.7/site-packages/cupy/core/core.so
  Reason: image not found

環境

  • OS X 10.11.4 (El Capitan)
  • NVIDIA GeForce GT 750M
  • python 2.7.11
  • Chainer 1.8.0
  • CUDA 7.5

解決。動いた。

  • パスを通してターミナル再起動
~/.bashrc
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:$DYLD_LIBRARY_PATH
  • SIP(Macのシステム保護機能)を無効化

一旦システムを終了させ、Command + R + 電源ボタンで起動後、ターミナルで

$ csrutil disable

を実行

  • Chainerをインストールしなおす
$ pip uninstall chainer
$ CUDA_PATH=/usr/local/cuda pip install chainer --no-cache-dir

参考

komakomako
NTTデータ辞めました
https://www.mahirokazuko.com/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした