Geopandas ImportError: The descartes package is required for plotting polygons in geopandas

The Oracle picture The Oracle · Oct 16, 2019 · Viewed 12k times · Source

I'am trying to run a simple geopandas code using ANACONDA spyder. However, I'am encountering an error.

I have included the code and the error as below:

--

here is the code:

import geopandas as gpd
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
world.plot()
import matplotlib.pyplot as plt
plt.show()

--

here is the error:

File "C:\Users\usr\Anaconda3\lib\site-packages\geopandas\plotting.py", line 90, in plot_polygon_collection "The descartes package is required for plotting polygons in geopandas."

ImportError: The descartes package is required for plotting polygons in geopandas.

--

I checked online and I couldn't find troubleshooting solution for this problem. Can anyone please help and advise?

appreciated.

Answer

BramAppel picture BramAppel · Oct 16, 2019

Depending on your package manager install descartes. In anaconda prompt do the following:

conda install descartes

Replace conda with pip or an other package manager of your use.