Depth study 1- depth learning environment is installed, there is this one enough! Anaconda-Python + Tensorflow2.0-GPU + Keras + Pycharm

This is the first record I learned a depth of from zero to learn, do not know how much to write learning record, do not know how much can be learned, in short, to record their own learning process, the case of pit process, with all the depth of learning the process will be 11 records, on the one hand to yourself to look back a little read to, on the other hand reference to other students, according to which one can solve the corresponding problem.

2020 March 9 by the first paragraph of the code

<The installation of a lot of people read blog installation, integration and finally straighten out a bit, say in the end I see this one to build deep learning environment is sufficient, step by step to finish installation Tensorfllow2.0-GPU / CPU + Keras environment is certainly no problem>

Tips: CPU and GPU mounting is substantially the same, but because the computer can not install the GPU to configuration issues, to skip 2.1 NVIDIA-CUDA / cuDNN configuration, directly after completion of the installation can be installed into the python 2.2tensorflow the environment.

A computer configuration:

Windows10 64bit

Graphics: Nvidia GeForce 920MX - Initial Version: 382.05

B target installation environment:

a-  python3.7

b-  tensorflow2.0-gpu

c- cuda10.0 - NVIDIA compute accelerator

d- cudnn7.5 for cuda10.0 - neural network accelerator

(Cuda10.0 and cudnn are installed tensorflow-gpu version requirements, cpu version does not require, at the same time cuda version and cudnn version is associated)

hard e-

f- programming tools: Pycharm2019

C installation implementation process:

 

1.Python installation environment

1.1 Anaconda install Python environment

Pyhton environment: Anaconda-Python3.7

Download: https://repo.anaconda.com/archive/Anaconda3-2019.10-Windows-x86_64.exe

https://www.python.org/downloads/release/python-376/

This uses the Anaconda installation Python environment so why not directly pyhton3 * exe install it early I research a lot, for two reasons summarized as follows:..? 1) Anaconda integrates a number of packages, very easy to manage package ; 2) a lot of people people are recommended anaconda; (in fact the beginning, I was directly python3.7.exe to install, and installed, nothing different)

Tips: It is recommended that you check first on a Path variable added to the system, go back to save with the environment, which can be used directly cmd command to run.

1.2 Anaconda test whether the installation was successful: conda list

I can see a lot of libraries with anaconda, usually installed generally can not go wrong this is a simple software installation.

1.3 Configuring domestic Mirror - download dependencies to accelerate

We know python and some other development languages ​​are not domestic, foreign server, download soft armor are relatively slow, a better way is to download the image source domestic partners to change the mirror, on the one hand faster download speeds, on the other hand not so easy to download interruption failure.

Here we use a mirror source Tsinghua University, open cmd, some directly typing the following command:

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

2. Installation depth learning framework

a- mounting CUDA computing Accelerator

b- installation cuDNN neural network computing accelerator (and supporting the former, the latter failed to install, will still tensorflow installation fails)

Installation Tensorflow-gpu c-

d- installation kares framework

Because of this we installed the tensorflow2.0-gpu version, GPU version has the special requirements of the system hardware, cpu version does not. Figure requirements, so before installing Tensorflow, you need to install the driver requires NVIDIA GPU and CUDA support tools :

Tips: If you are not computer graphics NVIDIA graphics cards is AMD, etc., can directly skip this step 2.1, no NVIDIA GPU graphics card can not install version can only run CPU version.

 

2.1 CUDA (compute accelerator NVIDIA specifically provided)

Before installing, first check whether they can support the NVIDIA on the map, if they meet the requirements, you can skip this step to upgrade the video card. If you can not meet, you may need to update the look of the graphics driver (do not know whether to be successful, the author computer GeForce 920MX original version 382.05 successfully upgraded to meet the requirements of 416.94, in fact, can be upgraded to a higher version of the network is not good without the other down)

2.1.1 determining whether graphics meet installation requirements tensorflow2.0-gpu

Method: Control Panel - Hardware and Sound -NVIDIA Control Panel (or otherwise enter NVIDA Control Panel) - to view the current version of the graphics card information

If you meet the installation requirements, then skip the upgrade step, go directly to the third step installation CUDA.

Not, have a chance to upgrade our drivers need to check.

2.1.2 upgrade drive

Check the place:

GeFerce graphics card: https://www.geforce.com/drivers

Other NVIDIA version check: https://www.nvidia.com/Download/index.aspx?lang=en-us

In this web site you now computer graphics models, the next query to see if there can upgrade package, and there is a download upgrade packages to meet the more demanding enough as the author of:

Look, a lot can upgrade package, and greater than 410.X, we like to download one (Tips:. Unfortunately, the points go to download, it may be a network problem, direct download failed, and finally I found an online 416 version has been upgraded, you can upgrade requires the comment)

Well, after downloading, the default installation is finished, the installation, we go to the NVIDIA Control Panel, you can see our latest version of the updates as shown:

