question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

import error with shapely.geos

See original GitHub issue

during the import the aiplatform, I get the following error.

from google.cloud import aiplatform
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/vignesh/miniconda3/envs/the_new_age/lib/python3.10/site-packages/google/cloud/aiplatform/__init__.py", line 24, in <module>
    from google.cloud.aiplatform import initializer
  File "/home/vignesh/miniconda3/envs/the_new_age/lib/python3.10/site-packages/google/cloud/aiplatform/initializer.py", line 34, in <module>
    from google.cloud.aiplatform.metadata import metadata
  File "/home/vignesh/miniconda3/envs/the_new_age/lib/python3.10/site-packages/google/cloud/aiplatform/metadata/metadata.py", line 25, in <module>
    from google.cloud.aiplatform import pipeline_jobs
  File "/home/vignesh/miniconda3/envs/the_new_age/lib/python3.10/site-packages/google/cloud/aiplatform/pipeline_jobs.py", line 31, in <module>
    from google.cloud.aiplatform.metadata import artifact
  File "/home/vignesh/miniconda3/envs/the_new_age/lib/python3.10/site-packages/google/cloud/aiplatform/metadata/artifact.py", line 25, in <module>
    from google.cloud.aiplatform import models
  File "/home/vignesh/miniconda3/envs/the_new_age/lib/python3.10/site-packages/google/cloud/aiplatform/models.py", line 46, in <module>
    from google.cloud.aiplatform import jobs
  File "/home/vignesh/miniconda3/envs/the_new_age/lib/python3.10/site-packages/google/cloud/aiplatform/jobs.py", line 26, in <module>
    from google.cloud import bigquery
  File "/home/vignesh/miniconda3/envs/the_new_age/lib/python3.10/site-packages/google/cloud/bigquery/__init__.py", line 35, in <module>
    from google.cloud.bigquery.client import Client
  File "/home/vignesh/miniconda3/envs/the_new_age/lib/python3.10/site-packages/google/cloud/bigquery/client.py", line 75, in <module>
    from google.cloud.bigquery.dataset import Dataset
  File "/home/vignesh/miniconda3/envs/the_new_age/lib/python3.10/site-packages/google/cloud/bigquery/dataset.py", line 25, in <module>
    from google.cloud.bigquery.routine import RoutineReference
  File "/home/vignesh/miniconda3/envs/the_new_age/lib/python3.10/site-packages/google/cloud/bigquery/routine/__init__.py", line 18, in <module>
    from google.cloud.bigquery.enums import DeterminismLevel
  File "/home/vignesh/miniconda3/envs/the_new_age/lib/python3.10/site-packages/google/cloud/bigquery/enums.py", line 21, in <module>
    from google.cloud.bigquery.query import ScalarQueryParameterType
  File "/home/vignesh/miniconda3/envs/the_new_age/lib/python3.10/site-packages/google/cloud/bigquery/query.py", line 23, in <module>
    from google.cloud.bigquery.table import _parse_schema_resource
  File "/home/vignesh/miniconda3/envs/the_new_age/lib/python3.10/site-packages/google/cloud/bigquery/table.py", line 44, in <module>
    _read_wkt = shapely.geos.WKTReader(shapely.geos.lgeos).read
AttributeError: module 'shapely.geos' has no attribute 'WKTReader'

google-cloud-aiplatform version 1.19.1

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
nayaknishantcommented, Dec 19, 2022

https://github.com/googleapis/python-aiplatform/commit/1efd81666ac63e1704322ad5771b3208a35bc479 has been pushed out. We are pinning shapely < 2.0.0 to fix this error. Thanks for all the feedback and contribution!

1reaction
davidcavazoscommented, Dec 15, 2022

Same happens with google-cloud-aiplatform==1.20.0. The issue is that shapely just released version 2.0.0 on Dec 12, and it’s apparently not compatible with either aiplatform or bigquery.

Steps to reproduce

In a clean virtual environment.

# Edit: must install shapely as well
pip install -U google-cloud-aiplatform shapely

In a Python script:

from google.cloud import aiplatform

Workaround

Pinning to the shapely latest version <2.0 as a constraint seems to fix it.

pip install -U google-cloud-aiplatform "shapely<2"
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error importing Polygon from shapely.geometry.polygon
If I type from shapely.geometry import Polygon in Eclipse, then I click on Polygon , then I press F3 , Eclipse is able...
Read more >
Shapely command error: from shapely.geometry import ...
Shapely is your interface to GEOS. I'd start troubleshooting by trying to reinstall geopandas via conda so it checks that your dependencies ...
Read more >
API: custom classes for GEOS exceptions · Issue #991
... Shapely has a few custom error classes, such as TopologicalError. Using an example from the tests: from shapely.geometry import Polygon ...
Read more >
Shapely
Shapely wraps GEOS geometries and operations to provide both a feature rich ... import shapely >>> import numpy as np >>> geoms =...
Read more >
[python] Shapely doesn't work correctly - General
... interpreter I get this errors: >>> from shapely. geometry import ... /shapely/coords.py", line 10, in <module> from shapely.geos import ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found