googleads / google-ads-python

Google Ads API Client Library for Python
Apache License 2.0
515 stars 480 forks source link

ModuleImportError from upgrading from 22.1.0 to 25.0.0 (previous version had error handling since removed) #887

Open alasdair-fowler-deliveroo opened 3 weeks ago

alasdair-fowler-deliveroo commented 3 weeks ago

Describe the bug: Since upgrading library version (22.1.0 to 25.0.0) we get a ModuleNotFoundError in AWS once google-ads is deployed, but not locally. We didn't make any code changes and our code used to work, and works with the same library version locally.

I think it may be that this change was made here in PR 830 (see below). Why was that error handling there, and why was it removed? Can it be re-added?

Old:

try:
    _CLIENT_INFO = ClientInfo(
        client_library_version=pkg_resources.get_distribution(
            "google-ads",
        ).version,
    )
except pkg_resources.DistributionNotFound:
    _CLIENT_INFO = ClientInfo()

New:

_CLIENT_INFO = ClientInfo(client_library_version=metadata.version("google-ads"))

Steps to Reproduce: In unknown circumstances, from google.ads.googleads import client causes a ModuleNotFoundError

Expected behavior: from google.ads.googleads import client works!

Client library version and API version: Client library version: 25.0.0 Google Ads API version: 17

asn1crypto==1.5.1
attrs==24.2.0
autocommand==2.2.2
backports.tarfile==1.2.0
bcrypt==4.0.1
boto3==1.35.27
botocore==1.35.27
cachetools==5.5.0
certifi==2024.8.30
cffi==1.17.1
charset-normalizer==3.3.2
cryptography==40.0.2
filelock==3.16.1
google-ads==25.0.0
google-api-core==2.20.0
google-api-python-client==2.97.0
google-auth==2.35.0
google-auth-httplib2==0.2.0
google-auth-oauthlib==1.2.1
googleapis-common-protos==1.65.0
grpcio==1.66.1
grpcio-status==1.62.3
gspread==5.4.0
httplib2==0.22.0
idna==3.10
importlib_metadata==8.5.0
inflect==7.4.0
iniconfig==2.0.0
jaraco.context==6.0.1
jaraco.functools==4.0.2
jaraco.text==3.14.0
Jinja2==3.1.2
jmespath==1.0.1
MarkupSafe==2.1.5
more-itertools==10.5.0
numpy==1.22.0
oauth2client==4.1.3
oauthlib==3.2.2
oscrypto==1.3.0
packaging==24.1
pandas==1.4.2
paramiko==3.0.0
Pillow==10.0.0
platformdirs==4.2.2
pluggy==0.13.1
proto-plus==1.24.0
protobuf==5.28.2
py==1.11.0
pyasn1==0.6.1
pyasn1_modules==0.4.1
pybutton==3.0.0
pycparser==2.22
pycryptodomex==3.20.0
pydash==4.8.0
PyJWT==2.9.0
PyNaCl==1.5.0
pyOpenSSL==23.2.0
pyparsing==3.1.4
pytest==6.0.1
python-dateutil==2.9.0.post0
python-dotenv==0.14.0
pytz==2024.2
PyYAML==6.0.2
requests==2.32.3
requests-oauthlib==2.0.0
roo-aws-secrets==1.2.2
rsa==4.9
s3transfer==0.10.2
six==1.16.0
snowflake-connector-python==3.0.1
tenacity==8.2.2
toml==0.10.2
typeguard==4.3.0
typing_extensions==4.12.2
uritemplate==4.1.1
urllib3==2.2.3
zipp==3.20.2

Request/Response Logs: N/A

Anything else we should know about your project / environment:

corlord commented 5 days ago

Bumping this. I am hitting this same behavior. Same error on AWS only when upgrading to google-ads > 23.0.0, local is fine.