Daily Archives: June 20, 2020

DonkeyWin4.3:DonkeyCarソフトウェアの起動

Published by:

手順3. DonkeyCarソフトウェアの起動★

DonkeyCarのコントーラはpython manage.py driveコマンドで起動します。次のセルを実行します。これまでのセルとは違い、実行を手動で停止させるまで完了することはありません。
DonkeySIMを立ち上げる際、2回くらい、ファイアウォールのルール変更を求めてきます。その際承諾しないと、その後、接続できないというエラーに見舞われます。
めでたく、起動しました。
Macと違って、DonkeyCarソフトウェアの起動ご、メッセージ沢山出ないようです。
DonkeyCarのコントーラはpython manage.py driveコマンドで起動します。次のセルを実行します。これまでのセルとは違い、実行を手動で停止させるまで完了することはありません。
[WinError 2] 系统找不到指定的文件。: ‘mycar’
C:\Users\chen4\workspace\mycar
using donkey v3.1.2 …C:\Users\chen4\workspace\vdonkey\lib\site-packages\gym\logger.py:30: UserWarning: WARN: Box bound precision lowered by casting to float32
warnings.warn(colorize(‘%s: %s’%(‘WARN’, msg % args), ‘yellow’))
waiting for sim to start..
INFO:gym_donkeycar.envs.donkey_sim:crossed start line: lap_time 0
INFO:gym_donkeycar.envs.donkey_sim:crossed start line: lap_time 0
INFO:gym_donkeycar.envs.donkey_sim:crossed start line: lap_time 169060
loading config file: C:\Users\chen4\workspace\mycar\config.py
myconfig myconfig.py
loading personal config over-rides from myconfig.py
config loaded
cfg.CAMERA_TYPE PICAM
starting DonkeyGym env
connecting to 127.0.0.1 9091
loading scene 4 mountain_track
Adding part DonkeyGymEnv.
Starting Donkey Server…… you can now go to Hong-ezbook3p01.local:8887 to drive your car.
Adding part LocalWebController.
Adding part ThrottleFilter.
Adding part PilotCondition.
Adding part RecordTracker.
Adding part ImgPreProcess.
Adding part DriveMode.
Adding part AiLaunch.
Adding part AiRunCondition.
Tub does NOT exist. Creating new tub…
New tub created at: C:\Users\chen4\workspace\mycar\data\tub_6_20-06-20
Adding part TubWriter.
You can now go to http://localhost:8887 to drive your car.
Starting vehicle at 20 Hz
recorded 10 records
recorded 20 records
recorded 30 records
。。。。
recorded 2600 records
recorded 2610 records
recorded 2620 records
recorded 2630 records
必要分のデータ(1万件程度?)が取れたら、^Cで実行を手動で停止させる。
INFO:gym_donkeycar.envs.donkey_sim:crossed start line: lap_time 48120
Traceback (most recent call last):
File “c:\users\chen4\workspace\donkeycar\donkeycar\vehicle.py”, line 151, in start
self.update_parts()
File “c:\users\chen4\workspace\donkeycar\donkeycar\vehicle.py”, line 197, in update_parts
outputs = p.run_threaded(*inputs)
File “c:\users\chen4\workspace\donkeycar\donkeycar\parts\web_controller\web.py”, line 151, in run_threaded
wsclient.write_message(json.dumps({‘num_records’: self.num_records}))
File “C:\Users\chen4\workspace\vdonkey\lib\site-packages\tornado\websocket.py”, line 342, in write_message
return self.ws_connection.write_message(message, binary=binary)
File “C:\Users\chen4\workspace\vdonkey\lib\site-packages\tornado\websocket.py”, line 1098, in write_message
fut = self._write_frame(True, opcode, message, flags=flags)
File “C:\Users\chen4\workspace\vdonkey\lib\site-packages\tornado\websocket.py”, line 1075, in _write_frame
return self.stream.write(frame)
File “C:\Users\chen4\workspace\vdonkey\lib\site-packages\tornado\iostream.py”, line 559, in write
self._handle_write()
File “C:\Users\chen4\workspace\vdonkey\lib\site-packages\tornado\iostream.py”, line 991, in _handle_write
self._write_buffer.advance(num_bytes)
File “C:\Users\chen4\workspace\vdonkey\lib\site-packages\tornado\iostream.py”, line 202, in advance
assert 0 < size <= self._size
AssertionError

DonkeyWin4学習データの収集

Published by:

4. 学習データの収集

ここではシミュレータ上のDonkeyCarを操作してAIに学習させるためのデータを集めます。

手順1. DonkeySIMのダウンロード

以下のURLからローカル環境のプラットフォームにあったDonkeySIMをダウンロードして、zipファイルを解凍します。バージョンは「May Race Edition v20.5.16」を選択しましょう。

手順2. DonkeySIMの実行★

ダウンロードしたDonkeySIMを開き、実行ファイルを実行します。以下のようなシミュレータ画面が表示されます。

DonkeyWin3:設定ファイルの修正

Published by:

3. 設定ファイルの修正

DonekyCarワークスペースにせ作成される「myconfig.py」ファイルを編集することで、DonkeyCarの設定を変更することができます。「STEP2.DonkeyCar」で作成したワークスペース内のmyconfig.pyにシミュレータ用の設定を実施します。
「mycar/myconfig.py」をテキストエディタで開き、以下のように設定値のコメントアウトを解除して値を変更してください。

DonkeyWin2:DonkeyCarワークスペースの作成

Published by:

2. DonkeyCarワークスペースの作成