To seem, we can begin to install CUDA friends, cuda10.0 here to install the corresponding version (recommended upgrade finished, restart the computer)

2.1.3 mounting CUDA10.0 (calculated accelerator)

CUDA Download (Download unsuccessful can find me share the comments section):

https://developer.nvidia.com/cuda-10.0-download-archive?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal

2.1.3-1 cuda installation

First the program will pop up a file-like pressure release then is formally installed, the first step in the installation remember to choose custom installation, the default installation recommendation may encounter pits.

2.1.3-2 NVIDIA GeForce cancel the component installation .NVIDIA himself almost out of him.

2.1.3-3 Visual Studio Intergration components not installed (VS installed the machine can be checked, do not install the hook - this set point will be displayed at the opening CUDA)

2.1.3-4 Display Driver version comparison: This step is very important, be sure to check the correct version, or install an error (- this set point will be displayed at the opening CUDA):

Graphics version comparison, if the current version number is greater than CUDA graphics card itself the default version installed, be sure to cancel the hook. I like the current version of the computer upgrade is 416, while the CUDA version is installed by default 411, you do not need hook selected!!!!

In fact, we CUDA here primarily to computer graphics version is not enough, we have to upgrade the video card version with, it seems a bit like the taste of our 2.1.2 upgrade the video card. Here is what I see behind the information found also with CUDA graphics card upgrade this benefit, so it seems entirely possible to skip steps 2.1.2 graphics card upgrade, not tested, it is recommended not to install the students try to upgrade the video card should be able to skip that step, if successful, could inform comment about yourselves.

2.1.3-5 software installation location need to stay in it, know in there on the line, wait for the next configuration Path environment to be used.

2.1.3.6 temporarily put aside, taking first cuDNN (it is extracting file, the file you want to put pressure CUDA appropriate place to install the files), install the PATH environment variable Fortunately, the back of the CUDA configuration.

2.1.4 Installation cuDNN7.5 For CUDA10.0

cuDNN Download:

https://developer.nvidia.com/rdp/cudnn-archive

cudnn look cuda version, such as cuda10.0, it may be cudnn 7. * for cuda10.0, remember to look for the corresponding version of cuda, and we must install the corresponding version of cuda. Log in here need to register to download.

Unzip the downloaded folder into a good get into cuDNN, there are three folders [bin, include, lib].

Then cudnn this folder to the root directory of the installation cudn Figure:

2.1.5 configure and test CUDA and cuDNN

(1) configuration environment variable

-Path configuration environment variable variable (My Computer - Properties - Advanced System Properties - Environment Variables - System variables - Edit Path variable)

Mainly in the Path variable by adding the following four records in the path CUDA installation directory, and used to start cuda cuDNN environment, and should be in this order, must be at the top, it is indispensable (see specific directory directory you installed yourself).

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\libnvvp

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\extras\CUPTI\libx64

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\cudnn

(4 rows are indispensable, must be at the top, arranged in this order, the first two may be installed cuda path will be automatically added, if disposed directly behind the two like)

(2) to test whether the installation was successful cuda

Recall cmd, enter:

nvcc -V

You can see a large output and good CUDA version, indicating that the installation was successful friends

2.2 Installation Tensorflow2.0-GPU / CPU version 

The above steps to complete the prelude to the mounting frame, everything is ready only a strong wind, we can begin Yingchu our real protagonist is installed, say in the end, if all the above is not installed successfully TensorFlow failed installation.

Python 2.2.1 is recommended to create a new virtual environment installation (not to install a virtual environment, you can skip into 2.2.2 (3))

