When I try to use Keras in my Conda environment I get this error:
pr_curve_pb = _pr_curve_summary.pb attributeerror: 'module' object has no attribute 'pb'
Error traces:
File "/anaconda3/envs/tensorflow/lib/python3.6/site-packages/keras/init.py", line 3, in
from . import utils
File "/anaconda3/envs/tensorflow/lib/python3.6/site-packages/keras/utils/init.py", line 6, in
from . import conv_utils
File "/anaconda3/envs/tensorflow/lib/python3.6/site-packages/keras/utils/conv_utils.py", line 9, in
from .. import backend as K
File "/anaconda3/envs/tensorflow/lib/python3.6/site-packages/keras/backend/init.py", line 1, in
from .load_backend import epsilon
File "/anaconda3/envs/tensorflow/lib/python3.6/site-packages/keras/backend/load_backend.py", line 90, in
from .tensorflow_backend import *
File "/anaconda3/envs/tensorflow/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 5, in
import tensorflow as tf
File "/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/init.py", line 98, in
from tensorflow_core import *
File "/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow_core/init.py", line 45, in
from . _api.v2 import compat
File "/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow_core/_api/v2/compat/init.py", line 24, in
from . import v2
File "/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow_core/_api/v2/compat/v2/init.py", line 32, in
from . import compat
File "/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow_core/_api/v2/compat/v2/compat/init.py", line 23, in
from tensorflow._api.v2.compat import v1
File "/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow_core/_api/v2/compat/init.py", line 24, in
from . import v2
File "/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow_core/_api/v2/compat/v2/init.py", line 314, in
from tensorboard.summary._tf import summary
File "/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorboard/summary/init.py", line 25, in
from tensorboard.summary import v1
File "/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorboard/summary/v1.py", line 46, in
pr_curve_pb = _pr_curve_summary.pb
AttributeError: module 'tensorboard.plugins.pr_curve.summary' has no attribute 'pb'
I tried to uninstall and install again but did not work.
I got a very similar error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/runner/.local/lib/python2.7/site-packages/tensorflow/__init__.py", line 99, in <module>
from tensorflow_core import *
File "/home/runner/.local/lib/python2.7/site-packages/tensorflow_core/__init__.py", line 36, in <module>
from tensorflow._api.v1 import compat
File "/home/runner/.local/lib/python2.7/site-packages/tensorflow_core/_api/v1/compat/__init__.py", line 24, in <module>
from tensorflow._api.v1.compat import v2
File "/home/runner/.local/lib/python2.7/site-packages/tensorflow_core/_api/v1/compat/v2/__init__.py", line 322, in <module>
from tensorboard.summary._tf import summary
File "/home/runner/.local/lib/python2.7/site-packages/tensorboard/summary/__init__.py", line 25, in <module>
from tensorboard.summary import v1
File "/home/runner/.local/lib/python2.7/site-packages/tensorboard/summary/v1.py", line 46, in <module>
pr_curve_pb = _pr_curve_summary.pb
AttributeError: 'module' object has no attribute 'pb'
This is with Python 2.7 and TF 1.15.0, within a GitHub CI workflow.
While searching for this exception, I found this post here, but also
this: AttributeError: module 'tensorboard.plugins.pr_curve.summary' has no attribute 'pb'
This links to this comment, which suggests to pip uninstall tensorflow-tensorboard
, as there was the old package tensorflow-tensorboard
, and the new package tensorboard
, and that might mess it up.
In my case, this did not help (I got an exception that tensorflow-tensorboard
is not installed, but neither was tensorboard
), although the package tensorboard
existed in ~/.local/lib/python2.7/site-packages
.
The solution, which worked for me, was simply:
rm -rf ~/.local/lib/python2.7/site-packages/tensorboard*
And then followed by a new installation of TF (pip install --user tensorflow==1.15.0
).