DonekyCarではワークスペースという単位で作業を進めていきます。ワークスペースはDonkeyCarの設定やAIモデル、学習データを管理する単位です。ワークスペースを複数利用することで複数の設定を同時に残すことができます。走行させるコースごとにワークスペースを作ると良いでしょう。
using donkey v3.1.2 …
Creating car folder: mycar
making dir mycar
Creating data & model folders.
making dir mycar\models
making dir mycar\data
making dir mycar\logs
Copying car application template: complete
Copying car config defaults. Adjust these before starting your car.
Copying train script. Adjust these before starting your car.
Copying my car config overrides
Donkey setup complete.

DonkeyWin1:DonkeyCarソフトのインストール

Published by:

1. DonkeyCarソフトウェアのインストール

ローカル環境へDonkeyCarのソフトウェアをインストールします。このハンズオンでは次のセルを実行することでローカル環境へインストールできます。ローカル環境に接続していることを確認して、次のセルを実行してください。

プログラム


#DonkeyCarソフトウェアのインストールセル
# Tensorflowインストール
!pip install tensorflow==1.15.0
# DonkeyCarソフトウェア本体をインストール
!git clone https://github.com/autorope/donkeycar
%cd donkeycar
!git checkout master
!pip install -e .[pc]
!pip install -e gym-donkeycar
%cd ../
#シミュレータ用クライアントライブラリをインストール
!pip install gym
!git clone https://github.com/tawnkramer/gym-donkeycar
!pip install -e gym-donkeycar

出力結果


Collecting tensorflow==1.15.0
Downloading tensorflow-1.15.0-cp37-cp37m-win_amd64.whl (295.1 MB)
Collecting tensorflow-estimator==1.15.1
Downloading tensorflow_estimator-1.15.1-py2.py3-none-any.whl (503 kB)
Collecting gast==0.2.2
Downloading gast-0.2.2.tar.gz (10 kB)
Collecting opt-einsum>=2.3.2
Downloading opt_einsum-3.2.1-py3-none-any.whl (63 kB)
Requirement already satisfied: six>=1.10.0 in c:\users\chen\workspace\vdonkey\lib\site-packages (from tensorflow==1.15.0) (1.15.0)
Collecting google-pasta>=0.1.6
Downloading google_pasta-0.2.0-py3-none-any.whl (57 kB)
Collecting absl-py>=0.7.0
Downloading absl-py-0.9.0.tar.gz (104 kB)
Collecting keras-preprocessing>=1.0.5
Downloading Keras_Preprocessing-1.1.2-py2.py3-none-any.whl (42 kB)
Collecting protobuf>=3.6.1
Downloading protobuf-3.12.2-cp37-cp37m-win_amd64.whl (1.0 MB)
Collecting wrapt>=1.11.1
Downloading wrapt-1.12.1.tar.gz (27 kB)
Requirement already satisfied: wheel>=0.26 in c:\users\chen\workspace\vdonkey\lib\site-packages (from tensorflow==1.15.0) (0.34.2)
Collecting numpy<2.0,>=1.16.0
Downloading numpy-1.18.5-cp37-cp37m-win_amd64.whl (12.7 MB)
Collecting tensorboard<1.16.0,>=1.15.0
Downloading tensorboard-1.15.0-py3-none-any.whl (3.8 MB)
Collecting grpcio>=1.8.6
Downloading grpcio-1.29.0-cp37-cp37m-win_amd64.whl (2.3 MB)
Collecting astor>=0.6.0
Downloading astor-0.8.1-py2.py3-none-any.whl (27 kB)
Collecting keras-applications>=1.0.8
Downloading Keras_Applications-1.0.8-py3-none-any.whl (50 kB)
Collecting termcolor>=1.1.0
Downloading termcolor-1.1.0.tar.gz (3.9 kB)
Requirement already satisfied: setuptools in c:\users\chen\workspace\vdonkey\lib\site-packages (from protobuf>=3.6.1->tensorflow==1.15.0) (47.1.1)
Collecting markdown>=2.6.8
Downloading Markdown-3.2.2-py3-none-any.whl (88 kB)
Collecting werkzeug>=0.11.15
Downloading Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB)
Collecting h5py
Downloading h5py-2.10.0-cp37-cp37m-win_amd64.whl (2.5 MB)
Requirement already satisfied: importlib-metadata; python_version < “3.8” in c:\users\chen\workspace\vdonkey\lib\site-packages (from markdown>=2.6.8->tensorboard<1.16.0,>=1.15.0->tensorflow==1.15.0) (1.6.1)
Requirement already satisfied: zipp>=0.5 in c:\users\chen\workspace\vdonkey\lib\site-packages (from importlib-metadata; python_version < “3.8”->markdown>=2.6.8->tensorboard<1.16.0,>=1.15.0->tensorflow==1.15.0) (3.1.0)
Building wheels for collected packages: gast, absl-py, wrapt, termcolor
Building wheel for gast (setup.py): started
Building wheel for gast (setup.py): finished with status ‘done’
Created wheel for gast: filename=gast-0.2.2-py3-none-any.whl size=7547 sha256=976b014641bc9b87fbd9a861fe36ea11c952a6f5cbbd5bdf94d8e407892b122a
Stored in directory: c:\users\chen\appdata\local\pip\cache\wheels\21\7f\02\420f32a803f7d0967b48dd823da3f558c5166991bfd204eef3
Building wheel for absl-py (setup.py): started
Building wheel for absl-py (setup.py): finished with status ‘done’
Created wheel for absl-py: filename=absl_py-0.9.0-py3-none-any.whl size=121935 sha256=0d19f37027732b2398282a0966e888f37be5dd85bc3fde59ce6a0a7afd87e4bf
Stored in directory: c:\users\chen\appdata\local\pip\cache\wheels\cc\af\1a\498a24d0730ef484019e007bb9e8cef3ac00311a672c049a3e
Building wheel for wrapt (setup.py): started
Building wheel for wrapt (setup.py): finished with status ‘done’
Created wheel for wrapt: filename=wrapt-1.12.1-cp37-cp37m-win_amd64.whl size=33437 sha256=4312cf363c094a90f0aa1174726a4f635975f175d8614c6db08472793029d80e
Stored in directory: c:\users\chen\appdata\local\pip\cache\wheels\62\76\4c\aa25851149f3f6d9785f6c869387ad82b3fd37582fa8147ac6
Building wheel for termcolor (setup.py): started
Building wheel for termcolor (setup.py): finished with status ‘done’
Created wheel for termcolor: filename=termcolor-1.1.0-py3-none-any.whl size=4835 sha256=6026fe775667e30e21ac2595634d5c6af4e4537e371cccc657f6227d102b11cf
Stored in directory: c:\users\chen\appdata\local\pip\cache\wheels\3f\e3\ec\8a8336ff196023622fbcb36de0c5a5c218cbb24111d1d4c7f2
Successfully built gast absl-py wrapt termcolor
Installing collected packages: tensorflow-estimator, gast, numpy, opt-einsum, google-pasta, absl-py, keras-preprocessing, protobuf, wrapt, markdown, grpcio, werkzeug, tensorboard, astor, h5py, keras-applications, termcolor, tensorflow
Successfully installed absl-py-0.9.0 astor-0.8.1 gast-0.2.2 google-pasta-0.2.0 grpcio-1.29.0 h5py-2.10.0 keras-applications-1.0.8 keras-preprocessing-1.1.2 markdown-3.2.2 numpy-1.18.5 opt-einsum-3.2.1 protobuf-3.12.2 tensorboard-1.15.0 tensorflow-1.15.0 tensorflow-estimator-1.15.1 termcolor-1.1.0 werkzeug-1.0.1 wrapt-1.12.1

