Build AI / machine learning environment with Python

■ PC environment CPU:i7 Main memory: 16GB GPU:NVIDIA 「Tesla80」

■OS WindowsServer2019/64bit

■ Setup tool ● GPU environment (Cuda) Driver "Tesla K80" CUDA toolkit CUDA10.0 [cuda_10.0.130_win10_network.exe] cuDNN7.4 [cudnn-10.0-windows10-x64-v7.6.0.64.zip] ● Python environment Python3.8 (Miniconda3 Windows 64-bit)

① GPU (Cuda) driver setup Download and install the Tesla K80 driver from NVIDIA.

URL:https://www.nvidia.com/Download/Find.aspx Select the following product type from the site Product Type: Datacenter/Tesla Product Series: K-Series Product Type: Tesla k80 OS: Windows 2019

② Cuda Toolkit setup ● CUDA Toolkit download site Download CUDA10.0 [cuda_10.0.130_win10_network.exe] from the following site https://developer.nvidia.com/cuda-10.0-download-archive

Install the downloaded exe Select "A GREE AND CONTINUE" on the screen below image.png

Select Custom and click Next

image.png

Check below and click Next

image.png

Click Next

image.png

Check and click Next

image.png

Click Next

image.png

Click CLOSE

image.png

● cudnn download site https://developer.nvidia.com/rdp/cudnn-archive Download cuDNN7.4 [cudnn-10.0-windows10-x64-v7.6.0.64.zip] from the following site https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v7.6.0.64/prod/10.0_20190516/cudnn-10.0-windows10-x64-v7.6.0.64.zip

Unzip the DL "cudnn-10.0-windows10-x64-v7.6.0.64.zip" Copy the file according to the configuration below

● Setup cudnn-10.0-windows10-x64-v7.6.0.64 └─cuda │ ├─bin │ cudnn64_7.dll => Copy to C: \ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v10.0 \ bin
│ ├─include │ cudnn.h => Copy to C: \ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v10.0 \ include │ └─lib └─x64 copy to cudnn.lib => C: \ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v10.0 \ lib \ x64

This completes the CUDA Toolkit setup

③ Python (Anaconda or miniconda) environment This time, we will set up a mini version of Anaconda, Miniconda, and build a Python virtual environment. Download "Miniconda3 Windows 64-bit (Miniconda3-latest-Windows-x86_64.exe)" from the following site https://conda.io/miniconda.html

image.png

Double-click the downloaded "Miniconda3-latest-Windows-x86_64.exe" and follow the steps below to install it. In addition, since the user name is "Administrator", Path is replaced with your own PC environment.

● Press Next

image.png

● Select I Agree

image.png

● Press Next

image.png

● Press Next

image.png

● Press Install There is a check box as to whether to change the global path, but this is not changed as recommended (do not check)

image.png

● Press Next

image.png

● Uncheck the check box and press Finish

image.png

● Start Anaconda Prompt (miniconda3) from the start menu

image.png

Anaconda Prompt is displayed

image.png

Subsequent work will be done with Anaconda Prompt

■ Create any version of Python environment As of October 2020, the latest version of Python is 3.8.5, but the latest version of Tensorflow does not support 3.8, so it was created with the "3.7" version.

● Execution command

conda create -n py37 python=3.7

image.png

● A list of additional installation packages will be displayed. Enter "y" and press enter.

image.png

When the installation is completed, the virtual environment will be created in the following path by default. 「C:\ProgramData\Miniconda3\envs\py37」

● Start virtual environment

conda activate py37

image.png

● python version check

python --version

image.png

● Check the created virtual environment

conda info -e

image.png

● When stopping the virtual environment

conda deactivate

■ Installation of extension packages python -m pip install --upgrade pip pip install tensorflow-gpu==2.0 pip install keras==2.3.1 pip install scikit-learn pip install pandas pip install beautifulsoup4 pip install requests pip install matplotlib pip install pillow pip install opencv-python pip install pyttsx3 pip install pydot pip install pydotplus pip install lxml pip install janome pip install seaborn pip install pydot-ng pip install IPython pip install jupyter conda install graphviz

Put the path of the library "graphviz" installed in the virtual environment in the system environment variable "Path" Example) C: \ ProgramData \ Miniconda3 \ envs \ py37 \ Library \ bin \ graphviz

■ Start Jupyter Notebook

jupyter notebook

image.png

The browser starts and the following screen is displayed image.png

■ Set the source code to be executed below C:\share

■ Change the initial directory of Jupyter Notebook

  1. Create a jupyter notebook configuration file Launch virtual environment with Anaconda Prompt

conda activate py37

Execute the following command

jupyter notebook --generate-config

Since "default config" is generated in [C: \ Users \ [user name] \ .jupyter \ jupyter_notebook_config.py], "default config" c.NotebookApp.notebook_dir = '' Is modified to the following ("c: \ share" this time) * Delete the # at the beginning c.NotebookApp.notebook_dir = 'c:\share'

This completes the setting

■Jupyter Notebook tips

・ Help ESC+H

-Reset the program execution of Jupyter Notebook Initialize the kernel with "Kernel → Restart & Clear Output" on the toolbar

-Display / cancel cell line number ESC+L

Recommended Posts

Build AI / machine learning environment with Python
Build a Python machine learning environment with a container
Build a machine learning application development environment with Python
Build python3 environment with ubuntu 16.04
Build python environment with direnv
Build a machine learning environment
Beginning with Python machine learning
Build an interactive environment for machine learning in Python
Build a machine learning Python environment on Mac OS
Build python virtual environment with virtualenv
Machine learning with python (1) Overall classification
Build Mysql + Python environment with docker
"Scraping & machine learning with Python" Learning memo
Build a python machine learning study environment on macOS sierra
Build an environment for machine learning using Python on MacOSX
Build a machine learning scikit-learn environment with VirtualBox and Ubuntu
Machine learning environment settings based on Python 3 on Mac (coexistence with Python 2)
Python & Machine Learning Study Memo: Environment Preparation
Build Jupyter Lab (Python) environment with Docker
Amplify images for machine learning with python
Machine learning with python (2) Simple regression analysis
[Shakyo] Encounter with Python for machine learning
Build Python environment with Anaconda on Mac
Python and machine learning environment construction (macOS)
Build a python virtual environment with pyenv
Build a modern Python environment with Neovim
I tried to build an environment for machine learning with Python (Mac OS X)
Building a Windows 7 environment for getting started with machine learning with Python
Learning Python with ChemTHEATER 03
"Object-oriented" learning with python
Learning Python with ChemTHEATER 05-1
3. 3. AI programming with Python
Learning Python with ChemTHEATER 02
Learning Python with ChemTHEATER 01
Python environment with docker-compose
Virtual environment with Python 3.6
[Python] Easy introduction to machine learning with python (SVM)
Build python environment with pyenv on EC2 (ubuntu)
Build Python development environment with Visual Studio Code
Build a python environment with ansible on centos6
[Python] Build a Django development environment with Docker
[Python] Collect images with Icrawler for machine learning [1000 images]
Build a Python environment with OSX El capitan
I started machine learning with Python Data preprocessing
Build PyPy and Python execution environment with Docker
Build a python execution environment with VS Code
What I learned about AI / machine learning using Python (1)
Machine learning learned with Pokemon
Install Python environment with Anaconda
Run a machine learning pipeline with Cloud Dataflow (Python)
Manage python environment with virtualenv
Build a python virtual environment with virtualenv and virtualenvwrapper
Python learning plan for AI learning
Reinforcement learning starting with Python
Build Python environment on Windows
Make Puyo Puyo AI with Python
Prepare python3 environment with Docker
[ev3dev × Python] Build ev3dev development environment
Machine learning Minesweeper with PyTorch
Build python environment on windows
Machine learning environment construction macbook 2021