KeyError: 'projection' when building fresh envs with geoviews
See original GitHub issueALL software version info
bokeh 2.0.0 holoviews 1.13.1rc1 geoviews 1.7.0a3
Description of expected behavior and the observed behavior
Over the past week, I can’t seem to build an environment with geoviews that will successfully display maps with tile services. I just built a fresh conda env from this environment.yaml:
channels:
- pyviz/label/dev
- defaults
- conda-forge
dependencies:
# defaults
- python=3.8
# pyviz/label/dev
- pyviz/label/dev::holoviews
- pyviz/label/dev::param
- pyviz/label/dev::geoviews
- pyviz/label/dev::panel
And it will fail to render the code below. I imagine it has to do with the older geoviews version, but I have conflicts with the more recent release. Any ideas on why? Or a workaround?
Complete, minimal, self-contained example code that reproduces the issue
from shapely.geometry import Polygon
import geoviews as gv
import geoviews.tile_sources as gvts
gvts.OSM * gv.Polygons(Polygon([[0,0],[0,1],[1,1]]))
Stack traceback and/or browser JavaScript console output
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
//miniconda3/envs/lsb_stripped/lib/python3.8/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:
//miniconda3/envs/lsb_stripped/lib/python3.8/site-packages/holoviews/core/dimension.py in _repr_mimebundle_(self, include, exclude)
1302 combined and returned.
1303 """
-> 1304 return Store.render(self)
1305
1306
//miniconda3/envs/lsb_stripped/lib/python3.8/site-packages/holoviews/core/options.py in render(cls, obj)
1393 data, metadata = {}, {}
1394 for hook in hooks:
-> 1395 ret = hook(obj)
1396 if ret is None:
1397 continue
//miniconda3/envs/lsb_stripped/lib/python3.8/site-packages/holoviews/ipython/display_hooks.py in pprint_display(obj)
280 if not ip.display_formatter.formatters['text/plain'].pprint:
281 return None
--> 282 return display(obj, raw_output=True)
283
284
//miniconda3/envs/lsb_stripped/lib/python3.8/site-packages/holoviews/ipython/display_hooks.py in display(obj, raw_output, **kwargs)
250 elif isinstance(obj, (CompositeOverlay, ViewableElement)):
251 with option_state(obj):
--> 252 output = element_display(obj)
253 elif isinstance(obj, (Layout, NdLayout, AdjointLayout)):
254 with option_state(obj):
//miniconda3/envs/lsb_stripped/lib/python3.8/site-packages/holoviews/ipython/display_hooks.py in wrapped(element)
144 try:
145 max_frames = OutputSettings.options['max_frames']
--> 146 mimebundle = fn(element, max_frames=max_frames)
147 if mimebundle is None:
148 return {}, {}
//miniconda3/envs/lsb_stripped/lib/python3.8/site-packages/holoviews/ipython/display_hooks.py in element_display(element, max_frames)
190 return None
191
--> 192 return render(element)
193
194
//miniconda3/envs/lsb_stripped/lib/python3.8/site-packages/holoviews/ipython/display_hooks.py in render(obj, **kwargs)
66 renderer = renderer.instance(fig='png')
67
---> 68 return renderer.components(obj, **kwargs)
69
70
//miniconda3/envs/lsb_stripped/lib/python3.8/site-packages/holoviews/plotting/renderer.py in components(self, obj, fmt, comm, **kwargs)
363 doc = Document()
364 with config.set(embed=embed):
--> 365 model = plot.layout._render_model(doc, comm)
366 return render_model(model, comm) if embed else render_mimebundle(model, doc, comm)
367 else:
//miniconda3/envs/lsb_stripped/lib/python3.8/site-packages/panel/viewable.py in _render_model(self, doc, comm)
363 if comm is None:
364 comm = state._comm_manager.get_server_comm()
--> 365 model = self.get_root(doc, comm)
366
367 if config.embed:
//miniconda3/envs/lsb_stripped/lib/python3.8/site-packages/panel/viewable.py in get_root(self, doc, comm)
534 """
535 doc = doc or _curdoc()
--> 536 root = self._get_model(doc, comm=comm)
537 self._preprocess(root)
538 ref = root.ref['id']
//miniconda3/envs/lsb_stripped/lib/python3.8/site-packages/panel/layout.py in _get_model(self, doc, root, parent, comm)
134 if root is None:
135 root = model
--> 136 objects = self._get_objects(model, [], doc, root, comm)
137 props = dict(self._init_properties(), objects=objects)
138 model.update(**self._process_param_change(props))
//miniconda3/envs/lsb_stripped/lib/python3.8/site-packages/panel/layout.py in _get_objects(self, model, old_objects, doc, root, comm)
124 else:
125 try:
--> 126 child = pane._get_model(doc, root, model, comm)
127 except RerenderError:
128 return self._get_objects(model, current_objects[:i], doc, root, comm)
//miniconda3/envs/lsb_stripped/lib/python3.8/site-packages/panel/pane/holoviews.py in _get_model(self, doc, root, parent, comm)
225 plot = self.object
226 else:
--> 227 plot = self._render(doc, comm, root)
228
229 plot.pane = self
//miniconda3/envs/lsb_stripped/lib/python3.8/site-packages/panel/pane/holoviews.py in _render(self, doc, comm, root)
284 kwargs = {}
285
--> 286 return renderer.get_plot(self.object, **kwargs)
287
288 def _cleanup(self, root):
//miniconda3/envs/lsb_stripped/lib/python3.8/site-packages/holoviews/plotting/bokeh/renderer.py in get_plot(self_or_cls, obj, doc, renderer, **kwargs)
71 combining the bokeh model with another plot.
72 """
---> 73 plot = super(BokehRenderer, self_or_cls).get_plot(obj, doc, renderer, **kwargs)
74 if plot.document is None:
75 plot.document = Document() if self_or_cls.notebook_context else curdoc()
//miniconda3/envs/lsb_stripped/lib/python3.8/site-packages/holoviews/plotting/renderer.py in get_plot(self_or_cls, obj, doc, renderer, comm, **kwargs)
216 if isinstance(obj, AdjointLayout):
217 obj = Layout(obj)
--> 218 plot = self_or_cls.plotting_class(obj)(obj, renderer=renderer,
219 **plot_opts)
220 defaults = [kd.default for kd in plot.dimensions]
//miniconda3/envs/lsb_stripped/lib/python3.8/site-packages/geoviews/plotting/bokeh/plot.py in __init__(self, element, **params)
176
177 def __init__(self, element, **params):
--> 178 super(GeoOverlayPlot, self).__init__(element, **params)
179 self.geographic = any(element.traverse(is_geographic, [_Element]))
180 if self.geographic:
//miniconda3/envs/lsb_stripped/lib/python3.8/site-packages/geoviews/plotting/bokeh/plot.py in __init__(self, element, **params)
58
59 def __init__(self, element, **params):
---> 60 super(GeoPlot, self).__init__(element, **params)
61 self.geographic = is_geographic(self.hmap.last)
62 if self.geographic and not isinstance(self.projection, (PlateCarree, Mercator)):
//miniconda3/envs/lsb_stripped/lib/python3.8/site-packages/holoviews/plotting/plot.py in __init__(self, overlay, ranges, batched, keys, group_counter, **params)
1449 def __init__(self, overlay, ranges=None, batched=True, keys=None, group_counter=None, **params):
1450 if 'projection' not in params:
-> 1451 params['projection'] = self._get_projection(overlay)
1452
1453 super(GenericOverlayPlot, self).__init__(overlay, ranges=ranges, keys=keys,
//miniconda3/envs/lsb_stripped/lib/python3.8/site-packages/geoviews/plotting/plot.py in _get_projection(self, obj)
34 [CompositeOverlay, Element],
35 keyfn=isoverlay, defaults=False)
---> 36 from_overlay = not all(p is None for p in opts[True]['projection'])
37 projections = opts[from_overlay]['projection']
38 infer = any(opts[from_overlay]['infer_projection']) or self.infer_projection
KeyError: 'projection'
:Overlay
.WMTS.I :WMTS [Longitude,Latitude]
.Polygons.I :Polygons [Longitude,Latitude]
Screenshots or screencasts of the bug in action
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
KeyError: 'projection' when saving plot - HoloViz Discourse
I get this same error when running Projections.ipynb with. osx; clean conda install; follow the geoviews install instructions.
Read more >Projections — GeoViews 1.9.5+g5eb9cd4-dirty documentation
The plot projection defined as a plot option defines what coordinate ... By default all elements assume a PlateCarree projection (also sometimes known...
Read more >Untitled
Apg building 6008, Song notes for clarinet, Monster hunter tri agnaktor guide, ... Image reconstruction from projections, Alchera pills, Sana ullah shaheed, ...
Read more >geoviews - bytemeta
geoviews repo issues. ... KeyError: 'projection' when building fresh envs with geoviews. digitaltopo. digitaltopo CLOSED · Updated 2 years ago ...
Read more >Simple Index
building -c-projects-ots.make ... buildpy-server-envs · buildpy-server-testcommands ... django-fresh-media · django-freshdesk · django-freshly
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks! Hoping to get the 1.7.0 release (with HoloViews>1.13 and Bokeh<2.0 support) and 1.8.0 release with (with HoloViews>1.13 and Bokeh>=2.0 support) out tonight.
You’ll need GeoViews 1.8.0 or GeoViews 1.8.1.