C:\Users\chen\workspace\donkeycar
Cloning into ‘donkeycar’…
Branch ‘master’ set up to track remote branch ‘master’ from ‘origin’.
Switched to a new branch ‘master’
Obtaining file:///C:/Users/chen/workspace/donkeycar
Requirement already satisfied: numpy in c:\users\chen\workspace\vdonkey\lib\site-packages (from donkeycar==3.1.2) (1.18.5)
Collecting pillow
Downloading Pillow-7.1.2-cp37-cp37m-win_amd64.whl (2.0 MB)
Collecting docopt
Downloading docopt-0.6.2.tar.gz (25 kB)
Requirement already satisfied: tornado in c:\users\chen\workspace\vdonkey\lib\site-packages (from donkeycar==3.1.2) (6.0.4)
Collecting requests
Downloading requests-2.23.0-py2.py3-none-any.whl (58 kB)
Requirement already satisfied: h5py in c:\users\chen\workspace\vdonkey\lib\site-packages (from donkeycar==3.1.2) (2.10.0)
Collecting moviepy
Downloading moviepy-1.0.3.tar.gz (388 kB)
Collecting pandas
Downloading pandas-1.0.4-cp37-cp37m-win_amd64.whl (8.7 MB)
Collecting PrettyTable
Downloading prettytable-0.7.2.tar.bz2 (21 kB)
Collecting paho-mqtt
Downloading paho-mqtt-1.5.0.tar.gz (99 kB)
Collecting matplotlib
Downloading matplotlib-3.2.1-cp37-cp37m-win_amd64.whl (9.2 MB)
Collecting idna<3,>=2.5
Downloading idna-2.9-py2.py3-none-any.whl (58 kB)
Collecting certifi>=2017.4.17
Downloading certifi-2020.4.5.2-py2.py3-none-any.whl (157 kB)
Collecting chardet<4,>=3.0.2
Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
Downloading urllib3-1.25.9-py2.py3-none-any.whl (126 kB)
Requirement already satisfied: six in c:\users\chen\workspace\vdonkey\lib\site-packages (from h5py->donkeycar==3.1.2) (1.15.0)
Requirement already satisfied: decorator<5.0,>=4.0.2 in c:\users\chen\workspace\vdonkey\lib\site-packages (from moviepy->donkeycar==3.1.2) (4.4.2)
Collecting tqdm<5.0,>=4.11.2
Downloading tqdm-4.46.1-py2.py3-none-any.whl (63 kB)
Collecting proglog<=1.0.0
Downloading proglog-0.1.9.tar.gz (10 kB)
Collecting imageio<3.0,>=2.5
Downloading imageio-2.8.0-py3-none-any.whl (3.3 MB)
Collecting imageio_ffmpeg>=0.2.0
Downloading imageio_ffmpeg-0.4.2-py3-none-win_amd64.whl (22.6 MB)
Collecting pytz>=2017.2
Downloading pytz-2020.1-py2.py3-none-any.whl (510 kB)
Requirement already satisfied: python-dateutil>=2.6.1 in c:\users\chen\workspace\vdonkey\lib\site-packages (from pandas->donkeycar==3.1.2) (2.8.1)
Collecting cycler>=0.10
Downloading cycler-0.10.0-py2.py3-none-any.whl (6.5 kB)
Collecting kiwisolver>=1.0.1
Downloading kiwisolver-1.2.0-cp37-none-win_amd64.whl (57 kB)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\users\chen\workspace\vdonkey\lib\site-packages (from matplotlib->donkeycar==3.1.2) (2.4.7)
Building wheels for collected packages: docopt, moviepy, PrettyTable, paho-mqtt, proglog
Building wheel for docopt (setup.py): started
Building wheel for docopt (setup.py): finished with status ‘done’
Created wheel for docopt: filename=docopt-0.6.2-py2.py3-none-any.whl size=13709 sha256=7f37346f718652a5e44c7b023401344170d57540af1dd847d24eb5658357ee55
Stored in directory: c:\users\chen\appdata\local\pip\cache\wheels\72\b0\3f\1d95f96ff986c7dfffe46ce2be4062f38ebd04b506c77c81b9
Building wheel for moviepy (setup.py): started
Building wheel for moviepy (setup.py): finished with status ‘done’
Created wheel for moviepy: filename=moviepy-1.0.3-py3-none-any.whl size=110732 sha256=e7e5e9f2ae522442e175fa878257d000b3a67b031380c67b71a5c8ef9e6be950
Stored in directory: c:\users\chen\appdata\local\pip\cache\wheels\56\dc\2b\9cd600d483c04af3353d66623056fc03faed76b7518faae4df
Building wheel for PrettyTable (setup.py): started
Building wheel for PrettyTable (setup.py): finished with status ‘done’
Created wheel for PrettyTable: filename=prettytable-0.7.2-py3-none-any.whl size=13704 sha256=1968f5ff94aadce077c220dd7ba4f4911bd4dc56be44198d18eff9734f402cfc
Stored in directory: c:\users\chen\appdata\local\pip\cache\wheels\8c\76\0b\eb9eb3da7e2335e3577e3f96a0ae9f74f206e26457bd1a2bc8
Building wheel for paho-mqtt (setup.py): started
Building wheel for paho-mqtt (setup.py): finished with status ‘done’
Created wheel for paho-mqtt: filename=paho_mqtt-1.5.0-py3-none-any.whl size=64726 sha256=fbbdd160b3bbc5c61be22acef953b316e2c141596a1509223c738a7a06e76e6f
Stored in directory: c:\users\chen\appdata\local\pip\cache\wheels\0d\7c\fb\05123381bd60c57ffcdc6fcc1c26e585dedee85b8c1625e2c1
Building wheel for proglog (setup.py): started
Building wheel for proglog (setup.py): finished with status ‘done’
Created wheel for proglog: filename=proglog-0.1.9-py3-none-any.whl size=6153 sha256=58ac1477ad07a26e627464abf4b493e860f7a50478fa9ebfdc74c2bdf77c3844
Stored in directory: c:\users\chen\appdata\local\pip\cache\wheels\12\36\1f\dc61e6ac10781d63cf6fa045eb09fa613a667384e12cb6e6e0
Successfully built docopt moviepy PrettyTable paho-mqtt proglog
Installing collected packages: pillow, docopt, idna, certifi, chardet, urllib3, requests, tqdm, proglog, imageio, imageio-ffmpeg, moviepy, pytz, pandas, PrettyTable, paho-mqtt, cycler, kiwisolver, matplotlib, donkeycar
Running setup.py develop for donkeycar
Successfully installed PrettyTable-0.7.2 certifi-2020.4.5.2 chardet-3.0.4 cycler-0.10.0 docopt-0.6.2 donkeycar idna-2.9 imageio-2.8.0 imageio-ffmpeg-0.4.2 kiwisolver-1.2.0 matplotlib-3.2.1 moviepy-1.0.3 paho-mqtt-1.5.0 pandas-1.0.4 pillow-7.1.2 proglog-0.1.9 pytz-2020.1 requests-2.23.0 tqdm-4.46.1 urllib3-1.25.9
C:\Users\chen\workspace
ERROR: gym-donkeycar is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with svn+, git+, hg+, or bzr+).

