Layout:post
title:2018-05-11-Machine learning Environment Installation-i7-gtx960m-ubuntu1804-cuda90-cudnn712-tf180-keras-gym-atari-box2d
key:20180511
Tags: machine learning cuda CUDNN TensorFlow Gym
Modify_date:05-11
---
Machine learning Environment Installation-i7-gtx960m-ubuntu1804-cuda90-cudnn712-tf180-keras-gym-atari-box2d
Description
- This article was posted in: Gitee,github, Blog Park
- Please specify the original author and connection and source.
Body:
- Description: Here is a note on how to install machine learning in the latest environment of Ubuntu in the main environment of the method and the trial process.
Machine learning Environment Installation Family Bucket ubuntu18.04 practical experience in environment
- 1.ubuntu18.04 Switch The default Python method:
- Links: https://segmentfault.com/q/1010000003713912
Command:
# 如下命令用来定义2种pythonsudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100 sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150# 如下命令用来切换sudo update-alternatives --config python
- 2.ubuntu18.04 Installing the ferry Cloud Disk client (not the ferry Cloud Sync client)
- Links: 45007637 (this link has bcloud3.9.1 installation package, is the latest version that can be found, has been put into the cloud disk "my program \ubuntu\ Oh well" location; Bcloud is actually maintained by the community and the individual! Tested available)
Installation Instructions: 78169072
- 3.SSH Login ubuntu18.04
Principle: The default Ubuntu system after the installation of SSH, and no sshd, so other servers to SSH link to Ubuntu need the following
```
Installation Instructions: https://jingyan.baidu.com/article/359911f5a5b74857fe0306c4.html
First look at your Ubuntu is not already installed or enabled SSH service, execute ps-e |grep ssh
If only ssh-agent this is the Ssh-client client service, if there is no sshd, continue with the following installation Ssh-server
Installing sshd:
sudo apt install openssh-server
Manual operation on/off SSH service related commands:
sudo service ssh start #手动启动服务
sudo service ssh stop #手动关闭服务
sudo service SSH status #查询服务状态
```
- 4.install QQ
Best-of-use ' webqq ', it's a URL, you can make a URL to link icon on Ubuntu desktop!.
- 5.install Chrome
- Download Chrome Deb Package and use ' sudo dpkg-i google-chrome-stable_current_amd64.deb ' to install.
DONOT DOUBLE CLICK ' deb ' file in dialog and it won't install Chrome and final Create a icon of it (it seems not install Finished indeed!)!
- 6. Installing Pycharm
- Download the free community version of Pycharm First, then execute the pycharm.sh script below the bin to launch the graphical interface (pycharm.sh)
Next, refer to the following link to configure Project Interperter, because there are generally more than one python, such as Pycharm, Ananconda if you installed, the system Python3 or 2 if you installed, I chose the system Python3 as the resolution of its), You chose which, Pycharm will automatically detect its dependent library updates, generally ananconda good. Https://www.cnblogs.com/fanmu/p/8010580.html
- 7. Solve the problem of apt-get cyclic dependency and unable to install Lib library
- Problem: Encountered in Ubuntu system using Apt-get to install a Lib library, but a depends on b,c; b relies on the d;d to rely on a,e, so that the cyclic dependence, can not install each LIB library separately;
Solution: In fact, as long as you sudo apt-get install a,b,c,d,e//will be a loop-dependent library to write on it!
- 8. Fix UBUNTU18.04 plugged in USB wireless mouse Invalid problem
- In fact, the power is not plugged in the case, the default is to turn off the USB device, plugged in the power, wireless USB mouse can be used;
- TODO: Not found how to set ubuntu18.04 disable USB device such as mouse switch or configuration in power off mode;
TODO: ubuntu18.04 the method and command to adjust the mouse size is not found;
ubuntu18.04 Environment Installation CUDA+CUDNN+TF
- 1. View NVIDIA Graphics configuration
# 查看N卡GPU的配置 nvidia-smi # 查看N卡的图形界面配置 nvidia-settings # 命令:查看nvidia卡型号; $ lspci | grep -i nvidia # 返回内容: 01:00.0 VGA compatible controller: NVIDIA Corporation GM107M [GeForce GTX 960M] (rev a2)
- 2. Installation of Cuda toss process
- God Post/Good posts: http://www.zhimengzhe.com/bianchengjiaocheng/qitabiancheng/415560.html
- Process Brief:
- first try to remember that the gtx960m graphics card can only support a combination of the highest cuda6+cudnn5 configuration installation;
The
- official website checked the hardware model, matches is cuda6+cudnn5, because CUDNN is the neural network NN accelerates the library, mainly looks at Cuda;
- but soon found that the TF official website said the minimum support for cuda8, what to do???
- Check the post found that someone also installed CUDA8 on gtx960m, so guess: as long as the N card installed on the driver driver, and driver version associated to Cuda,cuda Association to CUDNN,TF also associated Cuda version, Bold guess is this logic;
- According to the above logic, greedy download CUDA9.1, the more the installation problem, the solution found that TF does not support, miserable;
- Find paste Find can install multiple Cuda version, as long as the path is configured properly, not like the win system has a black box registry!
- to check the TF GitHub pipe network release inside 1.8.0 and other latest release-note information, and check the key Cuda, found that only support to CUDA9.0; So determined to install it;
- NVIDIA website without registration can download cuda (but cudnn need to register to download), the speed is very fast, so download runfile (now found that I forgot to install patches, only installed CUDA9.0 main program, currently can use!)
- follow the above-described method, considering that ubuntu18.04 has upgraded the GTX960M graphics card to the latest 390 drvier driver, and God said as long as the driver version is close (the post said aaa.bb small version bb can be different), But I found that CUDA9.0 only support to 387, and 390 very close, daring to try, incredibly installed up. Do not install the CUDA9.0 in the first step of the installation of its own 387 of the driver graphics card driver, otherwise the graphics driver installation will be extremely complex!
- successfully installed CUDA9.0, according to the hint and God paste set the path, and then register Nvida official website, download the matching CUDNN712, and the same runfile installation, and refer to another post (detailed below) copy files and do links and path, etc.
- last PIP3 install Tensorflow-gpu
- requires Keras pip3 install Tensorflow-gpu
-
3. Install Cuda9.1/cuda9.0/cuda higher version (CUDA installation package prompt support ubuntu17.10, forget it, in fact, I installed 18.04!)
A. There is a problem with the run installation file that executes cuda9.x error:unsupported compiler:7.3.0. Use the--override to override the this check. sudo sh./cuda_9.1.85_387.26_linux.run--override//Add this parameter to block this error! So you can continue the installation! See the following results, basic ok.= Summary ============driver:not selectedtoolkit:installed in/usr/local/cuda-9.1samples:installed in/ Home/ya/cuda9-samplesplease Make sure That-path includes/usr/local/cuda-9.1/bin-ld_library_path includes/usr/loc Al/cuda-9.1/lib64, or, add/usr/local/cuda-9.1/lib64 to/etc/ld.so.conf and run ldconfig as Rootto uninstall the Cuda Tool Kit, run the uninstall script in/usr/local/cuda-9.1/binplease see Cuda_installation_guide_linux.pdf in/usr/local/ Cuda-9.1/doc/pdf For detailed information on setting up CUDA. Warning:incomplete installation! This installation does not install the CUDA Driver. A driver of version at least 384.00 are required for CUDA 9.1 functionality to work. To install the driver using this installer, run the following command, replacing <CudaInstaller>With the name of this run File:sudo <cudainstaller>.run-silent-driverlogfile is/tmp/cuda_install_13322.logsig NAL caught, cleaning up---------------------B configuration (refer to above hint) $ sudo vim/etc/profile at the end of the open file, add the following two lines. 64-bit system: $ export path=/usr/local/cuda-9.0/bin${path:+:${path}}$ export LD_LIBRARY_PATH=/USR/LOCAL/CUDA-9.0/LIB64${LD _library_path:+:${ld_library_path}} 32-bit system: $ export path=/usr/local/cuda-9.0/bin${path:+:${path}}$ export LD_LIBRARY _path=/usr/local/cuda-9.0/lib ${ld_library_path:+:${ld_library_path}} C installation completed cuda9.x, also need to install the following Libsudo Apt-get installed Freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev D finally reboot, Test with the following command to see if cuda9.x is installed correctly $ nvcc-vnvcc:nvidia (R) Cuda compiler drivercopyright (c) 2005-2017 NVIDIA corporationbuilt on Fr I_nov__3_21:07:56_cdt_2017cuda compilation tools, Release 9.1, V9.1.85
ubuntu18.04 Environment Installation OpenAI Gym's enhanced learning environment
- 1. Installing the gym environment
- The usual procedure, with the command: PIP3 install Gym[all]//Here assumes that Ubuntu has been installed to upgrade Python3 and PIP3, and to switch the default Python to PY3 instead of PY2 as described above;
Problem: Generally you will encounter the results prompt, box2d and atari-py installation failure, repeat the above command, install all Gym[all], it is clearer to see only this 2 module is not successfully installed (and win10 consistent);
- 2. Installing Swig
- If the above 2 modules failed to install, found an error is no swig, and win10 like, to the official website to download the corresponding Swig version, WIN10 is EXE (can succeed), Ubuntu with the command (can succeed);
- sudo apt-get install Swig
Swig Link: http://www.swig.org/download.html
- 3. Installing Gym's Box2d-kengz physics engine
- Gym is a family of barrels, which contains a variety of physics engine box2d, such as the game environment Atari, is a research and development and commissioning to strengthen learning RL good environment;
- First install again, change the name: PIP3 install gym[box2d]//single command installation box2d, not all, is not the original old Box2d-kengz
After successful installation, the following tests:
测试Box2D物理引擎是通过激活如下的小游戏CartPole:用如下命令来测试Box2D是否安装成功,如果失败,只会出现白框,而没有杆子!python //进入python,最好是PY3import gym //load gym库,这里不能有报错env = gym.make("CartPole-v0") //新建一个树立杆子的游戏环境env.reset() //初始化env.render() //渲染,此时会弹出dialog,里面有杆子!就算OK了!env.close() //关闭env环境,dialog不能被gui关闭,只能用本行命令关闭!
- 4. Install gym Atari-py's mini-game hardening Environment Collection
- Install separately: PIP3 install gym[atari-py]//error, display possible cmake problem ( Win10 need to install MINGGW and other environment, and finally no time to go down)
- install Cmake:sudo apt-get installs CMake//cmake is the Ubuntu operating system Lib library, not the Python library, So use apt instead of PIP3 to install;
- then install ATARI-PY:PIP3 install Gym[atari]//Success
- if the error is as follows, please enter the directory of the error prompt, need to manually generate the missing so file, Src source in the Atari directory, enter the directory directly make can be generated!
- OSError:/home/ya/atari-py/atari_py/ale_interface/build/libale_c.so:cannot Open Shared object file:no such F Ile or directory
- Please enter/home/youraccount/atari-py/atari_py/ale_interface///There is no build directory and file at this time libale_c.so
in this directory see the makefile file and src directory, guess is not compiled so file!
- Run command make directly in this directory, which automatically compiles the makefile compiled edit script for the same directory, so the so file has been tested again!!! Passed the!!!
- Atari INSTALLATION COMPLETE!!!!
测试:python //进入python,最好是PY3import gym //load gym库,这里不能有报错env = gym.make("SpaceInvaders-v0") //新建一个打飞机游戏环境(这里可能会报错如下!!!)env.reset() //初始化env.render() //渲染,此时会弹出dialog,里面有飞机!就算OK了!env.close() //关闭env环境,dialog不能被gui关闭,只能用本行命令关闭!
- 5. Examples of running RL reinforcement learning
- Reinforcement learning RL is interesting, recently studied, and looked at some Morvan tutorials (GitHub find keyword "Morvan" to get the first result)
- Run a general RL example, although the import does not need a pure Python graphics library tkinter, but matplotlib famous PY drawing library needs to do the following installation:
- Install Tkinter:sudo apt Install PYTHON3-TK//special note, not sudo apt install PYTHON-TK!!!
Continuous update ... END
2018-05-11-Machine learning Environment Installation-i7-gtx960m-ubuntu1804-cuda90-cudnn712-tf180-keras-gym-atari-box2d