title: Bokeh "show" giving AttributeError: 'NoneType' object has no attribute 'references'
body: <p>I have a bokeh function which plots a Horizontal bar chart. I'm getting the following error: </p>
  
  <pre><code>AttributeError                            Traceback (most recent call last)
  &lt;ipython-input-149-b0fece870a18&gt; in &lt;module&gt;()
  ----&gt; 1 show(Show_NameBased_Chart(out_dict))
  
  /home/rgupta/anaconda2/lib/python2.7/site-packages/bokeh/util/api.pyc in wrapper(*args, **kw)
      188         @wraps(obj)
      189         def wrapper(*args, **kw):
  --&gt; 190             return obj(*args, **kw)
      191 
      192         wrapper.__bkversion__ = version
  
  /home/rgupta/anaconda2/lib/python2.7/site-packages/bokeh/io/showing.pyc in show(obj, browser, new, notebook_handle, notebook_url)
      126 
      127     if obj not in state.document.roots:
  --&gt; 128         state.document.add_root(obj)
      129     return _show_with_state(obj, state, browser, new, notebook_handle=notebook_handle)
      130 
  
  /home/rgupta/anaconda2/lib/python2.7/site-packages/bokeh/document/document.pyc in add_root(self, model, setter)
      241             self._roots.append(model)
      242         finally:
  --&gt; 243             self._pop_all_models_freeze()
      244         self._trigger_on_change(RootAddedEvent(self, model, setter))
      245 
  
  /home/rgupta/anaconda2/lib/python2.7/site-packages/bokeh/document/document.pyc in _pop_all_models_freeze(self)
      921         self._all_models_freeze_count -= 1
      922         if self._all_models_freeze_count == 0:
  --&gt; 923             self._recompute_all_models()
      924 
      925     def _recompute_all_models(self):
  
  /home/rgupta/anaconda2/lib/python2.7/site-packages/bokeh/document/document.pyc in _recompute_all_models(self)
      929         new_all_models_set = set()
      930         for r in self.roots:
  --&gt; 931             new_all_models_set = new_all_models_set.union(r.references())
      932         old_all_models_set = set(self._all_models.values())
      933         to_detach = old_all_models_set - new_all_models_set
  
  AttributeError: 'NoneType' object has no attribute 'references'
  </code></pre>
  
  <p>It seems to be only coming from the <code>show()</code> function, but at the same time if I pass <code>components()</code>, I get my output.</p>
  
  <p>Following is the code along with a data snippet:</p>
  
  <pre><code>def Show_NameBased_Chart(in_dict):
  
      source = ColumnDataSource(
      data=dict(
          Count = [val.get('size') for val in in_dict.values()],
  
  #         Unique_guests = Transaction_data[Transaction_data.chain_id == CID]\
  #         .groupby('merchant_id').user_id.nunique().tolist(),
  
          Sales = [val.get('amount_spent') for val in in_dict.values()],
  
          ID  = [val for val in in_dict.keys()],
  
  #         Name  = Transaction_data[Transaction_data.chain_id == CID]\
  #                 .groupby('name').sum().index.astype(str).tolist(),
  
          AVG = [val.get('avg') for val in in_dict.values()],
  
      ))
  
      ID = [val for val in in_dict.keys()]
  
  #     Name  = Transaction_data[Transaction_data.chain_id == CID]\
  #                 .groupby('name').sum().index.astype(str).tolist()
  
  #     Label = Transaction_data[Transaction_data.chain_id == CID].location.unique()[0]
  
      hover = HoverTool(tooltips=
  #     #     ("(x,y)", "(@lat, @lon)"),
  #         ("Merch_ID", "@ID"),
  #         ('Revenue','Rs @Sales{0,0.000}'),
  #         ("Visits","@Count"),
  #         ('Avg Val/Tr','@AVG'),
  #         ('Mode','@Mode'),
  #         ("Unique_Visitors", "@Unique_guests")
          """
      &lt;div&gt;
          &lt;div&gt;
              &lt;span style="font-size: 10px;"&gt;Merch_Id:&lt;/span&gt;
              &lt;span style="font-size: 15px; font-weight: bold;"&gt;@ID&lt;/span&gt;
          &lt;div&gt;
  
          &lt;div&gt;
              &lt;span style="font-size: 10px;"&gt;Revenue:&lt;/span&gt;
              &lt;span style= font-size:15px; font-weight: bold;&gt;&amp;#x20B9;&lt;/span&gt; 
              &lt;span style="font-size: 15px; font-weight: bold;"&gt;@Sales{0,0.000}&lt;/span&gt;
          &lt;div&gt;
      &lt;/div&gt;
      """
      )
  
  
      p = figure(y_range= ID)
      # p.background_fill_color = None
      # p.background_fill_alpha = None
      # labels = LabelSet(x='Count', y='ID', text='Count', level='glyph',
      #                y_offset=5, render_mode='canvas',source=source)
      p.add_tools(hover)
      p.grid.grid_line_color = None
      p.xaxis.visible = None
      p.yaxis.axis_line_color = None
      p.xaxis.axis_line_color = None
      p.xaxis.major_tick_line_color = None
      p.xaxis.minor_tick_line_color = None
      p.outline_line_alpha = 0.2
      H_1= HBar(y='ID',right='Sales',height = 0.5,fill_color="#6C69EB")
      # H_2 = HBar(y='ID',right='Sales',height = 0.5)
      p.add_glyph(source, H_1)
      # p_2 = p.add_glyph(source, H_2)
  
  
      # p.add_layout(labels)
      show(p)
  in_dict = {u'1009': {u'Avg': 408.1859554880508,
    u'amount_spent': 185851,
    u'size': 444,
    u'users': [216765,
     632270,
     416138,
     267154,
     220339,
     346041,
     657993,
     658316,
     576653,
     658567,
     658406,
     658546]},
   u'1056': {u'Avg': 436.19081688035646,
    u'amount_spent': 87690,
    u'size': 311,
    u'users': [213761,
     647666,
     639524,
     562168,
     164913,
     645767]},
   u'1103': {u'Avg': 169.83717357910908,
    u'amount_spent': 12734,
    u'size': 69,
    u'users': [370590,
     353842,
     617525,
     339285,
     658440]},
   u'1105': {u'Avg': 260.63440860215053,
    u'amount_spent': 15814,
    u'size': 56,
    u'users': [187569,
     575770,
     91651,
     19981,
     8966,
     19863
     ]}
  </code></pre>
  
  <p>I can't find any apparent reason, why this is happening. Using the components function, I get my <code>script</code>,<code>div</code>; which I can plot. </p>