Collecting gym
Downloading gym-0.17.2.tar.gz (1.6 MB)
Collecting scipy
Downloading scipy-1.4.1-cp37-cp37m-win_amd64.whl (30.9 MB)
Requirement already satisfied: numpy>=1.10.4 in c:\users\chen\workspace\vdonkey\lib\site-packages (from gym) (1.18.5)
Collecting pyglet<=1.5.0,>=1.4.0
Downloading pyglet-1.5.0-py2.py3-none-any.whl (1.0 MB)

Collecting cloudpickle<1.4.0,>=1.2.0
Downloading cloudpickle-1.3.0-py2.py3-none-any.whl (26 kB)
Collecting future
Downloading future-0.18.2.tar.gz (829 kB)
Building wheels for collected packages: gym, future
Building wheel for gym (setup.py): started
Building wheel for gym (setup.py): finished with status ‘done’
Created wheel for gym: filename=gym-0.17.2-py3-none-any.whl size=1650896 sha256=91afba2ccddbe6c3da5c4591bfd108ec4dbc02c56c26ba3046cba5fbe43740e0
Stored in directory: c:\users\chen4\appdata\local\pip\cache\wheels\18\e1\58\89a2aa24e6c2cc800204fc02010612afdf200926c4d6bfe315
Building wheel for future (setup.py): started
Building wheel for future (setup.py): finished with status ‘done’
Created wheel for future: filename=future-0.18.2-py3-none-any.whl size=491062 sha256=0510f64fdcba6f631895b6cbd783b726cc1f7572cfc6c16b956df956450cfb7b
Stored in directory: c:\users\chen4\appdata\local\pip\cache\wheels\56\b0\fe\4410d17b32f1f0c3cf54cdfb2bc04d7b4b8f4ae377e2229ba0
Successfully built gym future
Installing collected packages: scipy, future, pyglet, cloudpickle, gym
Successfully installed cloudpickle-1.3.0 future-0.18.2 gym-0.17.2 pyglet-1.5.0 scipy-1.4.1
Cloning into ‘gym-donkeycar’…
Updating files: 86% (50/58)
Updating files: 87% (51/58)
Updating files: 89% (52/58)
Updating files: 91% (53/58)
Updating files: 93% (54/58)
Updating files: 94% (55/58)
Updating files: 96% (56/58)
Updating files: 98% (57/58)
Updating files: 100% (58/58)
Updating files: 100% (58/58), done.
Obtaining file:///C:/Users/chen4/workspace/gym-donkeycar
Requirement already satisfied: gym in c:\users\chen4\workspace\vdonkey\lib\site-packages (from gym-donkeycar==1.0.14) (0.17.2)
Requirement already satisfied: numpy in c:\users\chen4\workspace\vdonkey\lib\site-packages (from gym-donkeycar==1.0.14) (1.18.5)
Requirement already satisfied: pillow in c:\users\chen4\workspace\vdonkey\lib\site-packages (from gym-donkeycar==1.0.14) (7.1.2)
Collecting pytest
Downloading pytest-5.4.3-py3-none-any.whl (248 kB)
Collecting pytest-mock
Downloading pytest_mock-3.1.1-py3-none-any.whl (10 kB)
Requirement already satisfied: scipy in c:\users\chen4\workspace\vdonkey\lib\site-packages (from gym->gym-donkeycar==1.0.14) (1.4.1)
Requirement already satisfied: cloudpickle<1.4.0,>=1.2.0 in c:\users\chen4\workspace\vdonkey\lib\site-packages (from gym->gym-donkeycar==1.0.14) (1.3.0)
Requirement already satisfied: pyglet<=1.5.0,>=1.4.0 in c:\users\chen4\workspace\vdonkey\lib\site-packages (from gym->gym-donkeycar==1.0.14) (1.5.0)
Requirement already satisfied: wcwidth in c:\users\chen4\workspace\vdonkey\lib\site-packages (from pytest->gym-donkeycar==1.0.14) (0.2.4)
Collecting atomicwrites>=1.0; sys_platform == “win32”
Downloading atomicwrites-1.4.0-py2.py3-none-any.whl (6.8 kB)
Collecting more-itertools>=4.0.0
Downloading more_itertools-8.4.0-py3-none-any.whl (43 kB)
Requirement already satisfied: importlib-metadata>=0.12; python_version < “3.8” in c:\users\chen4\workspace\vdonkey\lib\site-packages (from pytest->gym-donkeycar==1.0.14) (1.6.1)
Collecting py>=1.5.0
Downloading py-1.8.2-py2.py3-none-any.whl (83 kB)
Requirement already satisfied: packaging in c:\users\chen4\workspace\vdonkey\lib\site-packages (from pytest->gym-donkeycar==1.0.14) (20.4)
Collecting pluggy<1.0,>=0.12
Downloading pluggy-0.13.1-py2.py3-none-any.whl (18 kB)
Requirement already satisfied: attrs>=17.4.0 in c:\users\chen4\workspace\vdonkey\lib\site-packages (from pytest->gym-donkeycar==1.0.14) (19.3.0)
Requirement already satisfied: colorama; sys_platform == “win32” in c:\users\chen4\workspace\vdonkey\lib\site-packages (from pytest->gym-donkeycar==1.0.14) (0.4.3)
Requirement already satisfied: future in c:\users\chen4\workspace\vdonkey\lib\site-packages (from pyglet<=1.5.0,>=1.4.0->gym->gym-donkeycar==1.0.14) (0.18.2)
Requirement already satisfied: zipp>=0.5 in c:\users\chen4\workspace\vdonkey\lib\site-packages (from importlib-metadata>=0.12; python_version < “3.8”->pytest->gym-donkeycar==1.0.14) (3.1.0)
Requirement already satisfied: six in c:\users\chen4\workspace\vdonkey\lib\site-packages (from packaging->pytest->gym-donkeycar==1.0.14) (1.15.0)
Requirement already satisfied: pyparsing>=2.0.2 in c:\users\chen4\workspace\vdonkey\lib\site-packages (from packaging->pytest->gym-donkeycar==1.0.14) (2.4.7)
Installing collected packages: atomicwrites, more-itertools, py, pluggy, pytest, pytest-mock, gym-donkeycar
Running setup.py develop for gym-donkeycar
Successfully installed atomicwrites-1.4.0 gym-donkeycar more-itertools-8.4.0 pluggy-0.13.1 py-1.8.2 pytest-5.4.3 pytest-mock-3.1.1

