8631| 11
|
[漂移驴车项目] Mac OS X 端驴车环境配置指南 |
本帖最后由 yoyojacky 于 2021-11-5 18:31 编辑 0x00 前言 今天, 为了配置 Mac OS X 的驴车环境,真的是用了大半天时间, 在操作的过程中虽然录像了.但是遇到各种问题一直安装不成功,直到最后人都走了, 在不懈的努力下,终于安装成功.下面总结一下安装配置的步骤及注意的细节. 0x01 Mac OS X 配置驴车环境步骤快速查询表 在最开始,打开一个终端,创建整个项目的核心目录:
然后下载 miniconda3 python3.7 64bit 的安装包: https://docs.conda.io/en/latest/miniconda.html 注意版本即可,我选择的是 pkg 的包,安装过程中可能会遇到无法安装的问题,请选择自己的磁盘并找到安装路径. 默认情况下, Mac 上应该有 git 工具,如果没有请去这里下载 : https://www.atlassian.com/git/tutorials/install-git 并安装,也可以在终端中使用: 来进行安装, 确保系统包含 miniconda 和 git 的环境后.进入 donkey-projects 目录,这里是前面创建的目录, 我将miniconda 安装在这个目录里面. 为了方便调用 conda 的命令,我在临时的环境变量里面添加了,minicomda3中 bin 目录的路径到系统环境变量中:
然后创建一个项目目录并进入进去. 下载驴车最新的 4.2.1 的仓库, 由于默认驴车的项目是放在 github 上,国内访问不方便,因此我将其拉到了码云的平台上,内容和官方的一样的.直接通过下面的命令拉到本地即可. 官方说明里面是建议大家利用 git checkout master 切换的主分支,实际上我们拉下来的环境就在主分支上,执行不执行都可以,安全起见,切换到主分支.进入仓库后先更新一下 conda 的本地源,然后执行更新和环境搭建就应该会稍快一些. 然后最后设置: 接着,确认自己在 donkeycar 目录中并执行下面两条命令: 创建 Python Miniconda 的虚拟环境并激活 donkey虚拟环境,这一步是最耗时的,很容易出现卡住没有相应的感觉,耐心,耐心,耐心尝试.肯定能成功的. PS: 我临时指定了清华源进行安装,速度快了很多,并且因为我使用 ZSH 的 shell,因此在执行最后一条命令的时候需要转义一下方括号的符号: 分别转义\[ 和 \].安装完成后,会提示你可以使用 conda activate donkey 进入虚拟环境,并通过 conda deactivate 退出虚拟环境. 一般在 windows 主机上可能会开始安装 tensorflow-gpu 支持, 但是 mac 上就不用了. 目前,在 mac 上没有对Nvidia GPU 的支持... 所以下一步就直接创建你的驴车目录看看是否能成功. 我在执行的过程中全程都在 donkeycar 的目录中,完成后,我的 mycar 驴车项目会在 donkey-projects/projects/mycar 中, 由于我已经创建过一次了,因此,我重新创建了一个 mynewcar 的项目,如下图:一旦出现同样的图示,说明你成功安装好了 donkeycar 的环境. 0x02 gym-donkeycar donkycar 的模拟器 为了方便我们训练模型,你需要先下载一个通过 unity 游戏引擎构建的驴车模拟器,不同的系统使用的模拟器不一样. 然后根据自己的操作系统选择: 我是 mac 所以选择 DonkeySimMac.zip, 由于比较大, 380MB,还有 windows 版本的,还有一堆大家难以下载又特别大的,都放到百度云盘了: 并且连接永久有效: 需要的去下载后解压到你的 projects 目录中,当前我是 Mac OS X,因此需要简单配置一下权限:点击苹果图标-> 系统偏好设置-> 隐私设置 就在我红色框框的位置应该看到一个被拒绝的应用.我这里复现不了,知道哪里调就好. 一般情况下,第一次下载的应用在苹果上第一次运行的时候需要你去这里信任并放行,不然会打不开. 坚持一下,马上就可以结束配置了这里直接先从我克隆的 gym-donkeycar 仓库然后激活 donkey 并安装需要的依赖文件: 正常完成后,再来两步就可以尝试你的模拟器了,再忍忍. 然后打开 myconfig.py, 用 vim 打开并直接输入冒号:295 直接就定位到需要修改的位置了.去掉配置前面的#号,并将 False 改为 True, 将前面拷贝的 DonkeySimMac 的完整路径加入,保存退出.
接下来就是尝试开开车.感受一下: 命令行输入: 等待弹出窗口选择车道,然后选择用户模式,油门 15%(最大油门), 控制选择 joystick, 然后就可以打开浏览器的:http://localhost:8887/drive 开始开车了!!!先开始练习练习,然后就可以进行行车记录,并在 data 目录生成数据,后续的训练简单的操作可以看官方说明或者看视频: 会议录像来喽,有全程字幕,可以下载,方便大家查看[呲牙] |
会议主题:漂移驴车-车友会 会议时间:2021/10/30-2022/03/12 10:00-12:00(GMT+08:00) 中国标准时间 - 北京, 每周 (周六) 点击链接入会,或添加至会议列表: https://meeting.tencent.com/dm/pqQjdxlVEG2h 会议 ID:423 9700 5680 【议题】 1. 漂移驴车项目愿景-5'-全体召集人 2. 车队章程与车手公约-5'-Rockets 3. 驴车活动运营规划-5'-昊男 4. 技术工坊-基本硬件知识与PC端环境搭建交流(上)-50'-Jacky 5. 技术工坊-PC端环境搭建交流(下)-50'-Jacky 6. 自由交流与合影截图-5'-全体车友 7. 完美收官... |
注意运行到 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/cloud/pytorch/ 再往后运行 yes | conda update -n base -c defaults conda 会提出warning Collecting package metadata (current_repodata.json): failed channels https://mirrors.tuna.tsinghua.edu.cn/cloud/pytorch/ UnavailableInvalidChannel: The channel is not accessible or is invalid. channel name: cloud/pytorch channel url: https://mirrors.tuna.tsinghua.edu.cn/cloud/pytorch error code: 404 这个项目不需要pytorch,在漂移君和撒哈拉大野牛的指导下,remove这个源。 conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/cloud/pytorch/ 再次运行 yes | conda update -n base -c defaults conda 没有warning了。 |
在执行这步的时候,长时间卡死 然后找到mac.yml文件,根据里面的依赖,一个一个单独的进行安装。
发现最终mac m1下出现的问题,总结如下torchaudio、TensorFlow=2.2.0、opencv-python-headless,三个装不上去 需要想办法安装上这些内容,才可以继续进行下去。 |
本帖最后由 微笑的rockets 于 2021-11-4 11:55 编辑 微笑的rockets 发表于 2021-11-4 11:21 这些库,我尝试用
安装完成 |
conda env create -f install/envs/mac.yml Collecting package metadata (repodata.json): done Solving environment: done Preparing transaction: done Verifying transaction: done Executing transaction: done Installing pip dependencies: | - / / \ / | \-| | Ran pip subprocess with arguments: ['/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/bin/python', '-m', 'pip', 'install', '-U', '-r', '/Volumes/T100/projects/donkeycar/install/envs/condaenv.fgi6cskg.requirements.txt'] Pip subprocess output: Collecting git+https://github.com/autorope/keras-vis.git (from -r /Volumes/T100/projects/donkeycar/install/envs/condaenv.fgi6cskg.requirements.txt (line 2)) Cloning https://github.com/autorope/keras-vis.git to /private/var/folders/f2/zn0sgy313vz3yymlls0ysdr80000gn/T/pip-req-build-za7hk8ll Resolved https://github.com/autorope/keras-vis.git to commit 3d9d61728312f278a62cbe6b3f9ae92eb4c51520 Collecting tensorflow==2.2.0 Downloading tensorflow-2.2.0-cp37-cp37m-macosx_10_11_x86_64.whl (175.3 MB) Pip subprocess error: Running command git clone -q https://github.com/autorope/keras-vis.git /private/var/folders/f2/zn0sgy313vz3yymlls0ysdr80000gn/T/pip-req-build-za7hk8ll ERROR: Exception: Traceback (most recent call last): File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 438, in _error_catcher yield File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 519, in read data = self._fp.read(amt) if not fp_closed else b"" File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 62, in read data = self.__fp.read(amt) File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/http/client.py", line 465, in read n = self.readinto(b) File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/http/client.py", line 509, in readinto n = self.fp.readinto(b) File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/socket.py", line 589, in readinto return self._sock.recv_into(b) File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/ssl.py", line 1071, in recv_into return self.read(nbytes, buffer) File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/ssl.py", line 929, in read return self._sslobj.read(len, buffer) socket.timeout: The read operation timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 173, in _main status = self.run(options, args) File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 203, in wrapper return func(self, options, args) File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 316, in run reqs, check_supported_wheels=not options.target_dir File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 95, in resolve collected.requirements, max_rounds=try_to_avoid_resolution_too_deep File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 472, in resolve state = resolution.resolve(requirements, max_rounds=max_rounds) File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 341, in resolve self._add_to_criteria(self.state.criteria, r, parent=None) File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 172, in _add_to_criteria if not criterion.candidates: File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_vendor/resolvelib/structs.py", line 151, in __bool__ return bool(self._sequence) File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 140, in __bool__ return any(self) File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 128, in <genexpr> return (c for c in iterator if id(c) not in self._incompatible_ids) File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 32, in _iter_built candidate = func() File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 209, in _make_candidate_from_link version=version, File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 301, in __init__ version=version, File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 156, in __init__ self.dist = self._prepare() File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 227, in _prepare dist = self._prepare_distribution() File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 306, in _prepare_distribution self._ireq, parallel_builds=True File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 508, in prepare_linked_requirement return self._prepare_linked_requirement(req, parallel_builds) File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 552, in _prepare_linked_requirement self.download_dir, hashes File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 243, in unpack_url hashes=hashes, File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 102, in get_http_url from_path, content_type = download(link, temp_dir.path) File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_internal/network/download.py", line 145, in __call__ for chunk in chunks: File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_internal/cli/progress_bars.py", line 144, in iter for x in it: File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_internal/network/utils.py", line 87, in response_chunks decode_content=False, File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 576, in stream data = self.read(amt=amt, decode_content=decode_content) File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 541, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/volumes/T100/miniconda3/Volumes/T100/miniconda3/envs/donkey/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 443, in _error_catcher raise ReadTimeoutError(self._pool, None, "Read timed out.") pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. failed CondaEnvException: Pip failed |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed