Cartopy issue with extent (free(): invalid size)

Viewed 270

I'm using Cartopy and I struggle with this issue free(): invalid size. It occurs when I set the map extent.

extents = [-13, 44, 34, 63] # Europe
proj = cartopy.crs.PlateCarree(central_longitude=(extents[1]-extents[0])/2)
ax = fig.add_subplot(
    nrows,
    ncols,
    index,
    projection=proj,
)
ax.set_extent(extents=extents, crs=proj)

I tried several functions as pyplot.subplot or pyplot.axes but none seem to help.

Can you explain to me what is this error and how to solve it ?

Edit:

Here you can find the package list I'm using:

Cartopy==0.20.2
  - matplotlib [required: >=3.1, installed: 3.5.1]
    - cycler [required: >=0.10, installed: 0.11.0]
    - fonttools [required: >=4.22.0, installed: 4.29.1]
    - kiwisolver [required: >=1.0.1, installed: 1.3.2]
    - numpy [required: >=1.17, installed: 1.21.5]
    - packaging [required: >=20.0, installed: 21.3]
      - pyparsing [required: >=2.0.2,!=3.0.5, installed: 3.0.7]
    - pillow [required: >=6.2.0, installed: 9.0.1]
    - pyparsing [required: >=2.2.1, installed: 3.0.7]
    - python-dateutil [required: >=2.7, installed: 2.8.2]
      - six [required: >=1.5, installed: 1.16.0]
  - numpy [required: >=1.18, installed: 1.21.5]
  - pyproj [required: >=3.0.0, installed: 3.3.0]
    - certifi [required: Any, installed: 2021.10.8]
  - pyshp [required: >=2.1, installed: 2.2.0]
  - shapely [required: >=1.6.4, installed: 1.8.1.post1]

Solution:

The library shapely seems to be the issue. I solved the issue by uninstalling it and reinstall it:

pip uninstall shapely
pip install --no-binary :all: shapely
1 Answers

I had the same problem. Changing the version of shapely from 1.8.1.post1 to 1.7.1 solved the problem

Related