With the Windows 10 Anniversary Update, Ubuntu became available on Windows, so I installed TensorFlow.
I referred to the following article.
[1] Let's install Bash on Ubuntu on Windows! [2] Install Anaconda on CentOS using pyenv [3] TensorFlow Installation Using conda [4] GUI by Bash on Ubuntu on Windows + Xming [5] Cygwin Absolute Killing Man-Until Physical Nerds Can Calculate Numerically with Windows Subsystem for Linux- [6] Bash on Ubuntu on Windows and X Window combined to display Japanese and input Japanese
Ubuntu on Windows includes python, but since the version is 2 and it is necessary to add a package, I decided to include Anaconda. However, since the original python is kept, try installing it using pyenv as in Reference article [2]. I did. The procedure is as follows.
Install Git for the pyenv installation.
$ sudo apt-get install git
Install pyenv using Git.
$ git clone https://github.com/yyuu/pyenv ~/.pyenv
Add pyenv preferences to .bachrc.
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(pyenv init -)"' >> ~/.bashrc
source ~ / .bashrc or restart bash
$ pyenv install --list
Check the version of Anaconda that can be installed with
$ pyenv install anaconda3-4.1.0
Install with.
$ pyenv global anaconda3-4.1.0
$ pyenv rehash
Now, set the Python environment to Anaconda.
There are several ways to install TensorFlow, but since Anaconda is included,
$ conda install -c conda-forge tensorflow
Install with. However, you can only install the CPU version with this.
Now, if you run the sample program in TensorFlow Introduction in Python,
0 [ 0.82097143] [-0.14609614]
20 [ 0.30302274] [ 0.18841095]
40 [ 0.15555] [ 0.26946762]
60 [ 0.1151993] [ 0.29164591]
80 [ 0.10415875] [ 0.2977142]
100 [ 0.1011379] [ 0.29937458]
120 [ 0.10031134] [ 0.29982889]
140 [ 0.10008518] [ 0.29995319]
160 [ 0.10002329] [ 0.2999872]
180 [ 0.10000639] [ 0.2999965]
200 [ 0.10000175] [ 0.29999906]
So, I think TensorFlow installation is OK for the time being.
Since there is no GUI for Bash alone, I will make it possible to use the X11 application. The quickest way is Xming like Reference article [4]. Is the way to use. (There is also VcXsrv Windows X Server as software similar to Xming.)
After installing Xming or VcXsrv, install the X11 apps and libraries. (You don't have to install x11-apps. If you have an X11 app such as xterm, the required libraries will be installed.)
$ sudo apt-get install x11-apps
Then add your preferences to your .bashrc.
$ echo 'export DISPLAY=localhost:0.0' >> ~/.bashrc
This should work for X11 related apps, but when I try to display a graph using matplotlib in Python,
OMP: Error #100: Fatal system error detected.
OMP: System error #22: Invalid argument
I get an error saying that it stops. It's not limited to matplotlib, but it seems that an error occurs in a package that uses MKL.
$ conda install nomkl
It seems that each package needs to be changed to a non-MKL compatible version.
For the time being, in my environment, I was able to display the graph with matplotlib. ~~ However, it seems that the Japanese display in the graph cannot be done well as it is. ~~ Japanese input can be done by referring to Reference article [6]. Then the Japanese in the matplotlib graph is
from matplotlib.font_manager import FontProperties
fp = FontProperties(fname='C:\Windows\Fonts\YuGothM.ttc', size=14)
Font path
from matplotlib.font_manager import FontProperties
fp = FontProperties(fname='/mnt/c/Windows/Fonts/YuGothM.ttc', size=14)
If you write like, it will be recognized from Bash.