title: ipywidgets is not supporting in python terminal
body: <p>I am trying to run below code using python terminal, it works completely fine when i run in jupyter notebook, but in ubuntu terminal it throws error. even tried running  <pre>jupyter nbextension enable --py --sys-prefix widgetsnbextension</pre> on the terminal still I receive same error</p>
  
  <pre><code>import matplotlib as mp
  from pylab import *
  from sklearn import datasets
  from ipywidgets import interact, widgets
  from IPython.display import display, clear_output
  
  faces = datasets.fetch_olivetti_faces()
  
  class Trainer:
      def __init__(self):
          self.results = {}
          self.imgs = faces.images
          self.index = 0
  
      def increment_face(self):
          if self.index + 1 &gt;= len(self.imgs):
              return self.index
          else:
              while str(self.index) in self.results:
                  print(self.index)
                  self.index += 1
              return self.index
  
      def record_result(self, smile=True):
          self.results[str(self.index)] = smile
  
  trainer = Trainer()
  
  button_smile = widgets.Button(description='smile')
  button_no_smile = widgets.Button(description='sad face')
  
  def display_face(face):
      clear_output()
      imshow(face, cmap='gray')
      axis('off')
      show()
  
  def update_smile(b):
      trainer.record_result(smile=True)
      trainer.increment_face()
      display_face(trainer.imgs[trainer.index])
  
  def update_no_smile(b):
      trainer.record_result(smile=False)
      trainer.increment_face()
      display_face(trainer.imgs[trainer.index])
  
  button_no_smile.on_click(update_no_smile)
  button_smile.on_click(update_smile)
  
  display(button_smile)
  display(button_no_smile)
  display_face(trainer.imgs[trainer.index])
  </code></pre>
  
  <p>Traceback error when I was running from python terminal</p>
  
  <pre><code>Widget Javascript not detected.  It may not be installed properly. Did you enable the widgetsnbextension? If not, then run "jupyter nbextension enable --py --sys-prefix widgetsnbextension"
  ---------------------------------------------------------------------------
  AttributeError                            Traceback (most recent call last)
  /home/harish/anaconda3/envs/facial_env/lib/python3.4/site-packages/IPython/core/formatters.py in __call__(self, obj)
      880             method = get_real_method(obj, self.print_method)
      881             if method is not None:
  --&gt; 882                 method()
      883                 return True
      884 
  
  /home/harish/anaconda3/envs/facial_env/lib/python3.4/site-packages/ipywidgets/widgets/widget.py in _ipython_display_(self, **kwargs)
      480                 loud_error('The installed widget Javascript is the wrong version.')
      481 
  --&gt; 482             self._send({"method": "display"})
      483             self._handle_displayed(**kwargs)
      484 
  
  /home/harish/anaconda3/envs/facial_env/lib/python3.4/site-packages/ipywidgets/widgets/widget.py in _send(self, msg, buffers)
      485     def _send(self, msg, buffers=None):
      486         """Sends a message to the model in the front-end."""
  --&gt; 487         self.comm.send(data=msg, buffers=buffers)
      488 
      489 
  
  /home/harish/anaconda3/envs/facial_env/lib/python3.4/site-packages/ipykernel/comm/comm.py in send(self, data, metadata, buffers)
      119         """Send a message to the frontend-side version of this comm"""
      120         self._publish_msg('comm_msg',
  --&gt; 121             data=data, metadata=metadata, buffers=buffers,
      122         )
      123 
  
  /home/harish/anaconda3/envs/facial_env/lib/python3.4/site-packages/ipykernel/comm/comm.py in _publish_msg(self, msg_type, data, metadata, buffers, **keys)
       64         metadata = {} if metadata is None else metadata
       65         content = json_clean(dict(data=data, comm_id=self.comm_id, **keys))
  ---&gt; 66         self.kernel.session.send(self.kernel.iopub_socket, msg_type,
       67             content,
       68             metadata=json_clean(metadata),
  
  AttributeError: 'NoneType' object has no attribute 'session'
  &lt;ipywidgets.widgets.widget_button.Button at 0x7f0de5ebfb38&gt;
  Widget Javascript not detected.  It may not be installed properly. Did you enable the widgetsnbextension? If not, then run "jupyter nbextension enable --py --sys-prefix widgetsnbextension"
  ---------------------------------------------------------------------------
  AttributeError                            Traceback (most recent call last)
  /home/harish/anaconda3/envs/facial_env/lib/python3.4/site-packages/IPython/core/formatters.py in __call__(self, obj)
      880             method = get_real_method(obj, self.print_method)
      881             if method is not None:
  --&gt; 882                 method()
      883                 return True
      884 
  
  /home/harish/anaconda3/envs/facial_env/lib/python3.4/site-packages/ipywidgets/widgets/widget.py in _ipython_display_(self, **kwargs)
      480                 loud_error('The installed widget Javascript is the wrong version.')
      481 
  --&gt; 482             self._send({"method": "display"})
      483             self._handle_displayed(**kwargs)
      484 
  
  /home/harish/anaconda3/envs/facial_env/lib/python3.4/site-packages/ipywidgets/widgets/widget.py in _send(self, msg, buffers)
      485     def _send(self, msg, buffers=None):
      486         """Sends a message to the model in the front-end."""
  --&gt; 487         self.comm.send(data=msg, buffers=buffers)
      488 
      489 
  
  /home/harish/anaconda3/envs/facial_env/lib/python3.4/site-packages/ipykernel/comm/comm.py in send(self, data, metadata, buffers)
      119         """Send a message to the frontend-side version of this comm"""
      120         self._publish_msg('comm_msg',
  --&gt; 121             data=data, metadata=metadata, buffers=buffers,
      122         )
      123 
  
  /home/harish/anaconda3/envs/facial_env/lib/python3.4/site-packages/ipykernel/comm/comm.py in _publish_msg(self, msg_type, data, metadata, buffers, **keys)
       64         metadata = {} if metadata is None else metadata
       65         content = json_clean(dict(data=data, comm_id=self.comm_id, **keys))
  ---&gt; 66         self.kernel.session.send(self.kernel.iopub_socket, msg_type,
       67             content,
       68             metadata=json_clean(metadata),
  
  AttributeError: 'NoneType' object has no attribute 'session'
  &lt;ipywidgets.widgets.widget_button.Button at 0x7f0ddadc2cc0&gt;
  </code></pre>