Why virtual environment can be found in my previous write a blog:? Python Why use install and configure virtual environment -Python -virtualenv virtual environment ( https://blog.csdn.net/godot06/article/details/81079064 )

The core is to place the main version is not compatible with version conflicts, so whatever project or do research suggest the use of virtual environments. For example, one day we want to play with tensorflow2.0 data frame, use the virtual machine tensorflow2.0, the virtual machine we have packed the corresponding library; someday we need to use pytourch framework to training, we switch to pytourch virtual environment so the two can be compatible parallel, will not be so compatible prone to conflicts where it is held. example, does not necessarily have to separate these two frameworks Kazakhstan, can not together and I do not know, after all dishes, this is my first depth study notes.

Tips: If you do not want to use a virtual machine, please skip part of the virtual machine does not affect tensorflow installation, but it is recommended to use, so do not put the original environment or other environmental mess and if that time want to change the machine directly to the current. importing environment out of which you can change.

In Anaconda about the virtual machine commands are:

a- see which virtual environment currently: conda info --envs

b- check which versions of python can be used to install a virtual environment: conda search --full-name python

(There are actually a few conda for viewing later version pyhton Anaconda installation instructions can also specify the python version to be installed according to their own needs when creating a new virtual environment)

c- New Virtual Machine specified version of Virtual Machine: conda create --name tensorflow python = 3.7

(This is to create a virtual environment for virtual environments python3.7 name is tensorflow)

d- activate virtual machines / access to the virtual machine:  of an activate tensorflow

( After entering the VMs it can be understood as, he is a new python environment, inside the python command operations are performed as may view the current version of python: python --version)

e- exit the virtual machine:  deactivate

f- delete the current virtual machine: conda remove --name yourenvname (tensorflow) --all

Tips: Again, if you do not want to use a virtual machine, please skip part of the virtual machine, enter 2.2.2 (3) does not affect the tensorflow installation, but it is recommended to use, so do not put the original environment, or other environment mess. If want to change the time machine, imported directly to the current environment you can change the inside out.

Here we enter the installation good protagonist Tensorflow2.0-GPU frame bar

2.2.2 Installation Tensorflow

(1) New virtual environment called tensorflow, used tensorflow devoted to learning and training, version specify python3.6

conda create --name tensorflow python=3.6

(2) into the newly erected, and later to always use the virtual environment

activate tensorflow

(3) Installation Tensorflow

In this virtual environment, I want to install depend on the frame, such as our protagonist tensorflow2.0-GPU and other python dependencies (that is, after tensorflow associated with dependence I have installed this virtual environments). Installation tensorflow2.0-GPU version (the eye of the following, or break):

pip install --ignore-installed --upgrade tensorflow-gpu==2.0

Tips:

① If you are using a version I elaborate or provide CUDA10.0, then the installation tensorflow-gpu, designated to be downloaded later tensorflow above 2.0, do not specify will download the latest tensorflow, such as the latest is 2.1, and it will video card model does not match the installation will be successfully completed without error, but when import import tensorflow will give you inexplicable error. Remember Remember

② If your computer does not have NVIDIA graphics cards, is said earlier, this step can jump directly to step 2.1, the same can hold a virtual environment, and then use the following command to install the CPU version of tensorflow2.0

pip install --ignore-installed --upgrade tensorflow==2.0

Installing some log tensorflow print:

These are mounted in the dependent tensorflow automatically installed.

2.3 Installation Kares

Since we also used the project keras, so here the record about (not required can be skipped)

Keras installation package:    

pip install keras -U --pre

2.4 Test tensorflow successfully installed / tensorflow-gpu version was successful

Import tensorflow generally used if successful, the basic successful installation; tensorflow-gpu test is successful, a method may be additionally used:

import tensorflow as tf tf.constant (1.) + tf.constant (2.) tf.test.is_gpu_available () // gpu is useful for specialized testing

At this point, our tensorflow2.0 + Kares formally installed in a virtual environment configuration is complete, students can participate in serious depth learning to play the .tensorflow still more consumption of the machine, it is recommended for a better graphics card machine running. Again if do not want a virtual machine, skip directly to a virtual machine part, does not affect tensorflow installation, but it is recommended to use, so do not put the original environment or other environmental mess. If you want to change to a time machine, directly to the current environment importing out of which you can change.

3 Programming Tools: Pycharm installation and use

工欲善其事必先利其器 above we configured the environment, to write the code necessary to think of a Dragon sword, here we choose to do the industry's respected Pycharm IDE tools.

Installed version: Pycharm 2019

installation steps:

3.1 download and install

The same as a normal software installation, basic installed by default on it, the following configuration can be in several places at change:

3.2 Open Pycharm2019

Activating those on eyes of the beholder wise see wisdom it, you can free 30-day trial.

3.3 Pycharm build environment

Open Pycharm bottom of the page -Configure-Settings- search Interpreter, then follow the steps below to configure virtual environment we installed (if not equipped with a virtual environment, that is, with local installation location where the default Python)

(1) Configure virtual environment build environment

(2) start to create a project Create new Project - remember to use the environment to select the current project build environment, just as the configuration

(3) a new program file and run

Py create a new file, open and write the following code, this is a test version currently installed tensorflow and whether it can use the GPU simple code, the code can be edited after the Run. The bottom is information console output

import tensorflow as tf version = tf.__version__ gpu_ok = tf.test.is_gpu_available() print("tf version:",version,"\nuse GPU",gpu_ok)

 

So far, we have deep learning environment installation Anaconda-Python + Tensorflow2.0-GPU + Keras + Pycharm, completely installed and tested successfully. Depth Learning Here began a bottomless it !!!!!

Reference installation:

1.https://blog.csdn.net/qq_26567507/article/details/89181480

2.https://www.jb51.net/article/174757.htm

3.https://blog.csdn.net/Cs_hnu_scw/article/details/79695347

4.https://blog.csdn.net/Cs_hnu_scw/article/details/79695347

5.https://blog.csdn.net/qq_31456593/article/details/89203335

6.https://blog.csdn.net/weixin_43528943/article/details/103066063

 

Published 64 original articles · won praise 110 · views 280 000 +

Guess you like

Origin blog.csdn.net/godot06/article/details/104782466