googleapis / google-api-python-client

🐍 The official Python client library for Google's discovery based APIs.
https://googleapis.github.io/google-api-python-client/docs/
Apache License 2.0
7.77k stars 2.41k forks source link

Package writes to "apiclient" directory when installed #2485

Open kruton opened 1 month ago

kruton commented 1 month ago

Environment details

Steps to reproduce

  1. python -m virtualenv venv
  2. . venv/bin/activate
  3. pip install api-client
  4. python -c 'from apiclient import HeaderAuthentication'
  5. pip install firebase-admin
  6. python -c 'from apiclient import HeaderAuthentication'

I expect step 6 to be the same as step 4 here, but it results in a stack trace since firebase-admin depends on google-api-python-client which is overwriting .../site-packages/apiclient/. What's even worse is that some package managers (e.g., poetry) seem to install this in a random order resulting in it sometimes working and sometimes not.

Code example

from apiclient import HeaderAuthentication

Stack trace

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: cannot import name 'HeaderAuthentication' from 'apiclient' (/private/tmp/test1/venv/lib/python3.11/site-packages/apiclient/__init__.py)
ohmayr commented 1 month ago

Thanks for reporting this @kruton. We'll take a look into this.