https://medium.com/@CoyoteLeo/build-tensorflow-on-windows-c798800849eb
Assuming CUDA and CUDNN are already installed - see notebook for intallation of cuda in NLP in New Section Group - multiple cuda
Install MYS2: https://www.msys2.org/
Download and install - add to system variables path: C:\msys32\usr\bin
then do:
pacman -Syu
pacman -Su
pacman -S patch unzip
Install Visual C++ Build Tools 2015:
If you have deleted C:\Program Files (x86)\Microsoft Visual Studio 14 manually, you might face problems later, uninstalling and reinstalling won't fix it, but repair will.
Go to: https://visualstudio.microsoft.com/vs/older-downloads/
Other Tools, Frameworks, and Redistributables
Download:
Microsoft Visual C++ 2015 Redistributable Update 3 (might need to uninstall 2017 if exists to install this)
and
Microsoft Build Tools 2015 Update 3
For some reason installation of Microsoft Build Tools 2015 Update 3 failed.
So, installed Installed VS Studio 2015 from ISO - downloaded Visual Studio Community 2015 with Update 3
en_visual_studio_community_2015_with_update_3_x86_x64_dvd_8923300.iso
Previously in :
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
There was no vcvarsall.bat and in bin no cl.exe (this caused an issue during building TF)
Install Bazel:
https://github.com/bazelbuild/bazel/releases?page=11
I used version : 0.19.2
From Assets download: bazel-0.19.2-windows-x86_64.exe
Then: create a new directory bazel in C:
Copy this exe in C:\bazel and rename it to bazel.exe
Add C:\bazel to system variables path
Create new environment variable BAZEL_SH with value C:\msys64\usr\bin\bash.exe
Create another env variable BAZEL_VC with value: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
Clone Tensorflow:
git clone https://github.com/tensorflow/tensorflow
cd tensorflow
git checkout r1.13
Installing Python:
Tried creating new env in anaconda but during TF build error because administrator privilege was required and running anaconda prompt as admin didn't help so installed python.
From:
https://www.python.org/downloads/windows/
Python 3.7.9
Windows x86-64 executable installer
Didn't set to env variables during installation.
Later added these two in env vars: for python and pip
Python in:
C:\Users\rb\AppData\Local\Programs\Python\Python37
Pip in:
C:\Users\rb\AppData\Local\Programs\Python\Python37\Scripts
After that open cmd as admin and do:
pip3 install six numpy wheel
pip3 install keras_applications==1.0.6 --no-deps
pip3 install keras_preprocessing==1.0.5 --no-deps
Preparing for build:
During build there was an icu error: no such package '@icu//': java.io.IOException:
so
For TF1.13.1 I changed the sha256 to 86b85fbf1b251d7a658de86ce5a0c8f34151027cc60b01e1b76f167379acf181 in file tensorflow/third_party/icu/workspace.bzl
from e15ffd84606323cbad5515bf9ecdf8061cc3bf80fb883b9e6aa162e485aa9761
bazel clean
then
python ./configure.py
Following settings:
WARNING: Running Bazel server needs to be killed, because the startup options are different.
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
You have bazel 0.19.2 installed.
Please specify the location of python. [Default is C:\Users\rb\AppData\Local\Programs\Python\Python37\python.exe]:
Found possible Python library paths:
C:\Users\rb\AppData\Local\Programs\Python\Python37\lib\site-packages
Please input the desired Python library path to use. Default is [C:\Users\rb\AppData\Local\Programs\Python\Python37\lib\site-packages]
Do you wish to build TensorFlow with XLA JIT support? [y/N]: n
No XLA JIT support will be enabled for TensorFlow.
Do you wish to build TensorFlow with ROCm support? [y/N]: n
No ROCm support will be enabled for TensorFlow.
Do you wish to build TensorFlow with CUDA support? [y/N]: y
CUDA support will be enabled for TensorFlow.
Please specify the CUDA SDK version you want to use. [Leave empty to default to CUDA 10.0]:
Please specify the location where CUDA 10.0 toolkit is installed. Refer to README.md for more details. [Default is C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.2]: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0
Please specify the cuDNN version you want to use. [Leave empty to default to cuDNN 7]:
Please specify the location where cuDNN 7 library is installed. Refer to README.md for more details. [Default is C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0]:
Please specify a list of comma-separated Cuda compute capabilities you want to build with.
You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus.
Please note that each additional compute capability significantly increases your build time and binary size. [Default is: 3.5,7.0]: 7.5
Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is /arch:AVX]: /arch:AVX2
Would you like to override eigen strong inline for some C++ compilation to reduce the compilation time? [Y/n]: y
then finally for cpu build:
cpu build:
bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
takes a lot of time
https://www.tensorflow.org/install/source_windows
https://github.com/sitting-duck/stuff/tree/master/ai/tensorflow/build_tensorflow_1.14_source_for_Windows
https://stackoverflow.com/questions/41070330/is-it-possible-to-use-tensorflow-c-api-on-windows