前言:在windows下配置Donkey Car的上位机:
1 安装miniconda Python
Conda是开源的管理系统,Miniconda是conda的开源最小安装。
Donkey的默认安装版本,3.7,Miniconda已经是
最新的版本,是3.10.8吧,不知道兼容情况如何?
2 配置项目的编译:
2.1 确认git在conda下面是否安装了
mkdir Franklinprojects
cd Franklinprojects
2.2 克隆donkeycar
2.2.1 拿到一个最新的稳定的版本
git clone https://github.com/autorope/donkeycar
cd donkeycar
git fetch --all --tags -f
git checkout tags/4.4.0
(base) D:\FranklinDonkeyPrj\donkeycar>git fetch --all --tags -f
Fetching origin(base) D:\FranklinDonkeyPrj\donkeycar>git checkout tags/4.4.0
Note: switching to 'tags/4.4.0'.You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at 022df76 Update version to 4.4.0
2.2.2 配置python anaconda 环境:
一定要在刚才新建的文件夹下进行配置:
【案,所有的配置在anaconda的命令行里面执行】
例如:
(base) D:\FranklinDonkeyPrj\donkeycar>
【否则,错误1】
(base) D:\FranklinDonkeyPrj\donkeycar>git fetch --all --tags -f
Fetching origin
fatal: unable to access 'https://github.com/autorope/donkeycar/': OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054
error: Could not fetch origin
conda env create -f install\envs\windows.yml
->keras-vis==0.5.0->-r D:\FranklinDonkeyPrj\donkeycar\install\envs\condaenv.ht4cidl2.requirements.txt (line 1)) (3.10.0.2)
Building wheels for collected packages: keras-vis
Building wheel for keras-vis (setup.py): started
Building wheel for keras-vis (setup.py): finished with status 'done'
Created wheel for keras-vis: filename=keras_vis-0.5.0-py2.py3-none-any.whl size=31234 sha256=079bd824c4785f1d5e76d749dea708ae7b385bf7e9bd926ad974ce60566b4535
Stored in directory: C:\Users\frank_sj\AppData\Local\Temp\pip-ephem-wheel-cache-bc68y7ig\wheels\35\94\58\fb9de29ebb6305a7f828e0605902f66f5425c17ed6b4c18e66
Successfully built keras-vis
Installing collected packages: simple-pid, opencv-python-headless, keras-vis
Successfully installed keras-vis-0.5.0 opencv-python-headless-4.6.0.66 simple-pid-1.0.1
conda activate donkey
pip install --user tensorflow==2.2.0
【错误2:找不到tensorflow版本】【原因是用了科学上网】
(donkey) D:\FranklinDonkeyPrj\donkeycar>pip install --user tensorflow==2.2.0
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/tensorflow/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/tensorflow/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/tensorflow/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/tensorflow/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/tensorflow/
ERROR: Could not find a version that satisfies the requirement tensorflow==2.2.0 (from versions: none)
ERROR: No matching distribution found for tensorflow==2.2.0
把科学上网禁用后,
Installing collected packages: tensorflow-estimator, termcolor, scipy, opt-einsum, keras-preprocessing, h5py, google-pasta, gast, astunparse, google-auth, tensorboard, tensorflow
WARNING: The script tensorboard.exe is installed in 'C:\Users\frank_sj\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.
WARNING: The scripts estimator_ckpt_converter.exe, saved_model_cli.exe, tensorboard.exe, tf_upgrade_v2.exe, tflite_convert.exe, toco.exe and toco_from_protos.exe are installed in 'C:\Users\frank_sj\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.
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
pytorch-lightning 1.5.10 requires pyDeprecate==0.3.1, but you have pydeprecate 0.3.2 which is incompatible.
pytorch-lightning 1.5.10 requires setuptools==59.5.0, but you have setuptools 58.0.4 which is incompatible.
Successfully installed astunparse-1.6.3 gast-0.3.3 google-auth-1.35.0 google-pasta-0.2.0 h5py-2.10.0 keras-preprocessing-1.1.2 opt-einsum-3.3.0 scipy-1.4.1 tensorboard-2.2.2 tensorflow-2.2.0 tensorflow-estimator-2.2.0 termcolor-2.1.1
【案,应该是pytorch有版本冲突,anyway,tensorflow应该是装好】
pip install -e .[pc]
2.2.3 安装GPU支持,如果有的话
先验证安装的版本:
C:\Users\frank_sj>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Mon_Oct_24_19:40:05_Pacific_Daylight_Time_2022
Cuda compilation tools, release 12.0, V12.0.76
Build cuda_12.0.r12.0/compiler.31968024_0
2.2.3.1 如果有NVidia Card,安装一下:
pip install tensorflow-gpu==2.2.0
配置好你的PC上的CUDA版本
2.2.3.2 [可选]配置PyTorch to use GPU
conda install cudatoolkit=<CUDA Version> -c pytorch
【案,报错,在清华镜像无法找到最新的CUDA的tools的配置版本】
(donkey) D:\FranklinDonkeyPrj\donkeycar>conda install cudatoolkit=12.0 -c pytorch
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.PackagesNotFoundError: The following packages are not available from current channels:
- cudatoolkit=12.0
Current channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/noarch
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/win-64
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/noarch
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2/win-64
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2/noarchTo search for alternate channels that may provide the conda package you're
looking for, navigate tohttps://anaconda.org
and use the search bar at the top of the page.
【案,我们去PYTORCH官网,看一下配置的最新版本】
PyTorch
【案,最高版本应该是11.7,所以,我们如果装了最新的12.0,那么,应该是没有这个源的】
(donkey) D:\FranklinDonkeyPrj\donkeycar>conda install cudatoolkit=11.0 -c pytorch
Collecting package metadata (current_repodata.json): done
Solving environment
【案, 虽然我们装的版本是11.2,但是,如果,填入11.2,是会出错的。看起来这里要填整数】
(donkey) D:\FranklinDonkeyPrj\donkeycar>conda install cudatoolkit=11.0 -c pytorch
Collecting package metadata (current_repodata.json): done
Solving environment: done# All requested packages already installed.
2.2.4 创立本地工作目录:
(donkey) D:\FranklinDonkeyPrj\donkeycar>donkey createcar --path ../FrankCar
________ ______ _________
___ __ \_______________ /___________ __ __ ____/_____ ________
__ / / / __ \_ __ \_ //_/ _ \_ / / / _ / _ __ `/_ ___/
_ /_/ // /_/ / / / / ,< / __/ /_/ / / /___ / /_/ /_ /
/_____/ \____//_/ /_//_/|_| \___/_\__, / \____/ \__,_/ /_/
/____/
using donkey v4.4.0 ...
Creating car folder: ../FrankCar
making dir ../FrankCar
Creating data & model folders.
making dir ../FrankCar\models
making dir ../FrankCar\data
making dir ../FrankCar\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 calibrate script. Adjust these before starting your car.
Copying my car config overrides
Donkey setup complete.
【注意】
Note: After closing the Anaconda Prompt, when you open it again, you will need to type conda activate donkey
to re-enable the mappings to donkey specific Python libraries
如果退出了conda的命令行窗口,需要从小键入:
conda activate donkey
参考:
Windows - Donkey Car