6

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.

Community
  • 1
  • 1
ranvijay rathod
  • 61
  • 1
  • 1
  • 5

1 Answers1

12

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)

illright
  • 3,991
  • 2
  • 29
  • 54
Geoff Perrin
  • 444
  • 1
  • 6
  • 14