googleapis / python-aiplatform

A Python SDK for Vertex AI, a fully managed, end-to-end platform for data science and machine learning.
Apache License 2.0
615 stars 330 forks source link

shapely version >= 2.0 not supported #2855

Closed MichaelKarpe closed 9 months ago

MichaelKarpe commented 10 months ago

Shapely >= 2.0 has been allowed following #2829 but is not supported, leading to a very similar error to #1852. Issue is solved by setting shapely < 2.0.

Environment details

Steps to reproduce

  1. pip install google-cloud-aiplatform
  2. from vertexai.language_models import TextEmbeddingModel

Code example

from vertexai.language_models import TextEmbeddingModel

Stack trace

  File "", line 2, in <module>
    from vertexai.language_models import TextEmbeddingModel
  File ".venv\lib\site-packages\vertexai\__init__.py", line 17, in <module>
    from google.cloud.aiplatform import init
  File ".venv\lib\site-packages\google\cloud\aiplatform\__init__.py", line 24, in <module>
    from google.cloud.aiplatform import initializer
  File ".venv\lib\site-packages\google\cloud\aiplatform\initializer.py", line 36, in <module>
    from google.cloud.aiplatform.metadata import metadata
  File ".venv\lib\site-packages\google\cloud\aiplatform\metadata\metadata.py", line 28, in <module>
    from google.cloud.aiplatform import pipeline_jobs
  File ".venv\lib\site-packages\google\cloud\aiplatform\pipeline_jobs.py", line 31, in <module>
    from google.cloud.aiplatform.metadata import artifact
  File ".venv\lib\site-packages\google\cloud\aiplatform\metadata\artifact.py", line 26, in <module>
    from google.cloud.aiplatform import models
  File ".venv\lib\site-packages\google\cloud\aiplatform\models.py", line 47, in <module>
    from google.cloud.aiplatform import jobs
  File ".venv\lib\site-packages\google\cloud\aiplatform\jobs.py", line 28, in <module>
    from google.cloud import bigquery
  File ".venv\lib\site-packages\google\cloud\bigquery\__init__.py", line 35, in <module>
    from google.cloud.bigquery.client import Client
  File ".venv\lib\site-packages\google\cloud\bigquery\client.py", line 74, in <module>
    from google.cloud.bigquery import _pandas_helpers
  File ".venv\lib\site-packages\google\cloud\bigquery\_pandas_helpers.py", line 56, in <module>
    _to_wkb = _to_wkb()
  File ".venv\lib\site-packages\google\cloud\bigquery\_pandas_helpers.py", line 46, in _to_wkb
    from shapely.geos import WKBWriter, lgeos  # type: ignore
ImportError: cannot import name 'WKBWriter' from 'shapely.geos' (.venv\lib\site-packages\shapely\geos.py)
nayaknishant commented 10 months ago

hi @MichaelKarpe, with https://github.com/googleapis/python-bigquery/releases/tag/v3.13.0 and https://github.com/googleapis/python-bigquery/pull/1696, Shapely >= 2.0 should be supported with the Vertex SDK.

I was able to run the following code snippet locally

! pip3 install --upgrade --force-reinstall google-cloud-aiplatform

import vertexai

from vertexai.language_models import TextEmbeddingModel

Please let us know if you still run into an error.

irfanhabib commented 8 months ago

I'm getting this exception with version 1.39.0, have to downgrade to 1.35.0 (https://github.com/googleapis/python-aiplatform/commit/e76abd3901644f99ec6850b35e155d8b2c54008a)

MichaelKarpe commented 6 months ago

@nayaknishant sorry for the very late reply, but I was actually asking to enforce the constraint due to a bug and not to relax it. Investigating further, I opened https://github.com/googleapis/python-bigquery/issues/1842 that should solve the issue if addressed.

@irfanhabib this may be of interest for you. You should be able to use the latest google-cloud-aiplatform if you specify shapely<2.0.0.