googleapis/python-api-common-protos

AttributeError: 'NoneType' object has no attribute 'message_types_by_name'

ross opened this issue · 4 comments

ross commented

Seeing the following with 1.55.1b1, which does not appear to happen with 1.55.0.

_________ ERROR collecting tests/test_octodns_provider_googlecloud.py __________
tests/test_octodns_provider_googlecloud.py:12: in <module>
    from octodns_googlecloud import GoogleCloudProvider
/tmp/ci-RvdXdu3JOD/lib/python3.10/site-packages/octodns_googlecloud-0.0.1-py3.10.egg/octodns_googlecloud/__init__.py:11: in <module>
    ???
/tmp/ci-RvdXdu3JOD/lib/python3.10/site-packages/google_cloud_dns-0.34.0-py3.10.egg/google/cloud/dns/__init__.py:32: in <module>
    from google.cloud.dns.zone import Changes
/tmp/ci-RvdXdu3JOD/lib/python3.10/site-packages/google_cloud_dns-0.34.0-py3.10.egg/google/cloud/dns/zone.py:19: in <module>
    from google.cloud.exceptions import NotFound
/tmp/ci-RvdXdu3JOD/lib/python3.10/site-packages/google_cloud_core-2.2.3-py3.10.egg/google/cloud/exceptions/__init__.py:24: in <module>
    from google.api_core import exceptions
/tmp/ci-RvdXdu3JOD/lib/python3.10/site-packages/google_api_core-2.7.1-py3.10.egg/google/api_core/exceptions.py:28: in <module>
    from google.rpc import error_details_pb2
/tmp/ci-RvdXdu3JOD/lib/python3.10/site-packages/googleapis_common_protos-1.55.1b1-py3.10.egg/google/rpc/error_details_pb2.py:39: in <module>
    _RETRYINFO = DESCRIPTOR.message_types_by_name["RetryInfo"]
E   AttributeError: 'NoneType' object has no attribute 'message_types_by_name'

I was updating dependencies for the googlecloud octoDNS provider, the PR updates to 1.55.0, but the tests also run against a venv installed version with the latest versions of all dependencies. It's the latter of those two cases that picks up 1.55.1b1 and fails.
PR: octodns/octodns-googlecloud#5
Failing Test: https://github.com/octodns/octodns-googlecloud/runs/5499296341?check_suite_focus=true

Environment details

  • Programming language: Python
  • OS: Linux/OSX
  • Language runtime version: 3.x
  • Package version: 1.55.1b1 (1.55.0 does not exhibit the issue)

Steps to reproduce

This is not the normal octoDNS workflow, but it's the most direct way to the problem.

  1. git clone https://github.com/octodns/octodns-googlecloud
  2. cd octodns-googlecloud
  3. python3 -m venv env
  4. source env/bin/activate
  5. python setup.py install
  6. pip install pytest
  7. pytest

If you edit setup.py, add 'googleapis-common-protos==1.55.0' to install_requires, blow away the venv, and repeat steps 3-7 things work.

I've tried digging into what changed, but thus far haven't had any luck.

/cc octodns/octodns-googlecloud#5

I've marked this bug as P1 while we investigate if we need to yank the pre-release version

Hi @ross,

Thanks for reporting this issue. I'm able to re-produce this issue with commit 6260547 in main and I'm looking into a fix.

Hello @ross,

TLDR; for pre-release testing, please use the latest pre-release version which is not yanked (i.e. protobuf==3.20.0rc2 instead of protobuf==4.0.0rc2 which is yanked)

After help from colleagues in #94, I was able to get a better understanding of the issue. The problem occurs with protobuf<15 . In the case of this issue, I found that version 4.0.0rc2 was used in the build log here. This pre-release version was yanked from PyPI and is not recommended for use. The latest pre-release which is not yanked is protobuf-3.20.0rc2. I wasn't able to re-create the issue with protobuf-3.20.0rc2.

I'll keep this issue open until we update the requirements to protobuf>=3.15.0

ross commented

Thanks @parthea, I verified that what's currently available in pypi works in octodns/octodns-googlecloud#6 so the pinning has been removed in that module. 👍