Error installing the Google Assistant SDK for my Python Project

30 views Asked by At

I've been trying to install the google assistant SDK for my python project. My main goal is to have a python script which can send inputs to the google assistant and get a response back. So far i have followed these steps here. But I have run into some problems in this step.

Firstly, i was not able to run sudo apt-get install portaudio19-dev libffi-dev libssl-dev to install the system dependencies in my python terminal. so i just went along to the next steps anyways, and then ran into a problem while doing this command: google-oauthlib-tool --scope https://www.googleapis.com/auth/assistant-sdk-prototype \ --save --headless --client-secrets /path/to/client_secret_client-id.json

after putting my path to the json in there i ran it and i got this error:

Traceback (most recent call last):
  File "E:\Python Projects\ardbot\.venv\Lib\site-packages\google\auth\transport\requests.py", line 26, in <module>
    import requests
  File "E:\Python Projects\ardbot\.venv\Lib\site-packages\requests\__init__.py", line 43, in <module>
    import urllib3
  File "E:\Python Projects\ardbot\.venv\Lib\site-packages\urllib3\__init__.py", line 8, in <module>
    from .connectionpool import (
  File "E:\Python Projects\ardbot\.venv\Lib\site-packages\urllib3\connectionpool.py", line 29, in <module>
    from .connection import (
  File "E:\Python Projects\ardbot\.venv\Lib\site-packages\urllib3\connection.py", line 39, in <module>
    from .util.ssl_ import (
  File "E:\Python Projects\ardbot\.venv\Lib\site-packages\urllib3\util\__init__.py", line 3, in <module>
    from .connection import is_connection_dropped
  File "E:\Python Projects\ardbot\.venv\Lib\site-packages\urllib3\util\connection.py", line 3, in <module>
    from .wait import wait_for_read
  File "E:\Python Projects\ardbot\.venv\Lib\site-packages\urllib3\util\wait.py", line 1, in <module>
    from .selectors import (
  File "E:\Python Projects\ardbot\.venv\Lib\site-packages\urllib3\util\selectors.py", line 14, in <module>
    from collections import namedtuple, Mapping
ImportError: cannot import name 'Mapping' from 'collections' (C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\collections\__init__.py)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "E:\Python Projects\ardbot\.venv\Scripts\google-oauthlib-tool.exe\__main__.py", line 4, in <module>
  File "E:\Python Projects\ardbot\.venv\Lib\site-packages\google_auth_oauthlib\__init__.py", line 21, in <module>
    from .interactive import get_user_credentials
  File "E:\Python Projects\ardbot\.venv\Lib\site-packages\google_auth_oauthlib\interactive.py", line 27, in <module>
    import google_auth_oauthlib.flow
  File "E:\Python Projects\ardbot\.venv\Lib\site-packages\google_auth_oauthlib\flow.py", line 65, in <module>
    import google.auth.transport.requests
  File "E:\Python Projects\ardbot\.venv\Lib\site-packages\google\auth\transport\requests.py", line 28, in <module>
    raise ImportError(
ImportError: The requests library is not installed from please install the requests package to use the requests transport.

i have installed the requests library in my virtual environment and it is also displayed in the list when i run python -m pip freeze so i dont know what the problem is here.

Then i found a github page showing similar steps to do this and upon running this command: pip install --upgrade google-auth-oauthlib[tool] google-oauthlib-tool --client-secrets path/to/client_secret_<client-id>.json --scope https://www.googleapis.com/auth/assistant-sdk-prototype --save --headless with my path in it i got the follwing error:

Usage:
  pip install [options] <requirement specifier> [package-index-options] ...
  pip install [options] -r <requirements file> [package-index-options] ...
  pip install [options] [-e] <vcs project url> ...
  pip install [options] [-e] <local project path> ...
  pip install [options] <archive url/path> ...

no such option: --client-secrets

I dont know the reason behind these errors and just in case i will also provide the exact command i was running in both cases:

Google Official SDK page command: google-oauthlib-tool --scope https://www.googleapis.com/auth/assistant-sdk-prototype --save --client-secrets E:\Python Projects\ardbot\client_secret_437082373621-14k487nbddf6ha5ocvo13eu75r46jeib.apps.googleusercontent.com.json

Github page command: pip install --upgrade google-auth-oauthlib[tool] google-oauthlib-tool --client-secrets E:\Python Projects\ardbot\client_secret_437082373621-14k487nbddf6ha5ocvo13eu75r46jeib.apps.googleusercontent.com.json --scope https://www.googleapis.com/auth/assistant-sdk-prototype --save --headless

Please help me fix this problem as i have been trying for quite a long while till now.

Thanks in advance!

I have tried all the tutorials i could find online regarding this but none of them worked and no one else seems to have had the same problem.

Im expecting to make a python script that can send inputs to the google assistant and get an appropriate response back.

Thanks in advace!

0

There are 0 answers