DonkeyWIn0:事前準備

Published by:

準備1 colab環境の設定

@ditu。jpで既に利用しているから、そのまま
下記リンクからColaboratoryを起動します。
「ノートブックの設定」ダイアログの「ハードウェアアクセラレータ」プルダウンメニューから「GPU」を選択して、「保存」を押下してください。

 

env

ローカル環境の構築で、Pythonでまず問題発生:

まず(User1)でPythonをインストールする、その際ALL USERを選びました。

コマンド操作で気が付いたが、そのアカウント(User1)名前に空白文字あり、ホームパスにも空白文字あり、これはいけないと別ユーザ(User2)を作った。しかし今度PIPが動かない問題発生。

(User1)でPythonのALL USERインストールしても、別ユーザ(User1)はPIP効かない問題あり。ここで、このユーザ(User2)専用のPythonを入れてみたが、以前のパスが効いて。PIPが依然動かない。

ここで、(User1)(User2)両方のPythonをアンインストールして、再度(User2)でPythonをインストールする、その際ALL USERを選びました。今度はPIPが動いた。

ここの繰り返しPythonインストールにより、その後仮想環境作成する際、–user つけないと、えらーになる!

さらに–user つけると、個人環境にインストールされ、パスが切ってないと警告された。

Windows環境は大変だ!!!

