kms
kms

Reputation: 2024

Recently occurring geopandas import error

I have been using geopandas for a while now and have never seen this error. Since last few weeks, I am noticing a geopandas import error. Did anything change recently with the package? What does keyerror MISSING mean?

Package details:

Name: geopandas
Version: 0.9.0
Summary: Geographic pandas extensions
Home-page: http://geopandas.org
Author: GeoPandas contributors
Author-email: [email protected]
License: BSD


Name: pygeos
Version: 0.9
Summary: GEOS wrapped in numpy ufuncs
Home-page: https://github.com/pygeos/pygeos
Author: Casper van der Wel
Author-email: [email protected]
License: BSD 3-Clause


Traceback (most recent call last)

KeyError
<ipython-input-4-6f0517744ee1> in <module>
     38 #import gdal as gdal
     39 #from osgeo import ogr
---> 40 import geopandas as gpd
     41 from shapely.geometry import Point
     42 from shapely.geometry import Polygon

~/opt/anaconda3/lib/python3.8/site-packages/geopandas/__init__.py in <module>
      1 from geopandas._config import options  # noqa
      2 
----> 3 from geopandas.geoseries import GeoSeries  # noqa
      4 from geopandas.geodataframe import GeoDataFrame  # noqa
      5 from geopandas.a
~/opt/anaconda3/lib/python3.8/site-packages/geopandas/_vectorized.py in <module>
 
~/opt/anaconda3/lib/python3.8/site-packages/geopandas/_vectorized.py in <dictcomp>(.0)
     37 
     38 if compat.USE_PYGEOS:
---> 39     type_mapping = {p.value: _names[p.name] for p in pygeos.GeometryType}
     40     geometry_type_ids = list(type_mapping.keys())
     41     geometry_type_values = np.array(list(type_mapping.values()), dtype=object)

KeyError: 'MISSING'

Upvotes: 1

Views: 1706

Answers (1)

martinfleis
martinfleis

Reputation: 7814

This is a compatibility issue with older GeoPandas (0.8.1 and older) and newer pygeos (0.9). Make sure you use both packages in their latest versions (0.9.0 for both at this moment).

Upvotes: 1

Related Questions