Closed virgilxw closed 1 year ago
Can you show the output of geopandas.show_versions()
? This should not have happened.
SYSTEM INFO
-----------
python : 3.10.8 | packaged by conda-forge | (main, Nov 22 2022, 08:26:04) [GCC 10.4.0]
executable : /home/virgilxw/miniconda3/envs/testbed/bin/python
machine : Linux-5.15.79.1-microsoft-standard-WSL2-x86_64-with-glibc2.35
GEOS, GDAL, PROJ INFO
---------------------
GEOS : 3.11.1
GEOS lib : None
GDAL : 3.6.2
GDAL data dir: /home/virgilxw/miniconda3/envs/testbed/share/gdal
PROJ : 9.1.0
PROJ data dir: /home/virgilxw/miniconda3/envs/testbed/share/proj
PYTHON DEPENDENCIES
-------------------
geopandas : 0.12.2
numpy : 1.23.5
pandas : 1.5.2
pyproj : 3.4.1
shapely : 2.0.0
fiona : 1.8.22
geoalchemy2: None
geopy : None
matplotlib : 3.6.2
mapclassify: 2.4.3
pygeos : 0.14
pyogrio : None
psycopg2 : None
pyarrow : None
rtree : 1.0.1
Error message as follows:
AttributeError Traceback (most recent call last)
Cell In[12], line 5
1 buildings = gpd.read_file(momepy.datasets.get_path('bubenec'),
2 layer='buildings')
4 f, ax = plt.subplots(figsize=(10, 10))
----> 5 buildings.plot(ax=ax)
6 ax.set_axis_off()
7 plt.show()
File ~/miniconda3/envs/testbed/lib/python3.10/site-packages/geopandas/plotting.py:925, in GeoplotAccessor.__call__(self, *args, **kwargs)
923 kind = kwargs.pop("kind", "geo")
924 if kind == "geo":
--> 925 return plot_dataframe(data, *args, **kwargs)
926 if kind in self._pandas_kinds:
927 # Access pandas plots
928 return PlotAccessor(data)(kind=kind, **kwargs)
File ~/miniconda3/envs/testbed/lib/python3.10/site-packages/geopandas/plotting.py:689, in plot_dataframe(df, column, cmap, color, ax, cax, categorical, legend, scheme, k, vmin, vmax, markersize, figsize, legend_kwds, categories, classification_kwds, missing_kwds, aspect, **style_kwds)
686 markersize = df[markersize].values
688 if column is None:
--> 689 return plot_series(
690 df.geometry,
691 cmap=cmap,
692 color=color,
...
---> 67 geom = shapely.geos.lgeos.GEOSGeom_clone(geom._ptr)
68 return shapely.geometry.base.geom_factory(geom)
70 # fallback going through WKB
AttributeError: module 'shapely.geos' has no attribute 'lgeos'
No matter what I try, I am unable to reproduce the error. The issue is that you should never reach line 67 calling lgeos
with shapely 2.
Have you done anything else to your environment apart from the code above? Like setting USE_PYGEOS
env variable or changing gpd.options.use_pygeos
at some point? I tried changing some of these manually but the code still works as intended so I am out of ideas how could you get there.
It may help to see the output of conda list and the full traceback. The one above is truncated.
cc @jorisvandenbossche
Could you also check what you get from import geopandas._compat; print(geopandas._compat.SHAPELY_GE_20)
?
I reinstalled pandas to fix it
I reinstalled pandas to fix it
Let's close this as an installation issue then. Thanks for reporting back!
Describe the problem
As per my stackoverflow post, the first example in the user guide doesn't work because shapely has depreciated lgeos
Steps to reproduce
Versions of your packages
Your operating system
No response
Additional context
No response