This time, I would like to introduce the environment construction of deep learning by Window. I think that many people are worried about Tensorflow and Chainer, but this time I will introduce how to put both.
I reinstalled the software many times to build the environment, and it took me a long time, but I hope this will make everyone easier ~
python 3.5.2
https://www.python.org/downloads/release/python-352/
pip
https://bootstrap.pypa.io/get-pip.py
Download pip from here, open the admin terminal again, put the get-pip.py
you downloaded earlier in an easy-to-find place, and enter that path
python get-pip.py
Let's install pip with
numpy
pip install numpy
matplotlib
pip install matplotlib
Only the ones listed here can support CUDA
CUDA-capable GPU |
---|
CUDA-Enabled Tesla Products |
CUDA-Enabled Quadro Products |
CUDA-Enabled NVS Products |
CUDA-Enabled GeForce Products |
CUDA-Enabled TEGRA/Jeston Products |
Click here for details https://developer.nvidia.com/cuda-gpus
An IDE developed by Microsoft, convenient to use on many platforms. This time I will use ** Visual Studio 2015 ** ** Note: CUDA 8.0 is not supported by Visual Studio 2017 </ font> **
First https://www.visualstudio.com/ja/downloads/ from here Download the web installer. Open the downloaded installer Since I put the English version, I do not know the Japanese display, but there are certainly two options, "automatic installation" and "manual installation", here ** "manual installation" (lower) * *please choose. with this
Enter a screen like this. Be sure to check ** Visual C ++ here ** I think the VS IDE is easy to use, and I've included Python tools as well. Wait until the installation is complete
CUDA First https://developer.nvidia.com/cuda-downloads Download CUDA from here. There are no special precautions for installing CUDA, but you can choose automatic installation. However, if you have installed Visual Studio 2017 earlier, you will see "Visual Studio cannot be detected" here, so ** Re-install Visual Studio 2015 so as not to ignore it **. Otherwise, you'll have a nightmare. T_T
Installation takes a long time, so let's wait ...
At the end, I'm sure it will report the status of Nsight Studio very hard, but you can ignore that as well. When all is done, at the terminal
nvcc
The installation was successful unless the command knot found appeared.
cuDNN
https://developer.nvidia.com/cudnn
Registration is required here, so if you register and log in,
A screen like this appears. If you check ʻI Agree, you will have a choice. Click the red frame to open a list and download the ** cuDNN v5.1 Library for Windows 7 ** in it. ** If you are using Windows 10, please use Windows 10 ** ** Tensorflow does not support cuDNN 6.0. ** ** After downloading the zip file, it has a structure of
cuda-> (bin, include, lib), and there is a corresponding folder in
C: \ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ 8.0`, so each To the appropriate path.
Once this is done, make sure that the environment variable PATH
contains C: \ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v8.0 \ bin
.
The order is always CuPy-> Chainer I just installed pip, so here CuPy
pip install cupy
If you are not careful about the installation so far, I think that bugs will appear here, but one is
error: Unable to find vcvarsall.bat
This is because I haven't put C ++ in Visual Studio. after
error: command 'cl.exe' failed: No such file or directory
This is because the environment variable PATH
does not contain the Visual studio path.
Chainer
pip install chainer
Install with.
This completes the Chainer installation, but in the terminal
python -c "import chainer; print(chainer.cuda.available)"
If you enter and get ** True **, chainer is well connected to the GPU.
Tensorflow There are two methods, but here I will show you how to install with pip.
pip install --upgrade tensorflow-gpu
Or
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.2.1-cp35-cp35m-win_amd64.whl
Once installed, make sure you installed it correctly with this code https://gist.github.com/mrry/ee5dbcfdd045fa48a27d56664411d41c
I think some people are not good at English, but I will translate it into Japanese and paste it here.
tf_selfcheck_jp.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""A script for testing that TensorFlow is installed correctly on Windows.
The script will attempt to verify your TensorFlow installation, and print
suggestions for how to fix your installation.
"""
import ctypes
import imp
import sys
def main():
try:
import tensorflow as tf
print("TensorFlow installed")
if tf.test.is_built_with_cuda():
print("This version includes GPU support\n")
message = input("'gpu'Enter to check the GPU status.\n The check will be completed by other input.\n\ninput:")
if message == "gpu":
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
else:
print("This version does not include GPU support")
sys.exit(0)
except ImportError:
print("ERROR: Failed to import the TensorFlow module.")
candidate_explanation = False
python_version = sys.version_info.major, sys.version_info.minor
print("\n- Python version is %d.%d." % python_version)
if python_version != (3, 5):
candidate_explanation = True
print("Using TensorFlow for Windows"
"Python version 3.5.Will be required")
try:
_, pathname, _ = imp.find_module("tensorflow")
print("\n- TensorFlow is installed at: %s" % pathname)
except ImportError:
candidate_explanation = False
print("""
-There is no module called Tensorflow.`pip install tensorflow`.Let's download at""")
try:
msvcp140 = ctypes.WinDLL("msvcp140.dll")
except OSError:
candidate_explanation = True
print("""
- 'msvcp140.dll'Could not be loaded. To include this DLL, Microsoft Visual
C++You need to install the 2015 Redistributable Update 3.
URL:https://www.microsoft.com/en-us/download/details.aspx?id=53587""")
try:
cudart64_80 = ctypes.WinDLL("cudart64_80.dll")
except OSError:
candidate_explanation = True
print("""
- 'cudart64_80.dll'Could not be loaded. To include this DLL, CUDA 8.Install 0
It is necessary to do it.
URL: https://developer.nvidia.com/cuda-toolkit""")
try:
nvcuda = ctypes.WinDLL("nvcuda.dll")
except OSError:
candidate_explanation = True
print("""
- 'nvcuda.dll'Could not be loaded. This DLL is basic'C:\Windows\System32'Should be in
If not, double check that your GPU can use CUDA and that the drivers are installed correctly.""")
try:
cudnn = ctypes.WinDLL("cudnn64_5.dll")
except OSError:
candidate_explanation = True
print("""
- 'cudnn64_5.dll'Could not be loaded. To include this DLL, cuDNN 5.Install 1
It is necessary to do it. cuDNN is not installed with CUDA by default.
If already cuDNN 6.If you enter 0,'cudnn64_6.dll'Let's delete and re-paste with other files
URL:https://developer.nvidia.com/cudnn""")
if not candidate_explanation:
print("""
-We have all the DLLs needed for Tensorflow.
TensorFlow GitHub page: https://github.com/tensorflow/tensorflow/issues""")
sys.exit(-1)
if __name__ == "__main__":
main()
I think that the Japanese version added the last question asked if the installation was successful, so enter gpu
there and
Also, if you have run the English version, go to the terminal
python -c "from tensorflow.python.client import device_lib; print(device_lib.list_local_devices())"
And finally
name: GeForce GTX 980M
major: 5 minor: 2 memoryClockRate (GHz) 1.1265
pciBusID 0000:01:00.0
Total memory: 4.00GiB
Free memory: 3.83GiB
2017-07-07 17:18:53.446905: I c:\tf_jenkins\home\workspace\release-win\m\windows
-gpu\py\35\tensorflow\core\common_runtime\gpu\gpu_device.cc:961] DMA: 0
2017-07-07 17:18:53.448085: I c:\tf_jenkins\home\workspace\release-win\m\windows
-gpu\py\35\tensorflow\core\common_runtime\gpu\gpu_device.cc:971] 0: Y
2017-07-07 17:18:53.449183: I c:\tf_jenkins\home\workspace\release-win\m\windows
-gpu\py\35\tensorflow\core\common_runtime\gpu\gpu_device.cc:1030] Creating Tenso
rFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 980M, pci bus id: 0000:01
:00.0)
[name: "/cpu:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 5743970950694766450
, name: "/gpu:0"
device_type: "GPU"
memory_limit: 3798282240
locality {
bus_id: 1
}
incarnation: 5780768353725891859
physical_device_desc: "device: 0, name: GeForce GTX 980M, pci bus id: 0000:01:00
.0"
]
If you see these results at the bottom, your Tensorflow installation is complete.
Building an environment centered on Linux (I don't think you can see this) Install cuDNN + chainer on Windows 10 [The easiest way to put Chainer v1.5 + CUDA + cuDNN on Windows](http://qiita.com/okuta/items/f985b9da6de33a016a75#cuda%E3%81%AE%E7%A2%BA% E8% AA% 8D) Visual Studio vcvarsall.bat needed for python to compile missing from visual studio 2015 ( v 14) Visual studio doesn't have cl.exe [closed] Would cuDNN v6.0 work with TensorFlow currently? CUDA CUDA Installation Guide for Microsoft Windows how to setup cuDnn with theano on Windows 7 64 bit Chainer python pip on Windows - command 'cl.exe' failed
Tensorflow Installing TensorFlow on Windows Error importing tensorflow on windows 10 ( Tensorflow 0.12.0 RC0, python3.5 )
Recommended Posts