Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

species distribution: ImportError: Geographic projection support requires: geoviews. #2

Open
byandell opened this issue Sep 27, 2024 · 0 comments

Comments

@byandell
Copy link

I got stumped in notebook 33 trying to do hvplot with Mercator projection. The error message was
ImportError: Geographic projection support requires: geoviews.
Is geoviews installed in the docker image? and is it current? I don't know how to check. See
https://github.com/earthlab-education/species-distribution-coding-challenge-byandell/blob/main/notebooks/species-distribution-33-plot.ipynb

Python code:

Get month names

import calendar

Libraries for Dynamic mapping

import cartopy.crs as ccrs
import hvplot.pandas
import panel as pn

Simplify the geometry to speed up processing

ecoregions_gdf.geometry = ecoregions_gdf.simplify(
.05, preserve_topology=False)

Change the CRS to Mercator for mapping

ecoregions_gdf = ecoregions_gdf.to_crs(ccrs.Mercator())

Check that the plot runs

ecoregions_gdf.hvplot(geo=True, crs=ccrs.Mercator())


Error message

ImportError Traceback (most recent call last)
Cell In[30], line 1
----> 1 ecoregions_gdf.hvplot(geo=True, crs=ccrs.Mercator())

File /opt/conda/lib/python3.10/site-packages/hvplot/plotting/core.py:92, in hvPlotBase.call(self, x, y, kind, **kwds)
89 plot = self._get_converter(x, y, kind, **kwds)(kind, x, y)
90 return pn.panel(plot, **panel_dict)
---> 92 return self._get_converter(x, y, kind, **kwds)(kind, x, y)

File /opt/conda/lib/python3.10/site-packages/hvplot/plotting/core.py:99, in hvPlotBase._get_converter(self, x, y, kind, **kwds)
97 y = y or params.pop("y", None)
98 kind = kind or params.pop("kind", None)
---> 99 return HoloViewsConverter(self._data, x, y, kind=kind, **params)

File /opt/conda/lib/python3.10/site-packages/hvplot/converter.py:401, in HoloViewsConverter.init(self, data, x, y, kind, by, use_index, group_label, value_label, backlog, persist, use_dask, crs, fields, groupby, dynamic, grid, legend, rot, title, xlim, ylim, clim, symmetric, logx, logy, loglog, hover, subplots, label, invert, stacked, colorbar, datashade, rasterize, row, col, debug, framewise, aggregator, projection, global_extent, geo, precompute, flip_xaxis, flip_yaxis, dynspread, hover_cols, x_sampling, y_sampling, project, tools, attr_labels, coastline, tiles, sort_date, check_symmetric_max, transforms, stream, cnorm, features, rescale_discrete_levels, **kwds)
399 self.dynamic = dynamic
400 self.geo = any([geo, crs, global_extent, projection, project, coastline, features, tiles])
--> 401 self.crs = self._process_crs(data, crs) if self.geo else None
402 self.project = project
403 self.coastline = coastline

File /opt/conda/lib/python3.10/site-packages/hvplot/converter.py:662, in HoloViewsConverter._process_crs(self, data, crs)
659 _crs = getattr(data, 'attrs', {}).get(crs or 'crs', crs)
661 try:
...
--> 248 raise ImportError(f'Geographic projection support requires: {", ".join(missing)}.')
250 if crs is None:
251 return ccrs.PlateCarree()

ImportError: Geographic projection support requires: geoviews.
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant