Thomas
Thomas

Reputation: 85

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

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]

Upvotes: 3

Views: 1828

Answers (2)

MERose
MERose

Reputation: 4421

As https://github.com/SciTools/cartopy/issues/2006 describes, this issues is only with shapely 1.8.1 (and 1.8.1.post1) when installed with wheels (the standard behavior of pip).

Install via pip install --upgrade --no-binary shapely shapely as greglucas explains in the issue.

Upvotes: 2

Giuliana Berden
Giuliana Berden

Reputation: 21

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

Upvotes: 2

Related Questions