Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

bug: Missing attribute: WKTReader #1364

Closed

Description

@chalmerlowe

An issue that appears to be in this library popped up while running a test in a related bigquery library.

.nox/prerelease/lib/python3.8/site-packages/google/cloud/bigquery/table.py:46: in <module>
    _read_wkt = shapely.geos.WKTReader(shapely.geos.lgeos).read
E   AttributeError: module 'shapely.geos' has no attribute 'WKTReader'

Based on a quick review, it appears that shapely.geos no longer has a WKTReader class and it appears that the WKTReader class has been removed from the library entirely and they might be relying on a function elsewhere in the codebase. If I had to wager a guess, I might look at the from_wkt method in io.py.

Environment details

N/A

Steps to reproduce

N/A

Code example

N/A

Stack trace

nox > py.test --quiet --junitxml=prerelease_unit_3.8_sponge_log.xml tests/unit
ImportError while loading conftest '/tmpfs/src/github/python-bigquery-sqlalchemy/tests/unit/conftest.py'.
tests/unit/conftest.py:28: in <module>
    from . import fauxdbi
tests/unit/fauxdbi.py:29: in <module>
    import google.cloud.bigquery.schema
.nox/prerelease/lib/python3.8/site-packages/google/cloud/bigquery/__init__.py:35: in <module>
    from google.cloud.bigquery.client import Client
.nox/prerelease/lib/python3.8/site-packages/google/cloud/bigquery/client.py:63: in <module>
    from google.cloud.bigquery import _job_helpers
.nox/prerelease/lib/python3.8/site-packages/google/cloud/bigquery/_job_helpers.py:24: in <module>
    from google.cloud.bigquery import job
.nox/prerelease/lib/python3.8/site-packages/google/cloud/bigquery/job/__init__.py:27: in <module>
    from google.cloud.bigquery.job.copy_ import CopyJob
.nox/prerelease/lib/python3.8/site-packages/google/cloud/bigquery/job/copy_.py:21: in <module>
    from google.cloud.bigquery.table import TableReference
.nox/prerelease/lib/python3.8/site-packages/google/cloud/bigquery/table.py:46: in <module>
    _read_wkt = shapely.geos.WKTReader(shapely.geos.lgeos).read
E   AttributeError: module 'shapely.geos' has no attribute 'WKTReader'

Activity

  1. added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Sep 23, 2022
  2. self-assigned this
    on Oct 3, 2022
  3. tparkerNYT commented on Nov 14, 2023

    @tparkerNYT

    I am still experiencing this issue with from google.cloud import aiplatform and from vertexai import preview. I am using the latest version of shapely.

  4. tomaxberg commented on Nov 16, 2023

    @tomaxberg

    Try reinstall packages bs4, docarray, tiktoken, and streamlit. This worked for me.

  5. chalmerlowe commented on Nov 17, 2023

    @chalmerlowe
    CollaboratorAuthor

    @tparkerNYT

    In looking at your tracebacks, they show line 46 in the file google/cloud/bigquery/table.py as:

    _read_wkt = shapely.geos.WKTReader(shapely.geos.lgeos).read

    Starting in version 3.3.6 of python-bigquery, code was inserted that began to refer to objects in shapely by their current nomenclature instead of referencing WKTReader.

    If you upgrade your version of python-bigquery, it should fix this issue.

    Gonna leave this issue closed and close out the related one in the pubsub library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the googleapis/python-bigquery API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions