altair-viz / altair_notebooks

Tutorial and Examples Jupyter Notebooks for Altair
BSD 3-Clause "New" or "Revised" License
221 stars 93 forks source link

alt.renderers.enable('notebook') doesn't work with altair 2.0.0dev (master) #8

Closed iliatimofeev closed 6 years ago

iliatimofeev commented 6 years ago

The problem applies to all notebooks in the tutorial

NoSuchEntryPoint                          Traceback (most recent call last)
<ipython-input-10-650f78a52647> in <module>()
      4 # Uncomment/run this line to enable Altair in the classic notebook
      5 #   (this is not necessary in JupyterLab)
----> 6 alt.renderers.enable('notebook')
      7 
      8 cars = data.cars()

~/PycharmProjects/altair/altair/utils/plugin_registry.py in enable(self, name)
     79         """Enable a plugin by name."""
     80         if name not in self._plugins:
---> 81             ep = entrypoints.get_single(self.entry_point_group, name)
     82             value = cast(PluginType, ep.load())
     83             assert isinstance(value, self.plugin_type)

~/anaconda/anaconda/lib/python3.5/site-packages/entrypoints.py in get_single(group, name, path)
    184                 return EntryPoint.from_string(epstr, name, distro)
    185 
--> 186     raise NoSuchEntryPoint(group, name)
    187 
    188 def get_group_named(group, path=None):

NoSuchEntryPoint: No 'notebook' entry point found in group 'altair.vegalite.v2.renderer'

see https://github.com/altair-viz/altair/blob/8fb537bf1f453a9ad9af81da0286382727e3e3e1/altair/vegalite/v2/display.py#L78

alt.renderers.enable('colab') returns ...vegaEmbed is not defined..., so I can't suggest a fix.

jakevdp commented 6 years ago

The notebook renderer is only available if you install the vega3 package, which renders charts in the notebook.

Please see the installation documentation here: https://altair-viz.github.io/getting_started/installation.html#installing-altair-with-jupyter-notebook

iliatimofeev commented 6 years ago

It's trivial, but maybe it can save someone's time:

vega3 should be installed in the current environment of notebook kernel, not in the environment where you launch jupyter notebook. Otherwise, it will be listed as an enabled extension, but will not work as expected.