Keras
TensorFlow

ある日Kerasが動かなくなったとき(2017/8/5)

More than 1 year has passed since last update.

環境

  • Windows 10
  • AnacondaによるPython環境

エラー内容

 今までKerasを実行できていたが、ある日以下のようなエラーが出たとき。
packages\tensorflow\contrib\rnn\python\ops_gru_ops.dll not found

エラー詳細

>>> import keras
Using TensorFlow backend.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Clémence\AppData\Local\Programs\Python\Python35\lib\site-packages\keras\__init__.py", line 3, in <module>
    from . import activations
  File "C:\Users\Clémence\AppData\Local\Programs\Python\Python35\lib\site-packages\keras\activations.py", line 6, in <module>
    from .engine import Layer
  File "C:\Users\Clémence\AppData\Local\Programs\Python\Python35\lib\site-packages\keras\engine\__init__.py", line 8, in <module>
    from .training import Model
  File "C:\Users\Clémence\AppData\Local\Programs\Python\Python35\lib\site-packages\keras\engine\training.py", line 24, in <module>
    from .. import callbacks as cbks
  File "C:\Users\Clémence\AppData\Local\Programs\Python\Python35\lib\site-packages\keras\callbacks.py", line 26, in <module>
    from tensorflow.contrib.tensorboard.plugins import projector
  File "C:\Users\Clémence\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\contrib\__init__.py", line 26, in <module>
    from tensorflow.contrib import crf
  File "C:\Users\Clémence\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\contrib\crf\__init__.py", line 32, in <module>
    from tensorflow.contrib.crf.python.ops.crf import _lengths_to_masks
  File "C:\Users\Clémence\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\contrib\crf\python\ops\crf.py", line 44, in <module>
    from tensorflow.contrib.rnn.python.ops import core_rnn_cell
  File "C:\Users\Clémence\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\contrib\rnn\__init__.py", line 80, in <module>
    from tensorflow.contrib.rnn.python.ops.gru_ops import *
  File "C:\Users\Clémence\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\contrib\rnn\python\ops\gru_ops.py", line 32, in <module>
    resource_loader.get_path_to_datafile("_gru_ops.so"))
  File "C:\Users\Clémence\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\contrib\util\loader.py", line 55, in load_op_library
    ret = load_library.load_op_library(path)
  File "C:\Users\Clémence\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\load_library.py", line 64, in load_op_library
    None, None, error_msg, error_code)
tensorflow.python.framework.errors_impl.NotFoundError: C:\Users\Clémence\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\contrib\rnn\python\ops\_gru_ops.dll not found

対応方法

↓によると、理由はよくわからないが環境を作り直せばなおる。
https://stackoverflow.com/questions/44424068/python-keras-installation-on-windows-10-gru-ops-dll-not-found