Tensorboard: AttributeError: module 'tensorflow._api.v2.compat.v1' has no attribute 'pywrap_tensorflow'

Created on 11 Apr 2019  路  19Comments  路  Source: tensorflow/tensorboard

Cross-posted here from TF issue 27719, as it might be a problem with TensorBoard.

System information

  • TensorBoard version: tb-nightly=1.14.0a20190319
  • TensorFlow version: tf-nightly-2-0-preview=2.0.0.dev20190411
  • OS: macOS 10.14.4
  • TensorFlow installed from: binary
  • TensorFlow version: 2.0.0-dev20190410 (latest nightly)
  • Python version: 3.6.7 (miniconda)

Current behavior & code to reproduce the issue

The following code

import tensorflow as tf

summary_writer = tf.summary.create_file_writer("tmp")

with summary_writer.as_default():
    for i in range(100):
        tf.summary.scalar("index", i, step=i)


summary_writer.close()

outputs this events file to /tmp but trying to view it with tensorboard --logdir ./tmp throws

Exception in thread Reloader:
AttributeError: module 'tensorflow._api.v2.compat.v1' has no attribute 'pywrap_tensorflow'

followed by

W0410 17:26:13.712886 123145489154048 core_plugin.py:172] Unable to get first event timestamp for run .: No event timestamp could be found

and an empty TB dashboard. Any ideas what's causing this?

awaiting tensorflower support

Most helpful comment

The new version of tb-nightly has been published, so if you pip install -U tb-nightly that should fix the pywrap_tensorflow issue.

For the error "Attempting to process TensorSummary output" as far as I can tell, that error would only be produced by a very old version of TensorFlow/TensorBoard (at least two years old). Could you check that you're using up-to-date versions of both?

@jheffez we hear you that event file processing is slow, and we're hoping to make some improvements soon - stay tuned.

All 19 comments

Can you try updating to the latest tb-nightly release? I think #2096 should have fixed this but it will only be in more recent nightly releases, and it looks like yours is from 20190319.

Are you suggesting building from source? Because 1.14.0a20190319 is the latest release currently available on PyPI.

Indeed it is - my bad and thanks for pointing this out. We'll investigate. In the mean time, then yes, the workaround would be building from source (or downgrading to a slightly older TF nightly).

Having same error on Windows10/Python3.6.8. Reverting to tf-nightly-2.0-preview-2.0.0.dev20190409 fixed the problem.

P.S. Any chance to speed up processing of large tfevents files?

@jheffez Downgrading to TF 2.0.0.dev20190409 didn't work for me.

@nfelt Building TB from source did. However, now I'm getting a new error

ERROR:tensorflow:Attempting to process TensorSummary output, but no graph is present,
so processing is impossible. All TensorSummary output will be ignored.
Starting TensorBoard b'39' on port 6006

Does this sound familiar as well?

@janosh, could be the python version. I've had issues with 3.7.x with nightly TF. I'm using 3.6.8.

I don't think so. The error sounds like TB is having problems reading summaries without a corresponding graph. I'm guessing such summaries might be produced by eagerly executed code without the @tf.function decorator in TF 2.0. Could this be the issue, @nfelt?

In any case, I'm running Python 3.6.7.

The new version of tb-nightly has been published, so if you pip install -U tb-nightly that should fix the pywrap_tensorflow issue.

For the error "Attempting to process TensorSummary output" as far as I can tell, that error would only be produced by a very old version of TensorFlow/TensorBoard (at least two years old). Could you check that you're using up-to-date versions of both?

@jheffez we hear you that event file processing is slow, and we're hoping to make some improvements soon - stay tuned.

Updated to:
tb-nightly 1.14.0a20190417
tensorflow-estimator-2.0-preview 1.14.0.dev2019041200
tf-nightly-2.0-preview 2.0.0.dev20190417

Getting warnings:

`(tf2) C:Usersuserpy>tensorboard --logdir=. --host 0.0.0.0
W0418 09:21:39.153165 4264 deprecation_wrapper.py:76] From c:usersuserpytf2libsite-packagestensorboardpluginsinteractive_inferenceutilsplatform_utils.py:70: The name train.Example is deprecated. Please use train.Example instead.

W0418 09:21:39.181148 3868 deprecation_wrapper.py:76] From c:usersuserpytf2libsite-packagestensorboardbackendevent_processingio_wrapper.py:178: The name io.gfile.exists is deprecated. Please use io.gfile.exists instead.

W0418 09:21:39.185147 3868 deprecation_wrapper.py:76] From c:usersuserpytf2libsite-packagestensorboardbackendevent_processingio_wrapper.py:182: The name io.gfile.isdir is deprecated. Please use io.gfile.isdir instead.

W0418 09:21:39.189144 3868 deprecation_wrapper.py:76] From c:usersuserpytf2libsite-packagestensorboardbackendevent_processingio_wrapper.py:157: The name io.gfile.walk is deprecated. Please use io.gfile.walk instead.

W0418 09:21:39.212131 3868 deprecation_wrapper.py:76] From c:usersuserpytf2libsite-packagestensorboardbackendevent_processingio_wrapper.py:59: The name compat.as_str_any is deprecated. Please use compat.as_str_any instead.

W0418 09:21:39.397025 3868 deprecation_wrapper.py:76] From c:usersuserpytf2libsite-packagestensorboardbackendevent_processingio_wrapper.py:65: The name io.gfile.listdir is deprecated. Please use io.gfile.listdir instead.

W0418 09:21:39.403022 3868 deprecation_wrapper.py:76] From c:usersuserpytf2libsite-packagestensorboardbackendevent_processingevent_file_loader.py:43: The name compat.as_bytes is deprecated. Please use compat.as_bytes instead.

TensorBoard 1.14.0a20190417 at http://0.0.0.0:6006 (Press CTRL+C to quit)`

Those warnings are spurious: https://github.com/tensorflow/tensorflow/issues/27897

You can ignore them.

My understanding is that the original issue this was filed for (the missing pywrap_tensorflow AttributeError) should be resolved now, so I'm closing this issue. If you still encounter that please comment; for any other concerns, feel free to open a new issue.

@nfelt Fix confirmed. All is working now.

It still spits warnings on Win10/python 3.6.8
tb-nightly 1.14.0a20190419
tf-nightly-2.0-preview 2.0.0.dev20190417

sample:
W0422 13:16:45.991814 21988 deprecation_wrapper.py:76] From c:usersuserpytf2libsite-packagestensorboardbackendevent_processingevent_file_loader.py:72: The name errors.OutOfRangeError is deprecated. Please use errors.OutOfRangeError instead.

@jheffez I think that deprecation warning was a spurious one from TF that has since been resolved; can you try again?

@nfelt, as of this morning update the issue is gone. Thanks!

I am getting the same error, Could anyone solve it?

I have the same!

I still see this issue on 2.0.0-beta1. even after I have solved tb-nightly-1.14.0a20190603.
My system information is below

TensorBoard version: tb-nightly=1.14.0a20190603.
OS: Ubuntu 16.04(LTS)
TensorFlow installed from: pip
TensorFlow version: 2.0.0-beta1
Python version: 3.6.3

You can use
"from tensorflow.keras.layers import Input"
to import Input rather than from keras.layers

Was this page helpful?
0 / 5 - 0 ratings