The Oracle
The Oracle

Reputation: 488

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

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.

Upvotes: 18

Views: 19598

Answers (2)

Joshua Viggiani
Joshua Viggiani

Reputation: 23

The above didn't work for me. I ran the below command instead and it worked:

pip install descarteslabs[complete]

Add --user on the end if you encounter any permissions errors

Upvotes: 0

BramAppel
BramAppel

Reputation: 1366

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.

Upvotes: 25

Related Questions