question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

QST: KeyError: 'MISSING'?

See original GitHub issue

Hello, I installed and used geopandas many time in my laptop, I’ve an error now KeyError: 'MISSING' when I tried to import it. This happened when I removed one of my virtualenv which was not the handler of gpp. All dependencies are installed and I re-installed geopandas also but this doesn’t fixe my error. What this error mean?

import pandas as pd
import geopandas as gpd
import libpysal as lp
import matplotlib.pyplot as plt
import rasterio as rio
import numpy as np
import contextily as ctx
import shapely.geometry as geom


---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-1-1aa75faa3f6b> in <module>
----> 1 import geopandas as gpd
      2 import pandas as pd
      3 import matplotlib.pyplot as plt
      4 from shapely.geometry import Point

/Library/Frameworks/Python.framework/Versions/3.8/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.array import points_from_xy  # noqa

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/geopandas/geoseries.py in <module>
     10 from shapely.geometry.base import BaseGeometry
     11 
---> 12 from geopandas.base import GeoPandasBase, _delegate_property
     13 from geopandas.plotting import plot_series
     14 

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/geopandas/base.py in <module>
     11 import geopandas as gpd
     12 
---> 13 from .array import GeometryArray, GeometryDtype
     14 from .sindex import get_sindex_class, has_sindex
     15 

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/geopandas/array.py in <module>
     23 
     24 from . import _compat as compat
---> 25 from . import _vectorized as vectorized
     26 
     27 

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/geopandas/_vectorized.py in <module>
     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)

/Library/Frameworks/Python.framework/Versions/3.8/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'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
martinfleiscommented, Mar 2, 2021

Hi, this is caused by incompatibility between geopandas <0.8.2 and pygeos 0.9. If you can update to 0.8.2 or ideally 0.9.0 version of GeoPandas, the issue should be resolved.

0reactions
procyonluncommented, Oct 19, 2022

geopanda

@procyonlun it is unlikely then that you are running geopandas in the environment you have shown the pip list for. It would help if from the script you are seeing the error from, add the following lines and show the results:

import geopandas
print(geopandas.show_versions())

thx ,I reinstalled geopandas and the problem was solved. Really thx

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to solve the problem KeyError: "['Label'] not found in axis ...
I am working on network traffic classification using tf.keras. i want to drop a column name Label and set Label as Y and...
Read more >
How to I get the missing key from a KeyError in Python?
I want to access that "A" that is missing, but it does not seem to be an attribute of the KeyError object. Any...
Read more >
Python KeyError: A Beginner's Guide % - Career Karma
A Python KeyError occurs when you attempt to access an item in a dictionary that does not exist using the indexing syntax. This...
Read more >
column not found in axis | The Search Engine You Control
I want to drop one column "image" but I keep getting KeyError 'image' not found in axis. Code used for dropping column: monarchs_df...
Read more >
[Example code]-Python, find all missing fields in a dictionary
Coding example for the question Python, find all missing fields in a dictionary. ... return True except KeyError as err: log.error(f'{err}') return False....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found