title: AttributeError: module 'tensorflow.compat.v2.summary' has no attribute 'scalar'
body: <p>I have been running a u-net on oxford_iiit_pet dataset.</p>
  <p>I followed quite similar the code from this <a href="https://medium.com/analytics-vidhya/training-u-net-from-scratch-using-tensorflow2-0-fad541e2eaf1" rel="nofollow noreferrer">medium</a>.</p>
  <p><a href="https://github.com/NEGU93/cvnn/blob/master/examples/u_net_example.py" rel="nofollow noreferrer">Here</a> you have my code.</p>
  <p>When running the fit method I got the following error message:</p>
  <pre><code> File &quot;/home/barrachina/anaconda3/envs/tf-pip/lib/python3.9/site-packages/keras/engine/training.py&quot;, line 1184, in fit
      tmp_logs = self.train_function(iterator)
    File &quot;/home/barrachina/anaconda3/envs/tf-pip/lib/python3.9/site-packages/tensorflow/python/eager/def_function.py&quot;, line 885, in __call__
      result = self._call(*args, **kwds)
    File &quot;/home/barrachina/anaconda3/envs/tf-pip/lib/python3.9/site-packages/tensorflow/python/eager/def_function.py&quot;, line 933, in _call
      self._initialize(args, kwds, add_initializers_to=initializers)
    File &quot;/home/barrachina/anaconda3/envs/tf-pip/lib/python3.9/site-packages/tensorflow/python/eager/def_function.py&quot;, line 759, in _initialize
      self._stateful_fn._get_concrete_function_internal_garbage_collected(  # pylint: disable=protected-access
    File &quot;/home/barrachina/anaconda3/envs/tf-pip/lib/python3.9/site-packages/tensorflow/python/eager/function.py&quot;, line 3066, in _get_concrete_function_internal_garbage_collected
      graph_function, _ = self._maybe_define_function(args, kwargs)
    File &quot;/home/barrachina/anaconda3/envs/tf-pip/lib/python3.9/site-packages/tensorflow/python/eager/function.py&quot;, line 3463, in _maybe_define_function
      graph_function = self._create_graph_function(args, kwargs)
    File &quot;/home/barrachina/anaconda3/envs/tf-pip/lib/python3.9/site-packages/tensorflow/python/eager/function.py&quot;, line 3298, in _create_graph_function
      func_graph_module.func_graph_from_py_func(
    File &quot;/home/barrachina/anaconda3/envs/tf-pip/lib/python3.9/site-packages/tensorflow/python/framework/func_graph.py&quot;, line 1007, in func_graph_from_py_func
      func_outputs = python_func(*func_args, **func_kwargs)
    File &quot;/home/barrachina/anaconda3/envs/tf-pip/lib/python3.9/site-packages/tensorflow/python/eager/def_function.py&quot;, line 668, in wrapped_fn
      out = weak_wrapped_fn().__wrapped__(*args, **kwds)
    File &quot;/home/barrachina/anaconda3/envs/tf-pip/lib/python3.9/site-packages/tensorflow/python/framework/func_graph.py&quot;, line 994, in wrapper
      raise e.ag_error_metadata.to_exception(e)
  AttributeError: in user code:
  
      /home/barrachina/anaconda3/envs/tf-pip/lib/python3.9/site-packages/keras/engine/training.py:853 train_function  *
          return step_function(self, iterator)
      /home/barrachina/anaconda3/envs/tf-pip/lib/python3.9/site-packages/keras/engine/training.py:845 step_function  **
          write_scalar_summaries(outputs, step=model._train_counter)  # pylint: disable=protected-access
      /home/barrachina/anaconda3/envs/tf-pip/lib/python3.9/site-packages/keras/engine/training.py:2977 write_scalar_summaries
          tf.summary.scalar('batch_' + name, value, step=step)
  
      AttributeError: module 'tensorflow.compat.v2.summary' has no attribute 'scalar'
  </code></pre>
  <p>After seeing more carefully, I realized I got the following warning:</p>
  <pre><code>WARNING:root:Limited tf.compat.v2.summary API due to missing TensorBoard installation.
  WARNING:root:Limited tf.compat.v2.summary API due to missing TensorBoard installation.
  WARNING:root:Limited tf.compat.v2.summary API due to missing TensorBoard installation.
  WARNING:root:Limited tf.summary API due to missing TensorBoard installation.
  WARNING:root:Limited tf.compat.v2.summary API due to missing TensorBoard installation.
  WARNING:root:Limited tf.compat.v2.summary API due to missing TensorBoard installation.
  WARNING:root:Limited tf.compat.v2.summary API due to missing TensorBoard installation.
  </code></pre>
  <p>I tried <code>pip install tensorboard</code> but it says I already have it. I tried uninstalling and installing it back and nothing.</p>
  <hr />
  <p>I am using python version 3.9.6 and tensorflow 2.6.0 and tensorboard 2.6.0.</p>
  <p>Output (cropped) of <code>pip list</code>:</p>
  <pre><code>tensorboard              2.6.0
  tensorboard-data-server  0.6.1
  tensorboard-plugin-wit   1.8.0
  tensorflow               2.6.0
  tensorflow-datasets      4.4.0
  tensorflow-estimator     2.6.0
  tensorflow-metadata      1.2.0
  tensorflow-probability   0.13.0
  </code></pre>
  <p>Actually using a conda environment so <code>conda list</code> gives:</p>
  <pre><code>python                    3.9.6           h49503c6_1_cpython    conda-forge
  ...
  tensorboard               2.6.0                    pypi_0    pypi
  tensorboard-data-server   0.6.1                    pypi_0    pypi
  tensorboard-plugin-wit    1.8.0                    pypi_0    pypi
  tensorflow                2.6.0                    pypi_0    pypi
  tensorflow-datasets       4.4.0                    pypi_0    pypi
  tensorflow-estimator      2.6.0                    pypi_0    pypi
  tensorflow-metadata       1.2.0                    pypi_0    pypi
  tensorflow-probability    0.13.0                   pypi_0    pypi
  </code></pre>