2018-05-11-Machine learning Environment Installation-i7-gtx960m-ubuntu1804-cuda90-cudnn712-tf180-keras-gym-atari-box2d

Source: Internet
Author: User
Tags keras

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
  • 4. Install cudnn7.1.2 (supporting cuda9.x)
  • Download: https://developer.nvidia.com/rdp/cudnn-archive (for free to sign up for NVIDIA members)
  • After release to do some copy and path settings on the line, refer to the above Cuda's God paste, more simple.

  • 5. Installation TF-CUDA-CUDNN Experience
  • First of all, the best GPU to do is n card (Nivida graphics card), not only hardware good, drive, Cuda platform, CUDNN Neural network Acceleration Library are good, far more than other graphics cards; Currently, other graphics cards cannot accelerate the neural network!!!
  • Secondly, you are lucky to buy n card, and ready to engage in deep learning, the most famous open-source framework TF (TensorFlow), Pytorch, and Advanced library Keras, and so on, generally support CUDA/CUDNN, first choose one to learn it;
  • Moreover, has n card, for example my gtx960m (game this, but does not play the game), the key is the supporting drive driver to upgrade unceasingly, for example follows ubuntu18.04, the latest upgrade to the 390.XX version;
    • N Card Driver driver version aaa.xx (such as 390.xx), it is equipped with cuda, that is, Cuda Library will explain the need to drvier upgrade to what version, the general XX different does not matter, AAA best;
    • The author experience: AAA difference is not OK, and the new driver general backward compatibility, the old AAA must be upgraded; (if the top n card check your hardware such as gtx960m, it automatically matches the Cuda is very low, do not believe!)
    • Cudnn is a companion Cuda version;
    • TF is also a companion Cuda version;
  • Installation dependent path: Gtx960m-->driver for UBUNTU18.04 (390.XX)-->cuda9.0 (9.X)-->cudnn7.1.2/tf1.8.0-->keras
    • TF immediately minimum support cuda8.0, please upgrade driver as soon as possible, in order to upgrade to cuda8/9/:, to use the matching TF/CUDNN, old hardware n card is still used!
  • This is only a successful case of my hardware software configuration, for the care reference, does not mean that the principle and other hardware and software configuration can be successful, but also to try to!!!
    • In addition, I cuda a few patches forgot to install, it is estimated that it modified compatibility and bugs, and currently no other problems, I do not install, afraid of problems;
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.