準備2 ローカルPCの設定

ローカル環境の設定を行います。ローカル環境の設定ではPythonの仮想環境を作成し、Jupyter Notebookをインストールします。Pythonの仮想環境はこの演習によるPCへの変更を最小限にするために利用します。

手順1. 仮想環境の作成

まずは演習用のフォルダを作り、pythonの仮想環境を作成します。以下のコマンドを実行してください。macOSの場合はターミナルから、Windowsの場合はコマンドプロンプトから作業しましょう。
–user つけないと、えらーになる
C:\Users\chen4\workspace>pip install virtualenv –user
Collecting virtualenv
Using cached https://files.pythonhosted.org/packages/f0/55/f0de23cb61f2e90db3f8362f0e685a0bc04d0c4cb159b7a96cb7c4817d63/virtualenv-20.0.23-py2.py3-none-any.whl
Collecting distlib<1,>=0.3.0 (from virtualenv)
Using cached https://files.pythonhosted.org/packages/7d/29/694a3a4d7c0e1aef76092e9167fbe372e0f7da055f5dcf4e1313ec21d96a/distlib-0.3.0.zip
Collecting six<2,>=1.9.0 (from virtualenv)
Using cached https://files.pythonhosted.org/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl
Collecting importlib-metadata<2,>=0.12; python_version < “3.8” (from virtualenv)
Using cached https://files.pythonhosted.org/packages/98/13/a1d703ec396ade42c1d33df0e1cb691a28b7c08b336a5683912c87e04cd7/importlib_metadata-1.6.1-py2.py3-none-any.whl
Collecting filelock<4,>=3.0.0 (from virtualenv)
Using cached https://files.pythonhosted.org/packages/93/83/71a2ee6158bb9f39a90c0dea1637f81d5eef866e188e1971a1b1ab01a35a/filelock-3.0.12-py3-none-any.whl
Collecting appdirs<2,>=1.4.3 (from virtualenv)
Using cached https://files.pythonhosted.org/packages/3b/00/2344469e2084fb287c2e0b57b72910309874c3245463acd6cf5e3db69324/appdirs-1.4.4-py2.py3-none-any.whl
Collecting zipp>=0.5 (from importlib-metadata<2,>=0.12; python_version < “3.8”->virtualenv)
Using cached https://files.pythonhosted.org/packages/b2/34/bfcb43cc0ba81f527bc4f40ef41ba2ff4080e047acb0586b56b3d017ace4/zipp-3.1.0-py3-none-any.whl
Installing collected packages: distlib, six, zipp, importlib-metadata, filelock, appdirs, virtualenv
Running setup.py install for distlib … done
WARNING: The script virtualenv.exe is installed in ‘C:\Users\chen4\AppData\Roaming\Python\Python37\Scripts’ which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use –no-warn-script-location.
Successfully installed appdirs-1.4.4 distlib-0.3.0 filelock-3.0.12 importlib-metadata-1.6.1 six-1.15.0 virtualenv-20.0.23 zipp-3.1.0
WARNING: You are using pip version 19.2.3, however version 20.1.1 is available.
You should consider upgrading via the ‘python -m pip install –upgrade pip’ command.
C:\Users\chen4\workspace>
virtualenvは個人環境にインストールされ、パスが切ってないと警告された。
早速次の仮想環境作成から、コマンドみつからないといわれた。
パスが切る面倒だから、絶対パスで行きます。
C:\Users\chen4\workspace>virtualenv vdonkey
‘virtualenv’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。
C:\Users\chen4\workspace>C:\Users\chen4\AppData\Roaming\Python\Python37\Scripts\virtualenv.exe vdonkey
created virtual environment CPython3.7.7.final.0-64 in 6061ms
creator CPython3Windows(dest=C:\Users\chen4\workspace\vdonkey, clear=False, global=False)
seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=C:\Users\chen4\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1)
activators BashActivator,BatchActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
C:\Users\chen4\workspace>

手順2. 仮想環境のアクティベーション★

作成したPythonの仮想環境で作業ができるように設定を行います。以下のコマンドを実行すると、仮想環境が利用できます。
C:\Users\chen4\workspace>vdonkey¥Scripts¥activate.bat
‘vdonkey¥Scripts¥activate.bat’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。
Windows環境のパスは、\ で区切ります。しかし日本語環境は、\ は、¥と表示される場合のあります。
どれが正しいかわかりにくいので、Tabの補正機能を利用したら上手くできました。
C:\Users\chen4\workspace>vdonkey\Scripts\activate
(vdonkey) C:\Users\chen4\workspace>

手順3. Jupyter Notebookのインストール

