holoviz / geoviews

Simple, concise geographical visualization in Python
http://geoviews.org
BSD 3-Clause "New" or "Revised" License
587 stars 75 forks source link

Introduction on website is not working #264

Closed noppelmax closed 5 years ago

noppelmax commented 5 years ago

Hey,

i tried to run the introduction published on the website in my notebook:

import geoviews as gv
import geoviews.feature as gf
import xarray as xr
from cartopy import crs

gv.extension('bokeh', 'matplotlib')

(gf.ocean + gf.land + gf.ocean * gf.land * gf.coastline * gf.borders).options(
    'Feature', projection=crs.Geostationary(), global_extent=True, height=325
).cols(3)

and i just get the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~/.local/lib/python3.5/site-packages/IPython/core/formatters.py in __call__(self, obj, include, exclude)
    968 
    969             if method is not None:
--> 970                 return method(include=include, exclude=exclude)
    971             return None
    972         else:

/usr/local/lib/python3.5/dist-packages/holoviews/core/dimension.py in _repr_mimebundle_(self, include, exclude)
   1263         combined and returned.
   1264         """
-> 1265         return Store.render(self)
   1266 
   1267 

/usr/local/lib/python3.5/dist-packages/holoviews/core/options.py in render(cls, obj)
   1287         data, metadata = {}, {}
   1288         for hook in hooks:
-> 1289             ret = hook(obj)
   1290             if ret is None:
   1291                 continue

/usr/local/lib/python3.5/dist-packages/holoviews/ipython/display_hooks.py in pprint_display(obj)
    270     if not ip.display_formatter.formatters['text/plain'].pprint:
    271         return None
--> 272     return display(obj, raw_output=True)
    273 
    274 

/usr/local/lib/python3.5/dist-packages/holoviews/ipython/display_hooks.py in display(obj, raw_output, **kwargs)
    243     elif isinstance(obj, (Layout, NdLayout, AdjointLayout)):
    244         with option_state(obj):
--> 245             output = layout_display(obj)
    246     elif isinstance(obj, (HoloMap, DynamicMap)):
    247         with option_state(obj):

/usr/local/lib/python3.5/dist-packages/holoviews/ipython/display_hooks.py in wrapped(element)
    140         try:
    141             max_frames = OutputSettings.options['max_frames']
--> 142             mimebundle = fn(element, max_frames=max_frames)
    143             if mimebundle is None:
    144                 return {}, {}

/usr/local/lib/python3.5/dist-packages/holoviews/ipython/display_hooks.py in layout_display(layout, max_frames)
    213         return None
    214 
--> 215     return render(layout)
    216 
    217 

/usr/local/lib/python3.5/dist-packages/holoviews/ipython/display_hooks.py in render(obj, **kwargs)
     63         renderer = renderer.instance(fig='png')
     64 
---> 65     return renderer.components(obj, **kwargs)
     66 
     67 

/usr/local/lib/python3.5/dist-packages/holoviews/plotting/bokeh/renderer.py in components(self, obj, fmt, comm, **kwargs)
    275         # Bokeh has to handle comms directly in <0.12.15
    276         comm = False if bokeh_version < '0.12.15' else comm
--> 277         return super(BokehRenderer, self).components(obj,fmt, comm, **kwargs)
    278 
    279 

/usr/local/lib/python3.5/dist-packages/holoviews/plotting/renderer.py in components(self, obj, fmt, comm, **kwargs)
    315             plot = obj
    316         else:
--> 317             plot, fmt = self._validate(obj, fmt)
    318 
    319         widget_id = None

/usr/local/lib/python3.5/dist-packages/holoviews/plotting/renderer.py in _validate(self, obj, fmt, **kwargs)
    214         if isinstance(obj, tuple(self.widgets.values())):
    215             return obj, 'html'
--> 216         plot = self.get_plot(obj, renderer=self, **kwargs)
    217 
    218         fig_formats = self.mode_formats['fig'][self.mode]

/usr/local/lib/python3.5/dist-packages/holoviews/plotting/bokeh/renderer.py in get_plot(self_or_cls, obj, doc, renderer, **kwargs)
    160             curdoc().theme = self_or_cls.theme
    161         doc.theme = self_or_cls.theme
--> 162         plot = super(BokehRenderer, self_or_cls).get_plot(obj, renderer, **kwargs)
    163         plot.document = doc
    164         return plot

/usr/local/lib/python3.5/dist-packages/holoviews/plotting/renderer.py in get_plot(self_or_cls, obj, renderer, **kwargs)
    201             init_key = tuple(v if d is None else d for v, d in
    202                              zip(plot.keys[0], defaults))
--> 203             plot.update(init_key)
    204         else:
    205             plot = obj

/usr/local/lib/python3.5/dist-packages/holoviews/plotting/plot.py in update(self, key)
    518     def update(self, key):
    519         if len(self) == 1 and ((key == 0) or (key == self.keys[0])) and not self.drawn:
--> 520             return self.initialize_plot()
    521         item = self.__getitem__(key)
    522         self.traverse(lambda x: setattr(x, '_updated', True))

/usr/local/lib/python3.5/dist-packages/holoviews/plotting/bokeh/plot.py in initialize_plot(self, plots, ranges)
    877 
    878                 shared_plots = list(passed_plots) if self.shared_axes else None
--> 879                 subplots = subplot.initialize_plot(ranges=ranges, plots=shared_plots)
    880                 nsubplots = len(subplots)
    881 

/usr/local/lib/python3.5/dist-packages/holoviews/plotting/bokeh/plot.py in initialize_plot(self, ranges, plots)
    994             else:
    995                 passed_plots = plots + adjoined_plots
--> 996                 adjoined_plots.append(subplot.initialize_plot(ranges=ranges, plots=passed_plots))
    997         self.drawn = True
    998         if not adjoined_plots: adjoined_plots = [None]

/usr/local/lib/python3.5/dist-packages/geoviews/plotting/bokeh/plot.py in initialize_plot(self, ranges, plot, plots, source)
     82     def initialize_plot(self, ranges=None, plot=None, plots=None, source=None):
     83         opts = {} if isinstance(self, HvOverlayPlot) else {'source': source}
---> 84         fig = super(GeoPlot, self).initialize_plot(ranges, plot, plots, **opts)
     85         if self.geographic and self.show_bounds and not self.overlaid:
     86             from . import GeoShapePlot

/usr/local/lib/python3.5/dist-packages/holoviews/plotting/bokeh/element.py in initialize_plot(self, ranges, plot, plots, source)
    755         self.handles['plot'] = plot
    756 
--> 757         self._init_glyphs(plot, element, ranges, source)
    758         if not self.overlaid:
    759             self._update_plot(key, plot, style_element)

/usr/local/lib/python3.5/dist-packages/holoviews/plotting/bokeh/element.py in _init_glyphs(self, plot, element, ranges, source)
    706         else:
    707             style = self.style[self.cyclic_index]
--> 708             data, mapping, style = self.get_data(element, ranges, style)
    709             current_id = element._plot_id
    710         if source is None:

/usr/local/lib/python3.5/dist-packages/geoviews/plotting/bokeh/__init__.py in get_data(self, element, ranges, style)
    225 
    226         feature = copy.copy(element.data)
--> 227         feature.scale = self.scale
    228         geoms = list(feature.geometries())
    229         if isinstance(geoms[0], line_types):

AttributeError: can't set attribute

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-7-7fe52500599c> in <module>()
      1 (gf.ocean + gf.land + gf.ocean * gf.land * gf.coastline * gf.borders).options(
      2     'Feature', projection=crs.Geostationary(), global_extent=True, height=325
----> 3 ).cols(3)

~/.local/lib/python3.5/site-packages/IPython/core/displayhook.py in __call__(self, result)
    255             self.start_displayhook()
    256             self.write_output_prompt()
--> 257             format_dict, md_dict = self.compute_format_data(result)
    258             self.update_user_ns(result)
    259             self.fill_exec_result(result)

~/.local/lib/python3.5/site-packages/IPython/core/displayhook.py in compute_format_data(self, result)
    149 
    150         """
--> 151         return self.shell.display_formatter.format(result)
    152 
    153     # This can be set to True by the write_output_prompt method in a subclass

~/.local/lib/python3.5/site-packages/IPython/core/formatters.py in format(self, obj, include, exclude)
    148             return {}, {}
    149 
--> 150         format_dict, md_dict = self.mimebundle_formatter(obj, include=include, exclude=exclude)
    151 
    152         if format_dict or md_dict:

TypeError: 'NoneType' object is not iterable

My Versions:

max@sam ~/g/praktClimaAnalyse (master)> python3 --version
Python 3.5.2
max@sam ~/g/praktClimaAnalyse (master)> geoviews --version
geoviews 1.5.3
max@sam ~/g/praktClimaAnalyse (master)> jupyter --version
4.4.0

maybe the websiteexamples are not up-to-date?

Best regards, Max

philippjfr commented 5 years ago

You either need to downgrade cartopy or upgrade to a geoviews dev release. A real geoviews release compatible with latest cartopy will be released over the next couple of days.

philippjfr commented 5 years ago

GeoViews 1.6.0 has been out for 2 weeks now, and 1.6.1 will follow shortly.