skip to Main Content

I’ve been working on learning artificial intelligence and how to code with Python.I was working on a project and I decided to update some packages of Python which were not new to work on then something happened and I can’t compile my codes.I deleted Anaconda3 and set it up again but not worked. I’ve been seeing this problem which I wrote as a topic.If someone helps me,I would be appriciated to get some help.

>>> import tensorflow as tf
  File "C:UsersAliGalipAnaconda3Yenilibsite-packagestensorflow__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "C:UsersAliGalipAnaconda3Yenilibsite-packagestensorflowpython__init__.py", line 63, in <module>
    from tensorflow.python.framework.framework_lib import *  # pylint: disable=redefined-builtin
  File "C:UsersAliGalipAnaconda3Yenilibsite-packagestensorflowpythonframeworkframework_lib.py", line 104, in <module>
    from tensorflow.python.framework.importer import import_graph_def
  File "C:UsersAliGalipAnaconda3Yenilibsite-packagestensorflowpythonframeworkimporter.py", line 32, in <module>
    from tensorflow.python.framework import function
  File "C:UsersAliGalipAnaconda3Yenilibsite-packagestensorflowpythonframeworkfunction.py", line 36, in <module>
    from tensorflow.python.ops import resource_variable_ops
  File "C:UsersAliGalipAnaconda3Yenilibsite-packagestensorflowpythonopsresource_variable_ops.py", line 35, in <module>
    from tensorflow.python.ops import variables
  File "C:UsersAliGalipAnaconda3Yenilibsite-packagestensorflowpythonopsvariables.py", line 40, in <module>
    class Variable(checkpointable.CheckpointableBase):
AttributeError: module 'tensorflow.python.training.checkpointable' has no attribute 'CheckpointableBase'

3

Answers


  1. The same question has been posted as a GitHub issue. In particular, the solution suggested by @allanlavoie is likely relevant here as well:

    Sounds like a half-updated version of TensorFlow. Could you try removing TensorFlow entirely (e.g. pip uninstall tf-nightly or whichever package is installed), making sure import tensorflow fails, then reinstalling?

    Since it is apparent from your question that you’re using Anaconda to manage your Python environments, if the above fails to solve your problem, you can try to install TensorFlow in a clean conda environment as follows:

    1. Create a new environment through conda create --name tftest. (You can replace tftest with e.g. the name of your current project.)
    2. Activate that new environment through activate tftest (or source activate tftest if you happen to be using MSYS2’s bash, or something similar to that).
    3. Install TF into this environment through conda install tensorflow.
    4. Ensure that you’re in the right environment through where python (which should produce a path containing “tftest”).
    5. Run Python through python.
    6. import tensorflow as tf in a shell in that environment.

    Since you are using PyCharm (cf. the comments for this answer), you will then want to set up PyCharm for using this new environment instead. Indeed, using a new environment for every project, while disk space-intensive, is a good way of avoiding dependency issues for these rather dependency-heavy numerical packages.

    Login or Signup to reply.
  2. This is error may be dues to the version of the tensorflow, your code is not compatible with the latest version of the tensor flow. Try installing older version of Tensorflow such as 1.14.0 or 1.7.0 it worked for me.

    Login or Signup to reply.
  3. pip3 uninstall tensorflow
    

    And then:

    pip3 install --upgrade "tensorflow==1.15"
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search