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

Geopandas import error #485

Closed
KarenChen9999 opened this issue Feb 15, 2021 · 3 comments
Closed

Geopandas import error #485

KarenChen9999 opened this issue Feb 15, 2021 · 3 comments

Comments

@KarenChen9999
Copy link

KarenChen9999 commented Feb 15, 2021

I used the geograpic data example and installation guide from hvplot (https://hvplot.holoviz.org/user_guide/Geographic_Data.html). I ran into an import error when calling

cities.hvplot(global_extent=True, frame_height=450, tiles=True)

The error I got:

/apps/opt/anaconda3/envs/geo_env/lib/python3.8/site-packages/hvplot/util.py in process_crs(crs)
    182         import pyproj
    183     except:
--> 184         raise ImportError('Geographic projection support requires GeoViews and cartopy.')
    185 
    186     if crs is None:

ImportError: Geographic projection support requires GeoViews and cartopy.

My geopandas version is 0.8.2. Is it not the comparable version? If so, how can i know which version of geopandas i should be use?

@jbednar
Copy link
Member

jbednar commented Feb 15, 2021

This message is not about geopandas but about other libraries. Following #299, can you try installing pyproj and see if that fixes it?

@KarenChen9999
Copy link
Author

KarenChen9999 commented Feb 16, 2021

I reinstall all the packages using:
conda install -c pyviz geoviews hvplot pyproj geopandas pandas rasterio shapely fiona

so pyproj is also installed, when i run the code again

import geopandas as gpd
cities = gpd.read_file(gpd.datasets.get_path('naturalearth_cities'))
cities.hvplot(global_extent=True, frame_height=450, tiles=True)
 ---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-ea06750636a3> in <module>
      3 cities = gpd.read_file(gpd.datasets.get_path('naturalearth_cities'))
      4 
----> 5 cities.hvplot(global_extent=True, frame_height=450, tiles=True)

/apps/opt/anaconda3/envs/geo_env/lib/python3.7/site-packages/pandas/core/generic.py in __getattr__(self, name)
   5460             if self._info_axis._can_hold_identifiers_and_holds_name(name):
   5461                 return self[name]
-> 5462             return object.__getattribute__(self, name)
   5463 
   5464     def __setattr__(self, name: str, value) -> None:

AttributeError: 'GeoDataFrame' object has no attribute 'hvplot'

is this the issue with geopandas or hvplot?

My package versions:
holoviews 1.14.1 py_0 pyviz
hvplot 0.7.0 py_0 pyviz
geopandas 0.8.1 py_0

@jbednar
Copy link
Member

jbednar commented Feb 17, 2021

It looks like you haven't done import hvplot.pandas, which is needed for .hvplot() to be available for Pandas and GeoPandas dataframes.

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

3 participants