cannot import name 'WKBWriter' from 'shapely.geos' when import google cloud ai platform

Question:

When I run this code on google colab.

from google.cloud import aiplatform

The following error occurred

ImportError: cannot import name 'WKBWriter' from 'shapely.geos' (/usr/local/lib/python3.8/dist-packages/shapely/geos.py)

Does anyone know how to solve this problem?

I was working fine on 2022/12/16, but today it is not working.

Asked By: 47jeff

||

Answers:

Running into a similiar issue. So far, I am able to tell that google.cloud actions will not run if I have shapley files installed. When I delete the shapley files on my computer I am able to run google.cloud methods

Answered By: Tyler

The bug is tracked in: https://github.com/googleapis/python-aiplatform/issues/1852

The workaround is to pin shapely < 2.0.0

pip install -U google-cloud-aiplatform "shapely<2"
Answered By: tskuzzy