holoviz / geoviews

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

Geoviews tutorial doesn't run 'Bokeh' 'Figure' object has no attribute 'set' #49

Closed DimEvil closed 7 years ago

DimEvil commented 7 years ago

I'm stuck in the tutorial and I don't know where it went wrong. Version bokeh 0.12.5dev-py36_0 geoviews 1.2.0dev1 Windows env.

thnx!

https://www.continuum.io/blog/developer-blog/introducing-geoviews

%%output backend='bokeh' %%opts Overlay [width=600 height=500 xaxis=None yaxis=None] Feature.Lines (line_color='gray' line_width=0.5) features


AttributeError Traceback (most recent call last) C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\IPython\core\formatters.py in call(self, obj) 305 pass 306 else: --> 307 return printer(obj) 308 # Finally look for special method names 309 method = get_real_method(obj, self.print_method)

C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\holoviews\ipython\display_hooks.py in pprint_display(obj) 214 if not ip.display_formatter.formatters['text/plain'].pprint: 215 return None --> 216 return display(obj, raw=True) 217 218

C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\holoviews\ipython\display_hooks.py in display(obj, raw, **kwargs) 196 html = grid_display(obj) 197 elif isinstance(obj, (CompositeOverlay, ViewableElement)): --> 198 html = element_display(obj) 199 elif isinstance(obj, (Layout, NdLayout, AdjointLayout)): 200 html = layout_display(obj)

C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\holoviews\ipython\display_hooks.py in wrapped(element) 101 html = fn(element, 102 max_frames=OutputMagic.options['max_frames'], --> 103 max_branches = OutputMagic.options['max_branches']) 104 105 # Only want to add to the archive for one display hook...

C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\holoviews\ipython\display_hooks.py in element_display(element, max_frames, max_branches) 142 return None 143 renderer = Store.renderers[backend] --> 144 return renderer.html(element, fmt=renderer.fig) 145 146

C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\holoviews\plotting\renderer.py in html(self, obj, fmt, css) 248 Renders plot or data structure and wraps the output in HTML. 249 """ --> 250 plot, fmt = self.validate(obj, fmt) 251 figdata, = self(plot, fmt) 252 if css is None: css = self.css

C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\holoviews\plotting\renderer.py in _validate(self, obj, fmt) 188 if isinstance(obj, tuple(self.widgets.values())): 189 return obj, 'html' --> 190 plot = self.get_plot(obj) 191 192 fig_formats = self.mode_formats['fig'][self.mode]

C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\holoviews\plotting\renderer.py in get_plot(self_or_cls, obj) 175 plot_opts = self_or_cls.plot_options(obj, self_or_cls.size) 176 plot = self_or_cls.plotting_class(obj)(obj, **plot_opts) --> 177 plot.update(0) 178 else: 179 plot = obj

C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\holoviews\plotting\plot.py in update(self, key) 469 def update(self, key): 470 if len(self) == 1 and key == 0 and not self.drawn: --> 471 return self.initialize_plot() 472 return self.getitem(key) 473

C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\holoviews\plotting\bokeh\element.py in initialize_plot(self, ranges, plot, plots) 812 self._init_axes(plot) 813 if plot and not self.overlaid: --> 814 self._update_plot(key, plot, element) 815 self.handles['plot'] = plot 816

C:\Users\dimitri_brosens\AppData\Local\Continuum\Anaconda3\lib\site-packages\holoviews\plotting\bokeh\element.py in _update_plot(self, key, plot, element) 393 el = element.traverse(lambda x: x, [Element]) 394 dimensions = el[0].dimensions() if el else el.dimensions() --> 395 plot.set(**self._plot_properties(key, plot, element)) 396 props = {axis: self._axis_properties(axis, key, plot, dim) 397 for axis, dim in zip(['x', 'y'], dimensions)}

AttributeError: 'Figure' object has no attribute 'set'

Out[67]: :Overlay .Ocean.I :Feature [Longitude,Latitude] .Land.I :Feature [Longitude,Latitude] .Lines.I :Feature [Longitude,Latitude] .Rivers.I :Feature [Longitude,Latitude] .Lakes.I :Feature [Longitude,Latitude] .Borders.I :Feature [Longitude,Latitude] .Coastline.I :Feature [Longitude,Latitude]

philippjfr commented 7 years ago

I'd downgrade back to bokeh 0.12.4 and upgrade to holoviews 1.7dev7 with:

conda install -c ioam/label/dev holoviews bokeh=0.12.4

We'll have a new holoviews release by the end of the month.

DimEvil commented 7 years ago

It worked!!

philippjfr commented 7 years ago

Sorry for this issue, we of course try to have compatible versions, but both bokeh 0.12.4/5 and matplotlib 2.0 changes caught us at a bad time.

joeborrello commented 6 years ago

I think I may be experiencing a similar issue with the plotly extension right now. I'm trying to plot a TriSurface using plotly and keep getting the following error message:

AttributeError Traceback (most recent call last) ~/anaconda3/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:

~/anaconda3/lib/python3.5/site-packages/holoviews/core/dimension.py in _reprmimebundle(self, include, exclude) 1263 combined and returned. 1264 """ -> 1265 return Store.render(self) 1266 1267

~/anaconda3/lib/python3.5/site-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

~/anaconda3/lib/python3.5/site-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

~/anaconda3/lib/python3.5/site-packages/holoviews/ipython/display_hooks.py in display(obj, raw_output, **kwargs) 240 elif isinstance(obj, (CompositeOverlay, ViewableElement)): 241 with option_state(obj): --> 242 output = element_display(obj) 243 elif isinstance(obj, (Layout, NdLayout, AdjointLayout)): 244 with option_state(obj):

~/anaconda3/lib/python3.5/site-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 {}, {}

~/anaconda3/lib/python3.5/site-packages/holoviews/ipython/display_hooks.py in element_display(element, max_frames) 186 return None 187 --> 188 return render(element) 189 190

~/anaconda3/lib/python3.5/site-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

~/anaconda3/lib/python3.5/site-packages/holoviews/plotting/renderer.py in components(self, obj, fmt, comm, kwargs) 336 widget_id = plot.id 337 else: --> 338 html, js = self._figure_data(plot, fmt, as_script=True, kwargs) 339 plot_id = plot.id 340 if comm and plot.comm is not None and self.comm_msg_handler:

~/anaconda3/lib/python3.5/site-packages/holoviews/plotting/plotly/renderer.py in _figure_data(self, plot, fmt, divuuid, comm, as_script, width, height) 84 divuuid = plot.id 85 ---> 86 jdata = json.dumps(figure.get('data', []), cls=utils.PlotlyJSONEncoder) 87 jlayout = json.dumps(figure.get('layout', {}), cls=utils.PlotlyJSONEncoder) 88

AttributeError: 'Figure' object has no attribute 'get'

Currently running the following versions of software: holoviews: 1.10.7 plotly: 3.1.0

philippjfr commented 6 years ago

@joeborrello HoloViews is currently not compatible with plotly >=3 you can track the progress on adding that support here.