続いて、Jupyter Notebookをインストールします。仮想環境を利用可能にしたターミナル上で以下のコマンドを実行してください。実行前に必ず、先頭が(vdonkey)になっていることを確認してください。
(vdonkey) C:\Users\chen4\workspace>pip install jupyter jupyter_http_over_ws
Collecting jupyter
Downloading jupyter-1.0.0-py2.py3-none-any.whl (2.7 kB)
Collecting jupyter_http_over_ws
Downloading jupyter_http_over_ws-0.0.8-py2.py3-none-any.whl (18 kB)
Collecting qtconsole
Downloading qtconsole-4.7.4-py2.py3-none-any.whl (118 kB)
|████████████████████████████████| 118 kB 3.2 MB/s
Collecting ipykernel
Downloading ipykernel-5.3.0-py3-none-any.whl (119 kB)
|████████████████████████████████| 119 kB 6.4 MB/s
Collecting notebook
Downloading notebook-6.0.3-py3-none-any.whl (9.7 MB)
|████████████████████████████████| 9.7 MB 930 kB/s
Collecting nbconvert
Downloading nbconvert-5.6.1-py2.py3-none-any.whl (455 kB)
|████████████████████████████████| 455 kB 6.4 MB/s
Collecting jupyter-console
Downloading jupyter_console-6.1.0-py2.py3-none-any.whl (21 kB)
Collecting ipywidgets
Downloading ipywidgets-7.5.1-py2.py3-none-any.whl (121 kB)
|████████████████████████████████| 121 kB 6.8 MB/s
Collecting six>=1.6.0
Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting tornado>=4.5
Downloading tornado-6.0.4-cp37-cp37m-win_amd64.whl (417 kB)
|████████████████████████████████| 417 kB 3.3 MB/s
Collecting ipython-genutils
Downloading ipython_genutils-0.2.0-py2.py3-none-any.whl (26 kB)
Collecting jupyter-core
Downloading jupyter_core-4.6.3-py2.py3-none-any.whl (83 kB)
|████████████████████████████████| 83 kB 725 kB/s
Collecting traitlets
Downloading traitlets-4.3.3-py2.py3-none-any.whl (75 kB)
|████████████████████████████████| 75 kB 5.1 MB/s
Collecting pyzmq>=17.1
Downloading pyzmq-19.0.1-cp37-cp37m-win_amd64.whl (1.1 MB)
|████████████████████████████████| 1.1 MB 6.4 MB/s
Collecting qtpy
Downloading QtPy-1.9.0-py2.py3-none-any.whl (54 kB)
|████████████████████████████████| 54 kB 4.1 MB/s
Collecting pygments
Downloading Pygments-2.6.1-py3-none-any.whl (914 kB)
|████████████████████████████████| 914 kB 6.4 MB/s
Collecting jupyter-client>=4.1
Downloading jupyter_client-6.1.3-py3-none-any.whl (106 kB)
|████████████████████████████████| 106 kB 6.4 MB/s
Collecting ipython>=5.0.0
Downloading ipython-7.15.0-py3-none-any.whl (783 kB)
|████████████████████████████████| 783 kB 3.3 MB/s
Collecting prometheus-client
Downloading prometheus_client-0.8.0-py2.py3-none-any.whl (53 kB)
|████████████████████████████████| 53 kB 3.8 MB/s
Collecting terminado>=0.8.1
Downloading terminado-0.8.3-py2.py3-none-any.whl (33 kB)
Collecting Send2Trash
Downloading Send2Trash-1.5.0-py3-none-any.whl (12 kB)
Collecting nbformat
Downloading nbformat-5.0.7-py3-none-any.whl (170 kB)
|████████████████████████████████| 170 kB 6.4 MB/s
Collecting jinja2
Downloading Jinja2-2.11.2-py2.py3-none-any.whl (125 kB)
|████████████████████████████████| 125 kB 6.4 MB/s
Collecting bleach
Downloading bleach-3.1.5-py2.py3-none-any.whl (151 kB)
|████████████████████████████████| 151 kB 6.8 MB/s
Collecting mistune<2,>=0.8.1
Downloading mistune-0.8.4-py2.py3-none-any.whl (16 kB)
Collecting entrypoints>=0.2.2
Downloading entrypoints-0.3-py2.py3-none-any.whl (11 kB)
Collecting defusedxml
Downloading defusedxml-0.6.0-py2.py3-none-any.whl (23 kB)
Collecting testpath
Downloading testpath-0.4.4-py2.py3-none-any.whl (163 kB)
|████████████████████████████████| 163 kB 3.3 MB/s
Collecting pandocfilters>=1.4.1
Downloading pandocfilters-1.4.2.tar.gz (14 kB)
Collecting prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0
Downloading prompt_toolkit-3.0.5-py3-none-any.whl (351 kB)
|████████████████████████████████| 351 kB 6.8 MB/s
Collecting widgetsnbextension~=3.5.0
Downloading widgetsnbextension-3.5.1-py2.py3-none-any.whl (2.2 MB)
|████████████████████████████████| 2.2 MB …
Collecting pywin32>=1.0; sys_platform == “win32”
Downloading pywin32-228-cp37-cp37m-win_amd64.whl (9.1 MB)
|████████████████████████████████| 9.1 MB 6.4 MB/s
Collecting decorator
Downloading decorator-4.4.2-py2.py3-none-any.whl (9.2 kB)
Collecting python-dateutil>=2.1
Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
|████████████████████████████████| 227 kB 6.8 MB/s
Collecting jedi>=0.10
Downloading jedi-0.17.0-py2.py3-none-any.whl (1.1 MB)
|████████████████████████████████| 1.1 MB 1.3 MB/s
Collecting backcall
Downloading backcall-0.2.0-py2.py3-none-any.whl (11 kB)
Collecting colorama; sys_platform == “win32”
Downloading colorama-0.4.3-py2.py3-none-any.whl (15 kB)
Collecting pickleshare
Downloading pickleshare-0.7.5-py2.py3-none-any.whl (6.9 kB)
Requirement already satisfied: setuptools>=18.5 in c:\users\chen4\workspace\vdonkey\lib\site-packages (from ipython>=5.0.0->ipykernel->jupyter) (47.1.1)
Collecting pywinpty>=0.5; os_name == “nt”
Downloading pywinpty-0.5.7-cp37-cp37m-win_amd64.whl (1.3 MB)
|████████████████████████████████| 1.3 MB 6.8 MB/s
Collecting jsonschema!=2.5.0,>=2.4
Downloading jsonschema-3.2.0-py2.py3-none-any.whl (56 kB)
|████████████████████████████████| 56 kB 3.8 MB/s
Collecting MarkupSafe>=0.23
Downloading MarkupSafe-1.1.1-cp37-cp37m-win_amd64.whl (16 kB)
Collecting packaging
Downloading packaging-20.4-py2.py3-none-any.whl (37 kB)
Collecting webencodings
Downloading webencodings-0.5.1-py2.py3-none-any.whl (11 kB)
Collecting wcwidth
Downloading wcwidth-0.2.4-py2.py3-none-any.whl (30 kB)
Collecting parso>=0.7.0
Downloading parso-0.7.0-py2.py3-none-any.whl (100 kB)
|████████████████████████████████| 100 kB 2.9 MB/s
Collecting attrs>=17.4.0
Downloading attrs-19.3.0-py2.py3-none-any.whl (39 kB)
Collecting pyrsistent>=0.14.0
Downloading pyrsistent-0.16.0.tar.gz (108 kB)
|████████████████████████████████| 108 kB 6.4 MB/s
Collecting importlib-metadata; python_version < “3.8”
Using cached importlib_metadata-1.6.1-py2.py3-none-any.whl (31 kB)
Collecting pyparsing>=2.0.2
Downloading pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
|████████████████████████████████| 67 kB 2.8 MB/s
Collecting zipp>=0.5
Using cached zipp-3.1.0-py3-none-any.whl (4.9 kB)
Building wheels for collected packages: pandocfilters, pyrsistent
Building wheel for pandocfilters (setup.py) … done
Created wheel for pandocfilters: filename=pandocfilters-1.4.2-py3-none-any.whl size=7860 sha256=905d1fa5a505fc46ddebf9d21b30e3c901238f16469902575cf298cb8441ba38
Stored in directory: c:\users\chen4\appdata\local\pip\cache\wheels\63\99\01\9fe785b86d1e091a6b2a61e06ddb3d8eb1bc9acae5933d4740
Building wheel for pyrsistent (setup.py) … done
Created wheel for pyrsistent: filename=pyrsistent-0.16.0-cp37-cp37m-win_amd64.whl size=71040 sha256=a24a2a1890c86ceacf2c18f2bb42b42f9fbec785be1e4945dffebaa81a2ab501
Stored in directory: c:\users\chen4\appdata\local\pip\cache\wheels\22\52\11\f0920f95c23ed7d2d0b05f2b7b2f4509e87a20cfe8ea43d987
Successfully built pandocfilters pyrsistent
Installing collected packages: ipython-genutils, pywin32, six, decorator, traitlets, jupyter-core, pyzmq, qtpy, pygments, tornado, python-dateutil, jupyter-client, parso, jedi, backcall, colorama, pickleshare, wcwidth, prompt-toolkit, ipython, ipykernel, qtconsole, prometheus-client, pywinpty, terminado, pyparsing, packaging, webencodings, bleach, MarkupSafe, jinja2, mistune, attrs, pyrsistent, zipp, importlib-metadata, jsonschema, nbformat, entrypoints, defusedxml, testpath, pandocfilters, nbconvert, Send2Trash, notebook, jupyter-console, widgetsnbextension, ipywidgets, jupyter, jupyter-http-over-ws
Successfully installed MarkupSafe-1.1.1 Send2Trash-1.5.0 attrs-19.3.0 backcall-0.2.0 bleach-3.1.5 colorama-0.4.3 decorator-4.4.2 defusedxml-0.6.0 entrypoints-0.3 importlib-metadata-1.6.1 ipykernel-5.3.0 ipython-7.15.0 ipython-genutils-0.2.0 ipywidgets-7.5.1 jedi-0.17.0 jinja2-2.11.2 jsonschema-3.2.0 jupyter-1.0.0 jupyter-client-6.1.3 jupyter-console-6.1.0 jupyter-core-4.6.3 jupyter-http-over-ws-0.0.8 mistune-0.8.4 nbconvert-5.6.1 nbformat-5.0.7 notebook-6.0.3 packaging-20.4 pandocfilters-1.4.2 parso-0.7.0 pickleshare-0.7.5 prometheus-client-0.8.0 prompt-toolkit-3.0.5 pygments-2.6.1 pyparsing-2.4.7 pyrsistent-0.16.0 python-dateutil-2.8.1 pywin32-228 pywinpty-0.5.7 pyzmq-19.0.1 qtconsole-4.7.4 qtpy-1.9.0 six-1.15.0 terminado-0.8.3 testpath-0.4.4 tornado-6.0.4 traitlets-4.3.3 wcwidth-0.2.4 webencodings-0.5.1 widgetsnbextension-3.5.1 zipp-3.1.0

手順4. Jupyter Notebookの起動★

次のコマンドを実行してJupyter Notebookを起動します。
(vdonkey) C:\Users\chen4\workspace>jupyter serverextension enable –py jupyter_http_over_ws
Enabling: jupyter_http_over_ws
– Writing config: C:\Users\chen4\.jupyter
– Validating…
jupyter_http_over_ws 0.0.7 ok
(vdonkey) C:\Users\chen4\workspace>

準備3 colab環境とローカル環境の切り替え