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
The same question has been posted as a GitHub issue. In particular, the solution suggested by @allanlavoie is likely relevant here as well:
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:
conda create --name tftest
. (You can replacetftest
with e.g. the name of your current project.)activate tftest
(orsource activate tftest
if you happen to be using MSYS2’s bash, or something similar to that).conda install tensorflow
.where python
(which should produce a path containing “tftest”).python
.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.
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.
And then: