iterative / PyDrive2

Google Drive API Python wrapper library. Maintained fork of PyDrive.
https://docs.iterative.ai/PyDrive2
Other
585 stars 69 forks source link

Cannot import name 'build' from 'googleapiclient.discovery' #71

Closed MarlNox closed 3 years ago

MarlNox commented 3 years ago

Hi there, I have building a django app that uses pydrive2. When running it in my local machine, it works. While when i try to run it on my Azure VM, it doesnt work, and gives out this error message:

File "step_1.py", line 16, in from pydrive2.auth import GoogleAuth File "/home/user/.local/lib/python3.8/site-packages/pydrive2/auth.py", line 8, in from googleapiclient.discovery import build ImportError: cannot import name 'build' from 'googleapiclient.discovery' (/home/user/.local/lib/python3.8/site-packages/googleapiclient/discovery.py)

shcheklein commented 3 years ago

@MarlNox could you run pip freeze on both machines please? To see that we have all the dependencies installed properly. Also, is there a log of the pip install command? That would be helpful.

MarlNox commented 3 years ago

While i dont have a log of the pip install command; Here are the packages from the VM that doesn't work:

aiohttp==3.7.3 amqp==2.6.1 anyjson==0.3.3 asgiref==3.3.1 async-timeout==3.0.1 attrs==20.3.0 Automat==20.2.0 beautifulsoup4==4.9.3 billiard==3.6.3.0 blinker==1.4 cachetools==4.1.1 celery==4.4.7 celery-progress==0.0.14 certifi==2020.12.5 cffi==1.14.4 chardet==3.0.4 click==7.1.2 click-didyoumean==0.0.3 click-plugins==1.1.1 click-repl==0.1.6 cloud-init==20.3 colorama==0.4.4 command-not-found==0.3 configobj==5.0.6 constantly==15.1.0 cryptography==3.2.1 dbus-python==1.2.16 distro==1.5.0 distro-info==0.0.0 dj-database-url==0.5.0 Django==3.1.4 django-celery==3.3.1 django-celery-results==2.0.0 django-heroku==0.3.1 djangorestframework==3.12.2 entrypoints==0.3 fasteners==0.15 filelock==3.0.12 gdown==3.12.2 google-api-core==1.23.0 google-api-python-client==1.12.8 google-auth==1.23.0 google-auth-httplib2==0.0.4 google-auth-oauthlib==0.4.2 google-trans-new==1.1.9 googleapis-common-protos==1.52.0 googletrans==3.0.0 gpg===1.13.1-unknown gunicorn==20.0.4 h11==0.11.0 h2==4.0.0 hpack==4.0.0 hstspreload==2020.11.21 html5lib==1.1 httpcore==0.12.2 httplib2==0.18.1 httpx==0.16.1 hyperframe==6.0.0 hyperlink==20.0.1 idna==2.10 importlib-metadata==3.1.1 incremental==17.5.0 jeepney==0.6.0 Jinja2==2.11.2 jsonpatch==1.28 jsonpointer==2.0 jsonschema==3.2.0 keyring==21.5.0 kombu==4.6.11 language-selector==0.1 launchpadlib==1.10.13 lazr.restfulclient==0.14.3 lazr.uri==1.0.5 linecache2==1.0.0 MarkupSafe==1.1.1 monotonic==1.5 more-itertools==8.6.0 multidict==5.1.0 netifaces==0.10.9 numpy==1.19.4 oauth2client==4.1.3 oauthlib==3.1.0 pandas==1.1.5 pbr==5.4.5 pexpect==4.8.0 Pillow==8.0.1 prompt-toolkit==3.0.8 protobuf==3.14.0 psycopg2==2.8.6 psycopg2-binary==2.8.6 ptyprocess==0.6.0 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycparser==2.20 pycrypto==2.6.1 PyDrive2==1.6.0 Pygments==2.7.3 PyGObject==3.36.0 PyHamcrest==2.0.2 PyJWT==1.7.1 pyOpenSSL==20.0.0 pyrsistent==0.17.3 pyserial==3.5 PySocks==1.7.1 python-apt==2.0.0+ubuntu0.20.4.1 python-dateutil==2.8.1 python-debian==0.1.38 pytz==2020.4 PyYAML==5.3.1 redis==3.5.3 requests==2.25.0 requests-oauthlib==1.3.0 requests-unixsocket==0.2.0 rfc3986==1.4.0 rsa==4.6 SecretStorage==3.3.0 selenium==3.141.0 service-identity==18.1.0 simplejson==3.17.2 six==1.12.0 sniffio==1.2.0 sos==4.0 soupsieve==2.0.1 SQLAlchemy==1.3.20 sqlparse==0.4.1 ssh-import-id==5.11 systemd-python==234 tesserocr==2.5.1 testresources==2.0.0 tqdm==4.54.1 traceback2==1.4.0 Twisted==20.3.0 typing-extensions==3.7.4.3 ubuntu-advantage-tools==20.3 ufw==0.36 unattended-upgrades==0.1 unittest2==1.1.0 uritemplate==3.0.1 urllib3==1.26.2 vine==1.3.0 wadllib==1.3.4 WALinuxAgent==2.2.46 wcwidth==0.2.5 webencodings==0.5.1 whitenoise==5.2.0 yarl==1.6.3 zipp==3.4.0 zope.interface==5.2.0

And here are the packages from my local Ubuntu machine:

absl-py==0.10.0 addict==2.3.0 aiohttp==3.6.2 amqp==2.6.1 apturl==0.5.2 argcomplete==1.10.0 argon2-cffi==20.1.0 asgiref==3.3.1 astunparse==1.6.3 async-generator==1.10 async-timeout==3.0.1 attrs==20.2.0 audioread==2.1.9 autocorrect==2.2.2 backcall==0.2.0 bcrypt==3.1.7 beautifulsoup4==4.8.0 bert-extractive-summarizer==0.5.1 billiard==3.6.3.0 bleach==3.2.1 blinker==1.4 blis==0.4.1 boto3==1.16.25 botocore==1.19.25 Brlapi==0.7.0 cachelib==0.1.1 cachetools==4.1.1 catalogue==1.0.0 celery==4.4.7 celery-progress==0.0.14 certifi==2020.6.20 cffi==1.14.3 chardet==3.0.4 click==7.1.2 click-didyoumean==0.0.3 click-repl==0.1.6 colorama==0.4.3 colorlog==4.4.0 colormap==1.0.3 command-not-found==0.3 configparser==5.0.1 cryptography==2.8 cupshelpers==1.0 cycler==0.10.0 cymem==2.0.4 dataclasses==0.6 dbus-python==1.2.16 decorator==4.4.2 defer==1.0.6 defusedxml==0.6.0 distro==1.4.0 distro-info===0.23ubuntu1 dj-database-url==0.5.0 Django==3.1.3 django-celery-results==1.2.1 djangorestframework==3.12.2 dlib==19.21.0 docx2txt==0.8 duplicity==0.8.12.0 easydev==0.9.38 EbookLib==0.17.1 entrypoints==0.3 extract-msg==0.23.1 fasteners==0.14.1 filelock==3.0.12 Flask==1.1.2 Flask-Dropzone==1.5.4 Flask-Reuploaded==0.3.2 Flask-Uploads==0.2.1 future==0.18.2 gast==0.3.3 gensim==3.8.3 google-api-core==1.22.2 google-api-python-client==1.12.6 google-auth==1.22.0 google-auth-httplib2==0.0.4 google-auth-oauthlib==0.4.1 google-pasta==0.2.0 google-trans-new==1.1.3 googleapis-common-protos==1.52.0 googletrans==3.0.0 grpcio==1.32.0 gunicorn==20.0.4 h11==0.9.0 h2==3.2.0 h5py==2.10.0 hpack==3.0.0 hstspreload==2020.9.29 html5lib==1.1 httplib2==0.18.1 hyperframe==5.2.0 idna==2.10 imageio==2.9.0 IMAPClient==2.1.0 ipydatawidgets==4.1.0 ipykernel==5.3.4 ipython==7.19.0 ipython-genutils==0.2.0 ipywidgets==7.5.1 itsdangerous==1.1.0 jedi==0.17.2 Jinja2==2.11.2 jmespath==0.10.0 joblib==0.17.0 jsonschema==3.2.0 jupyter-client==6.1.7 jupyter-core==4.6.3 jupyterlab-pygments==0.1.2 K3D==2.7.4 keyring==18.0.1 kiwisolver==1.3.1 kombu==4.6.11 language-selector==0.1 launchpadlib==1.10.13 lazr.restfulclient==0.14.2 lazr.uri==1.0.3 librosa==0.8.0 llvmlite==0.34.0 lockfile==0.12.2 louis==3.12.0 lt-core-news-md==2.3.0 lxml==4.6.1 macaroonbakery==1.3.1 Mako==1.1.0 Markdown==3.3.2 MarkupSafe==1.1.0 matplotlib==3.3.2 mistune==0.8.4 monotonic==1.5 mpld3==0.5.1 msgpack==1.0.0 multidict==4.7.6 murmurhash==1.0.4 nbclient==0.5.1 nbconvert==6.0.7 nbformat==5.0.8 nest-asyncio==1.4.2 netifaces==0.10.4 networkx==2.5 neuralcoref==4.0 nltk==3.5 notebook==6.1.4 numba==0.51.2 numpy==1.19.4 oauth2client==4.1.3 oauthlib==3.1.0 olefile==0.46 onnx==1.7.0 onnxruntime==1.5.2 open3d==0.11.1 opencv-contrib-python==4.4.0.44 opencv-python==4.4.0.44 opt-einsum==3.3.0 packaging==20.4 pandas==1.1.2 pandocfilters==1.4.3 paramiko==2.6.0 parso==0.7.1 pdfminer.six==20181108 pexpect==4.6.0 pickleshare==0.7.5 Pillow==7.2.0 pix2vertex==1.0.4 plac==1.1.3 plotly==4.12.0 plyfile==0.7.2 pooch==1.2.0 preshed==3.0.3 prometheus-client==0.8.0 prompt-toolkit==3.0.7 protobuf==3.13.0 psycopg2-binary==2.8.6 ptyprocess==0.6.0 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycairo==1.16.2 pycparser==2.20 pycryptodome==3.9.8 pycups==1.9.73 PyDrive2==1.7.0 Pygments==2.7.2 PyGObject==3.36.0 PyJWT==1.7.1 pymacaroons==0.13.0 PyNaCl==1.3.0 pyOpenSSL==19.1.0 pyparsing==2.4.7 pyRFC3339==1.1 pyrsistent==0.17.3 python-apt==2.0.0+ubuntu0.20.4.1 python-dateutil==2.8.1 python-debian===0.1.36ubuntu1 python-pptx==0.6.18 pytz==2020.1 PyWavelets==1.1.1 pyxdg==0.26 PyYAML==5.3.1 pyzmq==19.0.2 redis==3.5.3 regex==2020.10.15 reportlab==3.5.34 requests==2.24.0 requests-oauthlib==1.3.0 requests-unixsocket==0.2.0 resampy==0.2.2 retrying==1.3.3 rfc3986==1.4.0 rsa==4.6 s3transfer==0.3.3 sacremoses==0.0.43 scikit-image==0.17.2 scikit-learn==0.23.2 scipy==1.5.3 SecretStorage==2.3.1 selenium==3.141.0 Send2Trash==1.5.0 sentencepiece==0.1.91 simplejson==3.16.0 six==1.15.0 sklearn==0.0 smart-open==3.0.0 sniffio==1.1.0 sortedcontainers==2.2.2 soupsieve==2.0.1 spacy==2.3.2 SpeechRecognition==3.8.1 sqlparse==0.3.1 srsly==1.0.2 summa==1.2.0 systemd-python==234 tensorboard==2.3.0 tensorboard-plugin-wit==1.7.0 tensorflow==2.3.1 tensorflow-estimator==2.3.0 terminado==0.9.1 tesserocr==2.5.1 testpath==0.4.4 textract==1.6.3 thinc==7.4.1 threadpoolctl==2.1.0 tifffile==2020.10.1 tokenizers==0.9.3 torch==1.7.0 torchvision==0.8.1 tornado==6.0.4 tqdm==4.50.2 traitlets==5.0.5 traittypes==0.2.1 transformers==3.5.1 typing-extensions==3.7.4.3 tzlocal==1.5.1 ubuntu-advantage-tools==20.3 ubuntu-drivers-common==0.0.0 ufw==0.36 unattended-upgrades==0.1 uritemplate==3.0.1 urllib3==1.25.8 usb-creator==0.3.7 vine==1.3.0 wadllib==1.3.3 wasabi==0.8.0 wcwidth==0.2.5 webdriver-manager==3.2.2 webencodings==0.5.1 Werkzeug==1.0.1 whitenoise==5.2.0 widgetsnbextension==3.5.1 wrapt==1.12.1 WTForms==2.3.3 xkit==0.0.0 xlrd==1.2.0 XlsxWriter==1.3.7 xx-ent-wiki-sm==2.3.0 yarl==1.6.2
shcheklein commented 3 years ago

@MarlNox thanks! Not able to reproduce with Python 3.8 and the same set of dependencies.

Is it a new, clean instance? How do install those packages.

Also, a few things to check, just in case:

  1. /home/user/.local/lib/python3.8/site-packages/googleapiclient/discovery.py - exists and has def build in it
  2. Run python and do from googleapiclient.discovery import build from the command line
MarlNox commented 3 years ago

@MarlNox thanks! Not able to reproduce with Python 3.8 and the same set of dependencies.

Is it a new, clean instance? How do install those packages.

Also, a few things to check, just in case:

  1. /home/user/.local/lib/python3.8/site-packages/googleapiclient/discovery.py - exists and has def build in it
  2. Run python and do from googleapiclient.discovery import build from the command line

i fixed it by installing these depedencies: google-api-core==1.22.2 google-api-python-client==1.12.6 google-auth==1.22.0 google-auth-httplib2==0.0.4 google-auth-oauthlib==0.4.1 google-pasta==0.2.0 google-trans-new==1.1.3 googleapis-common-protos==1.52.0

shcheklein commented 3 years ago

@MarlNox good! I was not able to reproduce it even with the initial set of dependencies. But I guess we can wait to see if there are other complains.

shcheklein commented 3 years ago

@MarlNox actually, I think the problem might that you have PyDrive 1.6 which is pretty old, and I remember we had some changes related to google lib dependencies.

MarlNox commented 3 years ago

Ive ditched PyDrive for PyDrive2, its in my local machine bcs i havent removed it yet.

shcheklein commented 3 years ago

@MarlNox yeah, sorry I meant that PyDrive2 1.6.0 is also, old. On your local machine you have the latest version I think 1.7. I would try to install the same on the Azure VM.