Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keras-ImportError: cannot import name ctc_ops

Tags:

keras

I have Anaconda 4.3.1 installed in my laptop after the commands cd /home/username/anaconda3and source bin/activate ~/anaconda3 my package starts . And I installed keras using pip3 conda install keras inside my anaconda. package.and made a document named keras.json inside my keras folder. When I start my Python in anaconda3 and import keras this happens

>>> import keras'
Using TensorFlow backend.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/tushar/.local/lib/python3.5/site-packages/keras/__init__.py", line 3, in <module>
    from . import activations
  File "/home/tushar/.local/lib/python3.5/site-packages/keras/activations.py", line 3, in <module>
    from . import backend as K
  File "/home/tushar/.local/lib/python3.5/site-packages/keras/backend/__init__.py", line 64, in <module>
    from .tensorflow_backend import *
  File "/home/tushar/.local/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 6, in <module>
    from tensorflow.python.ops import ctc_ops as ctc
ImportError: cannot import name 'ctc_ops'

After following this I could not get any solution. I would appreciate any help.

like image 354
ranvijay rathod Avatar asked Mar 26 '17 10:03

ranvijay rathod


1 Answers

I had this same exact issue (I was using pip instead of conda to install keras / tensorflow, however). Make sure you have the most up-to-date version of tensorflow (tensorflow-1.0.1 as of March 31st, 2017).

sudo pip install tensorflow --upgrade

fixed the problem for me (I was running tensorflow-0.9.0rc0 before and was getting the same ImportError: cannot import name ctc_ops error as you)

like image 196
Geoff Perrin Avatar answered Oct 20 '22 18:10

Geoff Perrin