[TensorFlow] If you want to run TensorBoard, install it with pip

wrap up

Introduction

Last time, I ran TensorFlow built with the conda command on the Anaconda environment and displayed a graph of the learning status on the TensorBoard.

[TensorFlow] Make IRIS compatible with TensorBoard by changing 3 lines

When building an environment with the conda command on the Anaconda environment, when TensorBoard was operated, the resource could not be found and an error occurred.

WARNING:tensorflow:IOError [Errno 2] No such file or directory: '/home/ubuntu/anaconda3/lib/python3.5/site-packages/tensorflow/tensorboard/webcomponentsjs/webcomponents-lite.min.js' on path /home/ubuntu/anaconda3/lib/python3.5/site-packages/tensorflow/tensorboard/webcomponentsjs/webcomponents-lite.min.js
WARNING:tensorflow:IOError [Errno 2] No such file or directory: '/home/ubuntu/anaconda3/lib/python3.5/site-packages/tensorflow/tensorboard/dist/bazel-html-imports.html' on path /home/ubuntu/anaconda3/lib/python3.5/site-packages/tensorflow/tensorboard/dist/bazel-html-imports.html
WARNING:tensorflow:IOError [Errno 2] No such file or directory: '/home/ubuntu/anaconda3/lib/python3.5/site-packages/external/dist/bazel-html-imports.html' on path /home/ubuntu/anaconda3/lib/python3.5/site-packages/external/dist/bazel-html-imports.html

This may be something you can do by tweaking the environment settings etc., but that eliminates the advantage of TensorFlow, which makes installation easier. I built a TensorFlow environment with pip / pip3 and checked the operation of TensorBord to see if it couldn't be helped.

Installation

Sample program

HelloTensorFlow.py


# -*- coding: utf-8 -*-
"""
Hello TensorFlow
"""
import tensorflow as tf

x = tf.constant(1.0, name='input')
w = tf.Variable(0.8, name='weight')
y = tf.mul(w, x, name='output')
y_ = tf.constant(0.0, name='correct_value')
loss = tf.pow(y - y_, 2, name='loss')
train_step = tf.train.GradientDescentOptimizer(0.025).minimize(loss)

for value in [x, w, y, y_, loss]:
    tf.scalar_summary(value.op.name, value)

summaries = tf.merge_all_summaries()

sess = tf.Session()
summary_writer = tf.train.SummaryWriter('log_simple_stats', sess.graph)

sess.run(tf.initialize_all_variables())
for i in range(100):
    summary_writer.add_summary(sess.run(summaries), i)
    sess.run(train_step)
sess.close()

Execution & result in TensorFlow environment installed with pip / pip3

If you install TensorFlow with pip / pip3, you will not get a resource shortage error even if you access TensorBoard compared to installing TensorFlow with Anaconda. The display of EVENTS and GRAPHS is normal.

・ ・ ・

```

Conclusion

TensorFlow should be installed and used with pip / pip3.

Recommended Posts

[TensorFlow] If you want to run TensorBoard, install it with pip
Don't write Python if you want to speed it up with Python
What to do if you can't install pyaudio with pip #Python
What to do if you get a UnicodeDecodeError with pip install
Tensorflow with Raspberry Pi. If you stumble with pip, solve it with virtualenv!
What to do if you can't install with pip in babun environment
Workaround if you get an error when trying to install PySide with pip
What to do if you can't pip install mysqlclient
Settings when you want to run python-mecab with travis
[OpenCV] When you want to check if it is read properly with imread
If you try to install Python2 pip after installing Python3 pip and it is rejected
How to install mysql-connector with pip3
If you want to become a data scientist, start with Kaggle
I want to know if you install Python on Mac ・ Iroha
Read this if you get SSL related errors with pip install! !! !!
When you want to use it as it is when using it with lambda memo
If you want to include awsebcli with CircleCI, specify the python version
What to do if you get Could not fetch URL 443 with pip
Note: What to do if pip install fails
If you want to create a Word Cloud.
Steps to install your own library with pip
If you want to enter the virtual environment with jupyter, nb_conda_kernels is recommended
If you want to make a discord bot with python, let's use a framework
What to do if pip install fails in Xcode 5.1
How to install pip
If you want to use Cython, also include python-dev
Error with pip install
When you want to filter with Django REST framework
Make it easy to install the ROS2 development environment with pip install on Python venv
[TensorFlow] I want to process windows with Ragged Tensor
I'm a windows user but want to run tensorflow
What to do if pip install fails to install dependent libraries
Until you install TensorFlow-GPU with pip in Windows environment
Install scikit.learn with pip
I want to run a quantum computer with Python
Install tweepy with pip and use it for API 1.1
What to do if you run python in IntelliJ and end with an error
If you want to put an argument in the closure function and execute it later
If you want to use field names with hyphens when updating firestore data in python
What to do if you get an Undefined error when trying to use pip with pyenv
Solution when you want to use cv_bridge with python3 (virtualenv)
[Python] If you suddenly want to create an inquiry form
[Road to intermediate Python] Install packages in bulk with pip
Until you can install your own Python library with pip
Can't find the package you installed with pip install --user?
Use aggdraw when you want to draw beautifully with pillow
Steps to install a Git cloned package locally with pip
Move what you installed with pip to the conda environment
What to do if you can't sort files with subscripts
For those who want to start machine learning with TensorFlow2
I want to install a package from requirements.txt with poetry
What to do if `pip install matplotlib` fails on Mac
If you want your colleagues to use the same language
What to do if pip install mysqlclient fails on MacOS
EC2 / Amazon Linux2: What to do if you get an "unable to execute'gcc': No such file or directory" error with pip install
When moss with pip install
Install github repository with pip
To run gym_torcs with ubutnu16
How to install OpenCV on Cloud9 and run it in Python
When it is troublesome to copy what you built with vue
What to do if intellisense doesn't work with Anaconda + VSCode + Tensorflow2.1