Anaconda環境遷移
anaconda base 3.7.4
mujoco-py環境還沒有配置安裝mujoco-py因為注冊表的原因
flow環境安裝還有問題:已解決

tf-keras-rl
pip安裝所需包時,出現錯誤
好像是pillow的問題,已解決。更換了一下安裝順序,把pillow最后安裝
遷移方法與步驟
-
安裝Jetbrain toolbox,然后更改安裝位置,安裝pycharm
-
安裝anaconda,下載anaconda的包,bash安裝
-
原環境備份導出:
# 激活將導出的環境 conda activate environment # 將原有服務器上面的環境導出 conda env export > environment.yaml # 導出pip安裝的包 pip freeze > requirement.txt
-
目標機執行導入環境操作:
conda env create -f environment.yaml # 進入新建的環境 conda activate environment pip install -r requirement.txt
-
檢查tensorflow環境,pytorch環境,GPU,cuda等是否安裝
python import tensorflow as tf tf.test.is_built_with_cuda() tf.test.is_gpu_available() # 目前返回False說明還存在問題
-
-
安裝下載Flow
-
使用google Chrome,並且配置FQ插件
-
搜狗輸入法安裝,記得把搜狗輸入法置於第二位,不會顯示亂碼
SUMO安裝
-
根據flow的安裝教程安裝flow與sumo:https://github.com/flow-project/flow/blob/master/docs/source/flow_setup.rst#optional-direct-install-of-sumo-from-github
-
sumo安裝出現問題:
(base) ubuntu@host-192-168-96-5:~/data/sumo$ sudo apt-get install proj libtool libgdal1-dev libxerces-c2-dev libfox-1.6-0 libfox-1.6-dev sudo: unable to resolve host host-192-168-96-5 Reading package lists... Done Building dependency tree Reading state information... Done Package libxerces-c2-dev is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source Package proj is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'proj' has no installation candidate E: Package 'libxerces-c2-dev' has no installation candidate
(Optional) Direct install of SUMO from GitHub
The below commands walk you through installing and building SUMO locally. Note that if this does not work, you are recommended to point an issue on the flow-dev message board or refer to SUMO's documentation regarding installing their software.
We begin by downloading SUMO's github directory:
cd ~ git clone https://github.com/eclipse/sumo.git cd sumo git checkout 2147d155b1 make -f Makefile.cvs
If you have Ubuntu 14.04+, run the following command
./configure make -j$nproc echo 'export SUMO_HOME="$HOME/sumo"' >> ~/.bashrc echo 'export PATH="$HOME/sumo/bin:$PATH"' >> ~/.bashrc echo 'export PYTHONPATH="$HOME/sumo/tools:$PYTHONPATH"' >> ~/.bashrc source ~/.bashrc
按照上面教程走到./configure之后出現錯誤:
Optional features summary ------------------------- Enabled: PROJ GDAL GUI Disabled: Debug Profiling Coverage PIC UnitTests Python OSG ffmpeg
不用去管上述的錯誤,直接進行。要注意的是安裝apt-get依賴的時候要根據第四個教程的ubuntu14.04的,而不是12.04的.。然后后續安裝按照flow的教程
主要根據第四份的教程
git checkout 2147d155b1 297 make -f Makefile.cvs 298 ./configure 299 sudo apt-get install autoconf 300 sudo apt-get install proj libtool libgdal1-dev libxerces-c2-dev libfox-1.6-0 libfox-1.6-dev 301 sudo ./configure --with-fox-includes=/usr/include/fox-1.6 --with-gdal-includes=/usr/include/gdal --with-proj-libraries=/usr/lib --with-gdal-libraries=/usr --with-proj-gdal 302 sudo apt-get install autoconf 303 sudo apt-get install libproj-dev proj-bin proj-data libtool libgdal1-dev libxerces-c3-dev libfox-1.6-0 libfox-1.6-dev 304 cd /usr/lib 305 sudo ln -s libgdal1.7.0.so libgdal.so 306 sudo ln -s libproj.so.0.7.0 proj-lib.so 309 cd ~ 310 cd sumo 311 cd data 312 cd sumo 313 sudo aclocal 314 sudo automake 315 sudo automake --add-missing 316 sudo ./configure --with-fox-includes=/usr/include/fox-1.6 --with-gdal-includes=/usr/include/gdal --with-proj-libraries=/usr/lib --with-gdal-libraries=/usr --with-proj-gdal 317 sudo make -j$nproc 318 echo 'export SUMO_HOME="/home/ubuntu/data/sumo"' >> ~/.bashrc 319 echo 'export PATH="/home/ubuntu/data/sumo/bin:$PATH"' >> ~/.bashrc 320 echo 'export PYTHONPATH="/home/ubuntu/data/sumo/tools:$PYTHONPATH"' >> ~/.bashrc 321 source ~/.bashrc 322 sumo-gui 323 sumo 324 echo $SUMO_HOME 325 (base) ubuntu@host-192-168-96-5:~/data/sumo$
用上述方法就不需要移動sumo文件到處都是,就在data/sumo下面,這樣就比較清晰
要使用pycharm還要設置環境變量SUMO_HOME和添加tools:
安裝完成后:確保sumo-*下有四個文件夾--未必
而且在終端命令行輸入sumo或者sumo-gui都可以執行
最后更改環境變量gedit ~/.bashrc source ~/.bashrc -
如果使用的是pycharm編譯器,需要更改edit Configurations與Project Structure
Edit Configurations:RUN下面,是添加SUMO_HOME環境變量,即sumo-*所在的位置Project Structure:添加sumo下的tools文件夾路徑。file ->settings ->project ->project structure ->Add Content Root ->選擇sumo的tools文件夾路徑 ->ok
-
或者從終端啟用Pycharm
具體原因來自於PyCharm ignoring LD_LIBRARY_PATH from .bashrc
升級至sumo-1.6.0
sumo 1.1.0之后的版本不支持上述方式安裝了,只能使用https://sumo.dlr.de/docs/Installing/Linux_Build.html安裝,但是不能與其他版本共存,於是先不升級。sumo1.1之后的版本更好安裝了。
按照教程來吧,網址如下喲:
讓我們開始吧~
hold on,如果你已經安裝過sumo,需要先卸載舊的版本哦。如果你從未裝過sumo,跳過卸載的步驟。
卸載sumo,分兩種類型
1)若是apt-get 安裝,則直接apt-get remove
sudo apt-get remove sumo
sudo apt-get remove sumo-tools
sudo apt-get remove sumo-docs
2)若是make install編譯安裝,則
參考: https://stackoverflow.com/questions/36256049/uninstall-sumo-0-22
試試下面三種方法
i)在sudo make install的目錄下執行:sudo make uninstall
ii)如果你找不到安裝目錄啦,去/usr/local/bin刪除下面的文件
cd /usr/local/bin
sudo rm activitygen dfrouter emissionsDrivingCycle jtrrouter marouter od2trips sumo-gui TraCITestClient duarouter emissionsMap netconvert netgenerate polyconvert sumo
iii)如果你還能找到安裝目錄,進入sumo的bin文件目錄,刪除下面的文件
sudo rm activitygen dfrouter emissionsDrivingCycle jtrrouter marouter od2trips sumo-gui TraCITestClient duarouter emissionsMap netconvert netgenerate polyconvert sumo
最后,記得刪除整個sumo文件夾,sudo rm -r+你的SUMO版本
下面進入正題,參考官方教程[https://sumo.dlr.de/docs/Installing/Linux_Build.html#Building_the_SUMO_binaries_with_cmake] 安裝sumo-1.5.0啦
-
首先,安裝需要的庫和依賴
sudo apt-get install cmake python g++ libxerces-c-dev libfox-1.6-dev libgdal-dev libproj-dev libgl2ps-dev swig
-
下載安裝包
去這里下載安裝包:https://sourceforge.net/projects/sumo/files/sumo/
我下載的是sumo-src-1.5.0.tar.gz -
在home下解壓,然后
tar xzf sumo-src-1.5.0.tar.gz cd sumo-1.5.0 pwd
-
修改SUMO_HOME路徑
export SUMO_HOME="/home/<user>/sumo-1.5.0" echo $SUMO_HOME
結果應該顯示:/home/<用戶名>/sumo-1.5.0
-
用到cmake開始build
mkdir build/cmake-build cd build/cmake-build cmake ../..
-
make
make -j $(nproc)
或者
make -j $(grep -c ^processor /proc/cpuinfo)
可能的問題:
-
終端輸入sumo-gui不能打開sumo仿真界面?
試試下面的方法呢
首先打開bashrc:sudo gedit ~/.bashrc
添加:
export PATH=/home/[我的用戶名]/sumo-1.5.0/bin:$PATH
記得讓修改的路徑生效:
source ~/.bashrc
升級至sumo-1.7.0
- 可以不用卸載原來的包
data/sumo
- 下載安裝包到任意位置,包名通常為
sumo-x.x.x
- 步驟如上
- 編譯成功后將
sumo-x.x.x
移動到data
並重命名為data/sumo
這樣就可以不用更改~/.bashrc
文件
本次安裝出現問題:
//usr/lib/x86_64-linux-gnu/libpoppler.so.58: undefined reference to `TIFFDefaultStripSize@LIBTIFF_4.0' //usr/lib/x86_64-linux-gnu/libpoppler.so.58: undefined reference to `TIFFFdOpen@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libpoppler.so.58: undefined reference to `TIFFWriteScanline@LIBTIFF_4.0' //usr/lib/x86_64-linux-gnu/libpoppler.so.58: undefined reference to `TIFFClose@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libpoppler.so.58: undefined reference to `TIFFSetField@LIBTIFF_4.0' collect2: error: ld returned 1 exit status src/polyconvert/CMakeFiles/polyconvert.dir/build.make:346: recipe for target '../../bin/polyconvertD' failed make[2]: *** [../../bin/polyconvertD] Error 1 CMakeFiles/Makefile2:2711: recipe for target 'src/polyconvert/CMakeFiles/polyconvert.dir/all' failed make[1]: *** [src/polyconvert/CMakeFiles/polyconvert.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... //usr/lib/x86_64-linux-gnu/libpoppler.so.58: undefined reference to `TIFFDefaultStripSize@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libpoppler.so.58: undefined reference to `TIFFFdOpen@LIBTIFF_4.0' //usr/lib/x86_64-linux-gnu/libpoppler.so.58: undefined reference to `TIFFWriteScanline@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libpoppler.so.58: undefined reference to `TIFFClose@LIBTIFF_4.0' //usr/lib/x86_64-linux-gnu/libpoppler.so.58: undefined reference to `TIFFSetField@LIBTIFF_4.0'
collect2: error: ld returned 1 exit status
src/netgen/CMakeFiles/netgenerate.dir/build.make:241: recipe for target '../../bin/netgenerateD' failed
make[2]: *** [../../bin/netgenerateD] Error 1
CMakeFiles/Makefile2:2199: recipe for target 'src/netgen/CMakeFiles/netgenerate.dir/all' failed
make[1]: *** [src/netgen/CMakeFiles/netgenerate.dir/all] Error 2
//usr/lib/x86_64-linux-gnu/libpoppler.so.58: undefined reference to `TIFFDefaultStripSize@LIBTIFF_4.0' //usr/lib/x86_64-linux-gnu/libpoppler.so.58: undefined reference to `TIFFFdOpen@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libpoppler.so.58: undefined reference to `TIFFWriteScanline@LIBTIFF_4.0' //usr/lib/x86_64-linux-gnu/libpoppler.so.58: undefined reference to `TIFFClose@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libpoppler.so.58: undefined reference to `TIFFSetField@LIBTIFF_4.0' collect2: error: ld returned 1 exit status src/CMakeFiles/netconvert.dir/build.make:115: recipe for target '../../bin/netconvertD' failed make[2]: *** [../../bin/netconvertD] Error 1 CMakeFiles/Makefile2:614: recipe for target 'src/CMakeFiles/netconvert.dir/all' failed make[1]: *** [src/CMakeFiles/netconvert.dir/all] Error 2 Makefile:138: recipe for target 'all' failed make: *** [all] Error 2
make -j $(nproc)
之后出現上述問題,分析后是因為libtiff包在anaconda3里面產生沖突
locate libtiff.so
/home/ubuntu/data/anacond3/envs/node33-base/lib/libtiff.so
/home/ubuntu/data/anacond3/envs/node33-base/lib/libtiff.so.5
/home/ubuntu/data/anacond3/envs/node33-base/lib/libtiff.so.5.4.0
/home/ubuntu/data/anacond3/envs/tf-keras-rl/lib/libtiff.so
/home/ubuntu/data/anacond3/envs/tf-keras-rl/lib/libtiff.so.5
/home/ubuntu/data/anacond3/envs/tf-keras-rl/lib/libtiff.so.5.4.0
/home/ubuntu/data/anacond3/envs/tf_gpu_env/lib/libtiff.so
/home/ubuntu/data/anacond3/envs/tf_gpu_env/lib/libtiff.so.5
/home/ubuntu/data/anacond3/envs/tf_gpu_env/lib/libtiff.so.5.2.4
/home/ubuntu/data/anacond3/lib/libtiff.so
/home/ubuntu/data/anacond3/lib/libtiff.so.5
/home/ubuntu/data/anacond3/lib/libtiff.so.5.5.0
/home/ubuntu/data/anacond3/pkgs/libtiff-4.0.10-h2733197_2/lib/libtiff.so
/home/ubuntu/data/anacond3/pkgs/libtiff-4.0.10-h2733197_2/lib/libtiff.so.5
/home/ubuntu/data/anacond3/pkgs/libtiff-4.0.10-h2733197_2/lib/libtiff.so.5.4.0
/home/ubuntu/data/anacond3/pkgs/libtiff-4.0.10-hfc65ed5_1004/lib/libtiff.so
/home/ubuntu/data/anacond3/pkgs/libtiff-4.0.10-hfc65ed5_1004/lib/libtiff.so.5
/home/ubuntu/data/anacond3/pkgs/libtiff-4.0.10-hfc65ed5_1004/lib/libtiff.so.5.4.0
/home/ubuntu/data/anacond3/pkgs/libtiff-4.0.6-3/lib/libtiff.so
/home/ubuntu/data/anacond3/pkgs/libtiff-4.0.6-3/lib/libtiff.so.5
/home/ubuntu/data/anacond3/pkgs/libtiff-4.0.6-3/lib/libtiff.so.5.2.4
/home/ubuntu/data/anacond3/pkgs/libtiff-4.1.0-h2733197_1/lib/libtiff.so
/home/ubuntu/data/anacond3/pkgs/libtiff-4.1.0-h2733197_1/lib/libtiff.so.5
/home/ubuntu/data/anacond3/pkgs/libtiff-4.1.0-h2733197_1/lib/libtiff.so.5.5.0
/usr/lib/x86_64-linux-gnu/libtiff.so
/usr/lib/x86_64-linux-gnu/libtiff.so.5
/usr/lib/x86_64-linux-gnu/libtiff.so.5.2.4
然后把 anaconda3下面的 libtiff.so移走
mkdir /home/ubuntu/data/bak
mv /home/ubuntu/data/anacond3/lib/libtiff.so* ~/data/bak/
重新編譯后成功
tf_gpu_env下安裝mujoco的情況:
按照教程已安裝好mujoco150,運行:
./simulate ../model/humanoid.xml
結果:

出現無法顯示的問題,先暫且到這兒。