title: How to resolve keras.callbacks import errors for TensorBoard?
body: <p><b>Attempt 1</b></p>
  
  <pre><code>from keras.callbacks import TensorBoard
  
  from keras.models import Sequential
  from keras import layers
  from keras.optimizers import RMSprop
  tb_callback = keras.callbacks.TensorBoard(log_dir="/Users/baldur009/Documents/Scripts/log/model_gru", histogram_freq=0, write_graph=True, write_images=True)
  
  model = Sequential()
  model.add(layers.GRU(10, input_shape=(None, ts_matrix.shape[-1])))
  model.add(layers.Dense(1))
  model.compile(optimizer=RMSprop(), loss='mae')
  history = model.fit_generator(train_gen,
                            steps_per_epoch=30,
                            epochs=30,
                            validation_data=val_gen,
                            validation_steps=val_steps, callbacks=[tb_callback])
  </code></pre>
  
  <p>Error: </p>
  
  <pre><code>NameError                                
  Traceback (most recent call last)
  &lt;ipython-input-23-c43bea5e24d5&gt; in &lt;module&gt;()
    2 from keras import layers
    3 from keras.optimizers import RMSprop
  ----&gt; 4 tb_callback = keras.callbacks.TensorBoard(log_dir="/Users/baldur009/Documents/Scripts/log/pertussis_gru", histogram_freq=0, write_graph=True, write_images=True)
    5 
    6 model = Sequential()
  
  NameError: name 'keras' is not defined
  </code></pre>
  
  <p><b>Attempt 2</b></p>
  
  <p>Removed </p>
  
  <pre><code>keras.callbacks
  </code></pre>
  
  <p>So that: </p>
  
  <pre><code>tb_callback = TensorBoard(log_dir="/Users/catherineordun/Documents/Scripts/log/pertussis_gru", histogram_freq=0, write_graph=True, write_images=True)
  </code></pre>
  
  <p>I received the following error upon running:</p>
  
  <pre><code>---&gt; 22 from tensorflow.contrib import bayesflow
   23 from tensorflow.contrib import cloud
   24 from tensorflow.contrib import compiler
  
  ImportError: cannot import name bayesflow
  </code></pre>
  
  <p>As a result, searched and found <a href="https://github.com/tensorflow/tensorflow/issues/10811" rel="nofollow noreferrer">https://github.com/tensorflow/tensorflow/issues/10811</a></p>
  
  <pre><code>conda update dask
  </code></pre>
  
  <p>Continue to receive the same error: </p>
  
  <pre><code>ImportError                               Traceback (most recent call last)
  &lt;ipython-input-48-c43bea5e24d5&gt; in &lt;module&gt;()
    2 from keras import layers
    3 from keras.optimizers import RMSprop
  ----&gt; 4 tb_callback = keras.callbacks.TensorBoard(log_dir="/Users/baldur009/Documents/Scripts/log/pertussis_gru", histogram_freq=0, write_graph=True, write_images=True)
    5 
    6 model = Sequential()
  
   /Users/baldur009/anaconda/lib/python2.7/site-packages/keras/callbacks.pyc in __init__(self, log_dir, histogram_freq, batch_size, write_graph, write_grads, write_images, embeddings_freq, embeddings_layer_names, embeddings_metadata)
  641         global tf, projector
  642         import tensorflow as tf
  --&gt; 643         from tensorflow.contrib.tensorboard.plugins import projector
  644         self.log_dir = log_dir
  645         self.histogram_freq = histogram_freq
  
  /Users/baldur009/anaconda/lib/python2.7/site-packages/tensorflow/contrib/__init__.py in &lt;module&gt;()
   20 
   21 # Add projects here, they will show up under tf.contrib.
  ---&gt; 22 from tensorflow.contrib import bayesflow
   23 from tensorflow.contrib import cloud
   24 from tensorflow.contrib import compiler
  
  ImportError: cannot import name bayesflow
  </code></pre>
  
  <p>So, I read: <a href="https://stackoverflow.com/questions/44054082/keras-utils-to-categorical-name-keras-not-defined">keras.utils.to_categorical() - name keras not defined</a>, and therefore imported the following to cover as many dependencies as possible: </p>
  
  <pre><code>import keras
  import keras.callbacks
  from keras.callbacks import TensorBoard
  </code></pre>
  
  <p>But, continued to face same error. </p>