私的AI研究会 > Google API
2019/06「Google Assistant Library」の破棄に伴い既存の情報はその公開時期を確認する必要が必須となった。
以下、書籍「Raspberry Pi + AI 電子工作入門」の手順を参考に 2020/03 現在の実行手順を検証した。
※(ページ数) は「Raspberry Pi + AI 電子工作入門」の該当ページを示す。
(姓)いづつ (名)まさひろ
(ユーザー名) idzutsumasahiro@gmail.com
(パスワード) *********
(電話番号) XXX-XXXX-XXXX
(メールアドレス) XXXXXXXXX@XXXXX
(生年月日) XXXX/XX/XX
(性別) 男性
(1) https://console.cloud.google.com でクラウド・プラットフォーム・コンソールにアクセスする。
左のような画面となった場合はすでに Googleアカウントでログインしている。
作成したアカウントと異なる場合は「赤印」をクリックしてアカウントを変更する。
(Googleアカウントは複数運用ができるので常に現在のアカウントの確認が必要)
(2) 初回ログイン時のみ左の承認画面が表示されるのでチェックして「同意して続行」を押す。
(3) 続けて表示される画面で「プロジェクトの選択」を押す。
(4)「新しいプロジェクト」を押す。
(5)「プロジェクト名」を入力。
(6) もう一度「プロジェクトの選択」を押す。
(7) 登録された「RaspberryAi2」プロジェクトを選択。
(8)「RaspberryAi2」プロジェクトの情報が表示される。(140ページ)
(9)「Assistant API」のURLは変化しているようだ。前記の画面の検索窓にAssistant と入力する。(左画面)
(10) 表示された左画面(141ページ)の「有効にする}をクリックする。
(11) 表示される左画面(142ページ)の「Learn more」を押す。
(12) 2020/03/05 現在左画面に遷移する。画面右上の「Go to Action Console」を押す。
(13) 画面右上の現在ログイン状態のユーザーを確認し「New Project」を押す。
(14) 初回のみ左の承認画面が表示されるのでチェックして「同意して続行」を押す。
(15) 新規プロジェクト作成画面が表示される。(144ページ画面)
(16) 新規プロジェクト画面が表示される。(145ページ)
(17) https://console.developers.google.com/apis/credentials/consent にアクセスして表示される左画面上部の「プロジェクトの選択」を押す。
(18) 表示される左画面でプロジェクト「RaspberryAI2」を選択する。
(19) 左画面の表示となった場合、右上のログイン状態を確認して左カラム「OAuth 同意画面」を選択。
(20)「アプリを編集」を押す。
(21)「Google API 認証情報の設定」画面が表示される。145ページ下)
(22)「Google API 認証情報の設定」完了画面。
(23) https://myaccount.google.com/activitycontrols にアクセスして「ウェブアプリのアクティビティ」がON、「音声録音を含める」にチェックが入っていることを確認する。
(24) 画面を下にスクロールし、「[デバイス情報の設定]は、[アクティビティ管理]から移動しました」の項目の「アシスタントでのデータ」をクリックする。
(25) 表示される左画面を下にスクロールする。
(26)「Google 全体にわたる管理」の項目の「ウエブとアプリのアクティビティ」「音声録音」「デバイスのアプリ情報」をONにする。(ONになっていることの確認)
「Device Regstration」メニューが該当画面から削除され、「REGISTER MODEL」の登録ができなくなっている。
これまでに登録されたものは表示されるので、メニューから隠されているだけだと判断し、以下の操作を探し出した。
(27) https://console.actions.google.com/ にアクセスして左画面を表示する。
登録されているプロジェクト「RaspberryAi2」をクリック。
表示される画面に従って下のように遷移する。
(28) 左画面の表示になったら、アドレスバーのURL の最後の方 プロジェクト番号の後の /actions/ を /deviceregistration/ に変更してページを表示する。
(29)「Device Registrer Model」の登録画面が表示される。(147ページ下)
画面は(28)と同じようだが中央のボタンの名称が異なる。 中央の「REGISTER MODEL」ボタンを押す。
(30) デバイス登録する。(148ページ上)
(31) 証明書ダウンロードのページが表示される。
Windowsの場合(Edge/IE)ダウンロードボタンを押してもダウンロードできない(2020/03/05現在)ので次に進む。
(32)「All 7 traits」を選んでSAVE する。
(33) デバイスの登録が終わるとデバイス一覧に表示される。
(34) https://console.actions.google.com/ にアクセスして左画面を表示する。
登録されているプロジェクト「RaspberryAi2」をクリック。
(35) 左画面の表示になったら、画面左上のメニューボタンを押す。
(36) 画面左上のメニューから「OverView」→「Develop」と選択する。
(37) 画面左のメニューから「Device registration」を選択し、メニューを閉じる。
(38) デバイス一覧の画面から証明書の再取得ができる。
2020/03/05 現在 Windows10(Edge/IE)では、ダウンロードボタンを押してもダウンロードできないので別の方法で取得する。
このページのURL アドレスを利用して再取得する。
(39) 左画面が表示されたら「Google Chrome」を起動し、左画面のURL をコピーして「Google Chrome」の検索窓にペーストし、「Google Chrome」に同じページを表示させる。
(40) 「Google Chrome」ブラウザ画面右の「Download OAuth 2.0 credentals」を押して証明書をダウンロードする。
(41) 「Google Chrome」ブラウザ画面左下のダウンロードが終了したらファイルの場所を開く。
(42) 証明書 (XXXXXXX.json) ファイルを取得できる。
このファイルを「TeraTerm」などで Raspberry Pi 上に転送する。
VNCビューアなどからRaspberry Pi 上のWEBブラウザを呼び出し先の画面の再取得で証明書をダウンロードすることができる。
(39') VNCビューアからRaspberry Pi のWEBブラウザにアクセス。
(40')上記再取得の手順(34)~(38)で、左画面を表示する。 ブラウザ画面右の「Download OAuth 2.0 credentals」を押して証明書をダウンロードする。
(41') ~/Download に証明書ファイルがダウンロードされる。(この場合転送の必要はない。)
pi@raspberrypi:~ $ sudo apt install python3-dev python3-venv パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています 状態情報を読み取っています... 完了 python3-dev はすでに最新バージョン (3.7.3-1) です。 python3-dev は手動でインストールしたと設定されました。 python3-venv はすでに最新バージョン (3.7.3-1) です。 python3-venv は手動でインストールしたと設定されました。 アップグレード: 0 個、新規インストール: 0 個、削除: 0 個、保留: 0 個。
pi@raspberrypi:~ $ python3 -m venv env
pi@raspberrypi:~ $ env/bin/python -m pip install --upgrade pip setuptools wheel Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting pip Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB) 100% |████████████████████████████████| 1.4MB 273kB/s Collecting setuptools Downloading https://files.pythonhosted.org/packages/3d/72/1c1498c1e908e0562b1e1cd30012580baa7d33b5b0ffdbeb5fde2462cc71/setuptools-45.2.0-py3-none-any.whl (584kB) 100% |████████████████████████████████| 593kB 618kB/s Collecting wheel Downloading https://files.pythonhosted.org/packages/8c/23/848298cccf8e40f5bbb59009b32848a4c38f4e7f3364297ab3c3e2e2cd14/wheel-0.34.2-py2.py3-none-any.whl Installing collected packages: pip, setuptools, wheel Found existing installation: pip 18.1 Uninstalling pip-18.1: Successfully uninstalled pip-18.1 Found existing installation: setuptools 40.8.0 Uninstalling setuptools-40.8.0: Successfully uninstalled setuptools-40.8.0 Successfully installed pip-20.0.2 setuptools-45.2.0 wheel-0.34.2
pi@raspberrypi:~ $ sudo apt install portaudio19-dev libffi-dev libssl-dev libmpg123-dev パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています 状態情報を読み取っています... 完了 libssl-dev はすでに最新バージョン (1.1.1d-0+deb10u2+rpt1) です。 libssl-dev は手動でインストールしたと設定されました。 以下の追加パッケージがインストールされます: libasound2-dev libjack-jackd2-dev libout123-0 libportaudiocpp0 提案パッケージ: libasound2-doc portaudio19-doc 以下のパッケージが新たにインストールされます: libasound2-dev libffi-dev libjack-jackd2-dev libmpg123-dev libout123-0 libportaudiocpp0 portaudio19-dev アップグレード: 0 個、新規インストール: 7 個、削除: 0 個、保留: 0 個。 602 kB のアーカイブを取得する必要があります。 この操作後に追加で 1,924 kB のディスク容量が消費されます。 続行しますか? [Y/n] y 取得:1 http://archive.raspberrypi.org/debian buster/main armhf libasound2-dev armhf 1.1.8-1+rpt1 [145 kB] 取得:2 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian buster/main armhf libffi-dev armhf 3.2.1-9 [159 kB] 取得:3 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian buster/main armhf libjack-jackd2-dev armhf 1.9.12~dfsg-2 [92.9 kB] 取得:4 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian buster/main armhf libout123-0 armhf 1.25.10-2 [35.5 kB] 取得:5 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian buster/main armhf libmpg123-dev armhf 1.25.10-2 [54.9 kB] 取得:6 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian buster/main armhf libportaudiocpp0 armhf 19.6.0-1 [16.8 kB] 取得:7 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian buster/main armhf portaudio19-dev armhf 19.6.0-1 [98.6 kB] 602 kB を 4秒 で取得しました (149 kB/s) 以前に未選択のパッケージ libasound2-dev:armhf を選択しています。 (データベースを読み込んでいます ... 現在 156865 個のファイルとディレクトリがインストールされています。) .../0-libasound2-dev_1.1.8-1+rpt1_armhf.deb を展開する準備をしています ... libasound2-dev:armhf (1.1.8-1+rpt1) を展開しています... 以前に未選択のパッケージ libffi-dev:armhf を選択しています。 .../1-libffi-dev_3.2.1-9_armhf.deb を展開する準備をしています ... libffi-dev:armhf (3.2.1-9) を展開しています... 以前に未選択のパッケージ libjack-jackd2-dev:armhf を選択しています。 .../2-libjack-jackd2-dev_1.9.12~dfsg-2_armhf.deb を展開する準備をしています ... libjack-jackd2-dev:armhf (1.9.12~dfsg-2) を展開しています... 以前に未選択のパッケージ libout123-0:armhf を選択しています。 .../3-libout123-0_1.25.10-2_armhf.deb を展開する準備をしています ... libout123-0:armhf (1.25.10-2) を展開しています... 以前に未選択のパッケージ libmpg123-dev:armhf を選択しています。 .../4-libmpg123-dev_1.25.10-2_armhf.deb を展開する準備をしています ... libmpg123-dev:armhf (1.25.10-2) を展開しています... 以前に未選択のパッケージ libportaudiocpp0:armhf を選択しています。 .../5-libportaudiocpp0_19.6.0-1_armhf.deb を展開する準備をしています ... libportaudiocpp0:armhf (19.6.0-1) を展開しています... 以前に未選択のパッケージ portaudio19-dev:armhf を選択しています。 .../6-portaudio19-dev_19.6.0-1_armhf.deb を展開する準備をしています ... portaudio19-dev:armhf (19.6.0-1) を展開しています... libjack-jackd2-dev:armhf (1.9.12~dfsg-2) を設定しています ... libffi-dev:armhf (3.2.1-9) を設定しています ... libout123-0:armhf (1.25.10-2) を設定しています ... libportaudiocpp0:armhf (19.6.0-1) を設定しています ... libasound2-dev:armhf (1.1.8-1+rpt1) を設定しています ... libmpg123-dev:armhf (1.25.10-2) を設定しています ... portaudio19-dev:armhf (19.6.0-1) を設定しています ... libc-bin (2.28-10+rpi1) のトリガを処理しています ... man-db (2.8.5-2) のトリガを処理しています ... install-info (6.5.0.dfsg.1-4+b1) のトリガを処理しています ...
pi@raspberrypi:~ $ source ~/env/bin/activate (env) pi@raspberrypi:~ $以降、(env) $ のコマンドプロンプトの場合は仮想環境下にある。
pi@raspberrypi:~ $ source ~/env/bin/activate
(env) pi@raspberrypi:~ $ python -V Python 3.7.3
(env) pi@raspberrypi:~ $ deactivate
pi@raspberrypi:~ $ python -V Python 2.7.16
(env) pi@raspberrypi:~ $ python -m pip install --upgrade google-assistant-library==1.0.1 Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting google-assistant-library==1.0.1 Downloading google_assistant_library-1.0.1-py2.py3-none-linux_armv7l.whl (5.6 MB) |████████████████████████████████| 5.6 MB 9.5 kB/s Collecting argparse<2,>=1.4.0 Downloading argparse-1.4.0-py2.py3-none-any.whl (23 kB) Collecting google-auth<2,>=1.0.1 Downloading google_auth-1.11.0-py2.py3-none-any.whl (76 kB) |████████████████████████████████| 76 kB 1.5 MB/s Collecting requests<3,>=2.14.2 Downloading requests-2.22.0-py2.py3-none-any.whl (57 kB) |████████████████████████████████| 57 kB 1.6 MB/s Collecting pathlib2<3,>=2.3.0 Downloading pathlib2-2.3.5-py2.py3-none-any.whl (18 kB) Collecting enum34<2,>=1.1.6 Downloading enum34-1.1.6-py3-none-any.whl (12 kB) Collecting six>=1.9.0 Downloading six-1.14.0-py2.py3-none-any.whl (10 kB) Collecting cachetools<5.0,>=2.0.0 Downloading cachetools-4.0.0-py3-none-any.whl (10 kB) Collecting pyasn1-modules>=0.2.1 Downloading pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB) |████████████████████████████████| 155 kB 639 kB/s Requirement already satisfied, skipping upgrade: setuptools>=40.3.0 in ./env/lib/python3.7/site-packages (from google-auth<2,>=1.0.1->google-assistant-library==1.0.1) (45.2.0) Collecting rsa<4.1,>=3.1.4 Downloading rsa-4.0-py2.py3-none-any.whl (38 kB) Collecting chardet<3.1.0,>=3.0.2 Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB) |████████████████████████████████| 133 kB 2.5 MB/s Collecting idna<2.9,>=2.5 Downloading idna-2.8-py2.py3-none-any.whl (58 kB) |████████████████████████████████| 58 kB 1.7 MB/s Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 Downloading urllib3-1.25.8-py2.py3-none-any.whl (125 kB) |████████████████████████████████| 125 kB 3.1 MB/s Collecting certifi>=2017.4.17 Downloading certifi-2019.11.28-py2.py3-none-any.whl (156 kB) |████████████████████████████████| 156 kB 3.1 MB/s Collecting pyasn1<0.5.0,>=0.4.6 Downloading pyasn1-0.4.8-py2.py3-none-any.whl (77 kB) |████████████████████████████████| 77 kB 1.7 MB/s Installing collected packages: argparse, six, cachetools, pyasn1, pyasn1-modules, rsa, google-auth, chardet, idna, urllib3, certifi, requests, pathlib2, enum34, google-assistant-library Successfully installed argparse-1.4.0 cachetools-4.0.0 certifi-2019.11.28 chardet-3.0.4 enum34-1.1.6 google-assistant-library-1.0.1 google-auth-1.11.0 idna-2.8 pathlib2-2.3.5 pyasn1-0.4.8 pyasn1-modules-0.2.8 requests-2.22.0 rsa-4.0 six-1.14.0 urllib3-1.25.8 (env) pi@raspberrypi:~ $
(env) pi@raspberrypi:~ $ python -m pip install --upgrade google-assistant-sdk[samples]==0.5.1 Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting google-assistant-sdk[samples]==0.5.1 Downloading google_assistant_sdk-0.5.1-py2.py3-none-any.whl (33 kB) Collecting google-auth-oauthlib[tool]>=0.1.0 Downloading google_auth_oauthlib-0.4.1-py2.py3-none-any.whl (18 kB) Collecting sounddevice<0.4,>=0.3.7; extra == "samples" Downloading sounddevice-0.3.14-py2.py3-none-any.whl (30 kB) Requirement already satisfied, skipping upgrade: urllib3[secure]<2,>=1.21; extra == "samples" in ./env/lib/python3.7/site-packages (from google-assistant-sdk[samples]==0.5.1) (1.25.8) Collecting click<7,>=6.7; extra == "samples" Downloading click-6.7-py2.py3-none-any.whl (71 kB) |████████████████████████████████| 71 kB 214 kB/s Collecting tenacity<5,>=4.1.0; extra == "samples" Downloading tenacity-4.12.0-py2.py3-none-any.whl (25 kB) Collecting google-assistant-grpc==0.2.1; extra == "samples" Downloading google_assistant_grpc-0.2.1-py2.py3-none-any.whl (21 kB) Collecting futures<4,>=3.1.1; extra == "samples" Downloading futures-3.1.1-py3-none-any.whl (2.8 kB) Requirement already satisfied, skipping upgrade: pathlib2<3,>=2.3.0; extra == "samples" in ./env/lib/python3.7/site-packages (from google-assistant-sdk[samples]==0.5.1) (2.3.5) Requirement already satisfied, skipping upgrade: google-auth in ./env/lib/python3.7/site-packages (from google-auth-oauthlib[tool]>=0.1.0->google-assistant-sdk[samples]==0.5.1) (1.11.0) Collecting requests-oauthlib>=0.7.0 Downloading requests_oauthlib-1.3.0-py2.py3-none-any.whl (23 kB) WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))': /simple/cffi/ Collecting CFFI>=1.0 Downloading cffi-1.14.0.tar.gz (463 kB) |████████████████████████████████| 463 kB 2.7 MB/s Requirement already satisfied, skipping upgrade: certifi; extra == "secure" in ./env/lib/python3.7/site-packages (from urllib3[secure]<2,>=1.21; extra == "samples"->google-assistant-sdk[samples]==0.5.1) (2019.11.28) Requirement already satisfied, skipping upgrade: idna>=2.0.0; extra == "secure" in ./env/lib/python3.7/site-packages (from urllib3[secure]<2,>=1.21; extra == "samples"->google-assistant-sdk[samples]==0.5.1) (2.8) Collecting cryptography>=1.3.4; extra == "secure" Downloading https://www.piwheels.org/simple/cryptography/cryptography-2.8-cp37-cp37m-linux_armv7l.whl (852 kB) |████████████████████████████████| 852 kB 139 kB/s Collecting pyOpenSSL>=0.14; extra == "secure" Downloading pyOpenSSL-19.1.0-py2.py3-none-any.whl (53 kB) |████████████████████████████████| 53 kB 38 kB/s Requirement already satisfied, skipping upgrade: six>=1.9.0 in ./env/lib/python3.7/site-packages (from tenacity<5,>=4.1.0; extra == "samples"->google-assistant-sdk[samples]==0.5.1) (1.14.0) Collecting googleapis-common-protos>=1.5.2 Downloading https://www.piwheels.org/simple/googleapis-common-protos/googleapis_common_protos-1.51.0-py3-none-any.whl (74 kB) |████████████████████████████████| 74 kB 54 kB/s Collecting grpcio>=1.3.5 Downloading grpcio-1.27.1.tar.gz (16.9 MB) |████████████████████████████████| 16.9 MB 28 kB/s Requirement already satisfied, skipping upgrade: cachetools<5.0,>=2.0.0 in ./env/lib/python3.7/site-packages (from google-auth->google-auth-oauthlib[tool]>=0.1.0->google-assistant-sdk[samples]==0.5.1) (4.0.0) Requirement already satisfied, skipping upgrade: setuptools>=40.3.0 in ./env/lib/python3.7/site-packages (from google-auth->google-auth-oauthlib[tool]>=0.1.0->google-assistant-sdk[samples]==0.5.1) (45.2.0) Requirement already satisfied, skipping upgrade: rsa<4.1,>=3.1.4 in ./env/lib/python3.7/site-packages (from google-auth->google-auth-oauthlib[tool]>=0.1.0->google-assistant-sdk[samples]==0.5.1) (4.0) Requirement already satisfied, skipping upgrade: pyasn1-modules>=0.2.1 in ./env/lib/python3.7/site-packages (from google-auth->google-auth-oauthlib[tool]>=0.1.0->google-assistant-sdk[samples]==0.5.1) (0.2.8) Requirement already satisfied, skipping upgrade: requests>=2.0.0 in ./env/lib/python3.7/site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib[tool]>=0.1.0->google-assistant-sdk[samples]==0.5.1) (2.22.0) Collecting oauthlib>=3.0.0 Downloading oauthlib-3.1.0-py2.py3-none-any.whl (147 kB) |████████████████████████████████| 147 kB 2.9 MB/s Collecting pycparser Downloading https://www.piwheels.org/simple/pycparser/pycparser-2.19-py2.py3-none-any.whl (111 kB) |████████████████████████████████| 111 kB 136 kB/s Collecting protobuf>=3.6.0 Downloading protobuf-3.11.3-py2.py3-none-any.whl (434 kB) |████████████████████████████████| 434 kB 2.9 MB/s Requirement already satisfied, skipping upgrade: pyasn1>=0.1.3 in ./env/lib/python3.7/site-packages (from rsa<4.1,>=3.1.4->google-auth->google-auth-oauthlib[tool]>=0.1.0->google-assistant-sdk[samples]==0.5.1) (0.4.8) Requirement already satisfied, skipping upgrade: chardet<3.1.0,>=3.0.2 in ./env/lib/python3.7/site-packages (from requests>=2.0.0->requests-oauthlib>=0.7.0->google-auth-oauthlib[tool]>=0.1.0->google-assistant-sdk[samples]==0.5.1) (3.0.4) Building wheels for collected packages: CFFI, grpcio Building wheel for CFFI (setup.py) ... done Created wheel for CFFI: filename=cffi-1.14.0-cp37-cp37m-linux_armv7l.whl size=344199 sha256=065c9116c377d349abb73c3dab4c81e96f1f4b609feea59b0ed8e5ed7a507996 Stored in directory: /home/pi/.cache/pip/wheels/c4/91/4f/81fe591804590e3cd010d6c54f251607dc4c61fc5eb5840a51 Building wheel for grpcio (setup.py) ... done Created wheel for grpcio: filename=grpcio-1.27.1-cp37-cp37m-linux_armv7l.whl size=19730888 sha256=e82f92e8a83f098324388108730a9b139ed4e17df1ebda496b41b44af68c0a6f Stored in directory: /home/pi/.cache/pip/wheels/17/b1/29/54f293e4b9aa742164ebc8ba54fef15efefcca306bf6335860 Successfully built CFFI grpcio Installing collected packages: oauthlib, requests-oauthlib, click, google-auth-oauthlib, pycparser, CFFI, sounddevice, tenacity, protobuf, googleapis-common-protos, grpcio, google-assistant-grpc, futures, google-assistant-sdk, cryptography, pyOpenSSL Successfully installed CFFI-1.14.0 click-6.7 cryptography-2.8 futures-3.1.1 google-assistant-grpc-0.2.1 google-assistant-sdk-0.5.1 google-auth-oauthlib-0.4.1 googleapis-common-protos-1.51.0 grpcio-1.27.1 oauthlib-3.1.0 protobuf-3.11.3 pyOpenSSL-19.1.0 pycparser-2.19 requests-oauthlib-1.3.0 sounddevice-0.3.14 tenacity-4.12.0 (env) pi@raspberrypi:~ $
(env) pi@raspberrypi:~ $ python -m pip install --upgrade google-auth-oauthlib[tool] Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already up-to-date: google-auth-oauthlib[tool] in ./env/lib/python3.7/site-packages (0.4.1) Requirement already satisfied, skipping upgrade: google-auth in ./env/lib/python3.7/site-packages (from google-auth-oauthlib[tool]) (1.11.0) Requirement already satisfied, skipping upgrade: requests-oauthlib>=0.7.0 in ./env/lib/python3.7/site-packages (from google-auth-oauthlib[tool]) (1.3.0) Requirement already satisfied, skipping upgrade: click; extra == "tool" in ./env/lib/python3.7/site-packages (from google-auth-oauthlib[tool]) (6.7) Requirement already satisfied, skipping upgrade: rsa<4.1,>=3.1.4 in ./env/lib/python3.7/site-packages (from google-auth->google-auth-oauthlib[tool]) (4.0) Requirement already satisfied, skipping upgrade: setuptools>=40.3.0 in ./env/lib/python3.7/site-packages (from google-auth->google-auth-oauthlib[tool]) (45.2.0) Requirement already satisfied, skipping upgrade: cachetools<5.0,>=2.0.0 in ./env/lib/python3.7/site-packages (from google-auth->google-auth-oauthlib[tool]) (4.0.0) Requirement already satisfied, skipping upgrade: six>=1.9.0 in ./env/lib/python3.7/site-packages (from google-auth->google-auth-oauthlib[tool]) (1.14.0) Requirement already satisfied, skipping upgrade: pyasn1-modules>=0.2.1 in ./env/lib/python3.7/site-packages (from google-auth->google-auth-oauthlib[tool]) (0.2.8) Requirement already satisfied, skipping upgrade: oauthlib>=3.0.0 in ./env/lib/python3.7/site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib[tool]) (3.1.0) Requirement already satisfied, skipping upgrade: requests>=2.0.0 in ./env/lib/python3.7/site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib[tool]) (2.22.0) Requirement already satisfied, skipping upgrade: pyasn1>=0.1.3 in ./env/lib/python3.7/site-packages (from rsa<4.1,>=3.1.4->google-auth->google-auth-oauthlib[tool]) (0.4.8) Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in ./env/lib/python3.7/site-packages (from requests>=2.0.0->requests-oauthlib>=0.7.0->google-auth-oauthlib[tool]) (2019.11.28) Requirement already satisfied, skipping upgrade: idna<2.9,>=2.5 in ./env/lib/python3.7/site-packages (from requests>=2.0.0->requests-oauthlib>=0.7.0->google-auth-oauthlib[tool]) (2.8) Requirement already satisfied, skipping upgrade: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./env/lib/python3.7/site-packages (from requests>=2.0.0->requests-oauthlib>=0.7.0->google-auth-oauthlib[tool]) (1.25.8) Requirement already satisfied, skipping upgrade: chardet<3.1.0,>=3.0.2 in ./env/lib/python3.7/site-packages (from requests>=2.0.0->requests-oauthlib>=0.7.0->google-auth-oauthlib[tool]) (3.0.4)
(env) pi@raspberrypi:~ $ google-oauthlib-tool --scope https://www.googleapis.com/auth/assistant-sdk-prototype --scope https://www.googleapis.com/auth/gcm --save --headless --client-secrets client_secret_[XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX].apps.googleusercontent.com.json Please visit this URL to authorize this application: https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=1063710001909-4c3g9b9900le8dke9agqdq7i7p3c02vf.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fassistant-sdk-prototype+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgcm&state=slpK7tPNVrk7YXVk8SJJ8fxuyAAhEx&prompt=consent&access_type=offline Enter the authorization code:※「XXXXX」は実際のファイル名を入れる。
Enter the authorization code: [XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX] credentials saved: /home/pi/.config/google-oauthlib-tool/credentials.json (env) pi@raspberrypi:~ $
(env) pi@raspberrypi:~ $ pip freeze cachetools==4.0.0 certifi==2019.11.28 cffi==1.14.0 chardet==3.0.4 click==6.7 cryptography==2.8 enum34==1.1.6 futures==3.1.1 google-assistant-grpc==0.2.1 google-assistant-library==1.0.1 google-assistant-sdk==0.5.1 google-auth==1.11.0 google-auth-oauthlib==0.4.1 googleapis-common-protos==1.51.0 grpcio==1.27.1 idna==2.8 oauthlib==3.1.0 pathlib2==2.3.5 pkg-resources==0.0.0 protobuf==3.11.3 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycparser==2.19 pyOpenSSL==19.1.0 requests==2.22.0 requests-oauthlib==1.3.0 rsa==4.0 six==1.14.0 sounddevice==0.3.14 tenacity==4.12.0 urllib3==1.25.8
pi@raspberrypi:~ $ source ~/env/bin/activate (env) pi@raspberrypi:~ $
(env) pi@raspberrypi-mas:~ $ google-assistant-demo --project-id raspberryai-mizutu --device-model-id raspberryai-mizutu-rasaiprd-XXXXXX Segmentation faultセグメントエラーで前に進めず!!
(env) pi@raspberrypi:~ $ google-assistant-demo -h usage: google-assistant-demo [-h] [--device-model-id DEVICE_MODEL_ID] [--project-id PROJECT_ID] [--nickname NICKNAME] [--device-config DEVICE_CONFIG_FILE] [--credentials OAUTH2_CREDENTIALS_FILE] [--query QUERY] [-v] optional arguments: -h, --help show this help message and exit --device-model-id DEVICE_MODEL_ID, --device_model_id DEVICE_MODEL_ID the device model ID registered with Google --project-id PROJECT_ID, --project_id PROJECT_ID the project ID used to register this device --nickname NICKNAME the nickname used to register this device --device-config DEVICE_CONFIG_FILE path to store and read device configuration --credentials OAUTH2_CREDENTIALS_FILE path to store and read OAuth2 credentials --query QUERY query to send as soon as the Assistant starts -v, --version show program's version number and exit (env) pi@raspberrypi:~ $ google-assistant-demo --project-id raspberryai-mizutu > --device-model-id raspberryai-mizutu-rasaiprd-XXXXXX usage: google-assistant-demo [-h] [--device-model-id DEVICE_MODEL_ID] [--project-id PROJECT_ID] [--nickname NICKNAME] [--device-config DEVICE_CONFIG_FILE] [--credentials OAUTH2_CREDENTIALS_FILE] [--query QUERY] [-v] google-assistant-demo: error: unrecognized arguments: raspberryai-mizutu-rasaiprd-bxeos5 (env) pi@raspberrypi:~ $ google-assistant-demo --project-id raspberryai-mizutu --device-model-id raspberryai-mizutu-rasaiprd-XXXXXX Segmentation fault (env) pi@raspberrypi:~ $ google-assistant-demo -v google-assistant-demo 1.0.1 core: 136467 (env) pi@raspberrypi:~ $ googlesamples-assistant-hotword --project-id raspberryai-mizutu --device-model-id raspberryai-mizutu-rasaiprd-XXXXXX Segmentation fault (env) pi@raspberrypi:~ $ google-assistant-demo --project-id raspberryai-mizutu --device-model-id raspberryai-mizutu-rasaiprd-XXXXXX Segmentation fault (env) pi@raspberrypi-mas:~ $
※ 2020/02/15 記
- 上記で使用するコマンドは、「Googl Assistant Service」の一部である「Google Assistant Library」を使用しているらしい。
- 「Google Assistant Library」は2019/06 で破棄されたと記述あり。今後の動作保証は望めないようだ。サイトには各種混乱状況の記述あり。
- オフィシャルサイトでは「Googl Assistant Service」を利用しろということなので、オフィシャルサイトのドキュメントから再度確認することにする。
以後のステップは → Assistant SDK ページへ。