[PYTHON] Environment construction of TensorFlow + JupyterNotebook + Matplotlib on Windows version Anaconda (August 2017 version)

2017/8/24 update tensorflow 1.3.0 was released on 8/22 and 1.4.0 was released on 8/23. (Github RELEASE.md page) As of 8/24, the whl file is 1.3 in "Installing TensorFlow on Windows \ | TensorFlow" on the official TensorFlow website.

(tensorflow)C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.3.0-cp35-cp35m-win_amd64.whl 

Since 1.4.0 is released soon after 1.3.0 is released, the whl file is likely to be updated soon. Please check the latest information on the official website ☆ 彡

For such people & policy

--I want to analyze data with Jupyter Notebook --I want to use TensorFlow directly on Windows --Specify the primary source

Implemented environment & version

Work policy

Follow the "Installing TensorFlow on Windows" page on the official TensorFlow website.

Anaconda installation

Select and install Python 3.6 version 64-Bit (437 MB) from the Anaconda download page. Basically, it is OK if you follow the installer, but it is recommended that the Install Location is a short path (for example, C: \ Anaconda3). WS000013.JPG

Launch Anaconda Navigator after the installation is complete. WS000015.JPG

Create an environment for TensorFlow with Anaconda

Click "Environments" in the left pane of Anaconda Navigator to see a list of virtual environments managed by Anaconda. By default, there is only an environment called root. Create an environment for TensorFlow here. When you press the "Create" button at the bottom of the list, a dialog will be displayed. Enter an arbitrary environment name (example: tensorflow) and set the Python version to 3.5 to create. As an aside, it shows where the entity of the environment created at Location is.

The created tensorflow is displayed in the list of Environments. When you click on the created tensorflow, a triangle button "▶" will be displayed. Click it, and then click "Open Terminal" from the displayed menu. WS000018.JPG

This will launch a command prompt window. Make sure that the prompt starts with (~ tensorflow). WS000021.JPG

TensorFlow installation

In this command prompt window (Terminal window), you can find it in "Installing with Anaconda" on the official TensorFlow "Installing TensorFlow on Windows" (https://www.tensorflow.org/install/install_windows) page. Run the command to install TensorFlow. (Note) The whl file will change with the TensorFlow version upgrade! Please be sure to check the above page and copy from there.

For CPU only.


(tensorflow)C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.2.1-cp35-cp35m-win_amd64.whl 

If it is executed without any error, check the operation. Type python in this Terminal window, type import tensorflow in interpreter mode, and if no error occurs, it's OK. Exit interpreter mode with quit (). (The window remains the same) WS000020.JPG

Jupyter Notebook installation

If you look at Project Jupyter's official website, it says "For new users, we highly recommend installing Anaconda." Jupyter Notebook is installed from the beginning in Anaconda's default environment (root). Since Jupyter Notebook is not installed in the newly created tensorflow environment, the following command in the above Terminal window based on the Jupyter :: Anaconda Cloud page To install.

(tensorflow)> conda install -c anaconda jupyter

If you use the conda command for package management provided by Anaconda, related packages will be included in a batch. When you execute the above command, a list of related packages will be displayed and you will be asked to confirm it. Enter y to install it. WS000161.JPG

By the way, running the conda list command will list the packages installed in your environment. With pip list, only pip install will be displayed.

If you type> jupyter notebook in the Terminal window, the Jupyter Notebook process will start and the browser will start. It is OK if the screen below is displayed on the browser! WS000023.JPG

The URL of JupyterNotebook is http: // localhost: 8888, so if you are in a proxy environment, check "Do not use a proxy server for local addresses" in "Windows Control Panel> Internet Options> Connections> LAN Settings". Please keep it. WS000024.JPG

Install Matplotlib

An indispensable part of Jupyter Notebook is the visualization tool Matplotlib. If you look at the Matplotlib official HP installation page, Anaconda is introduced as an Installing pre-built package. Based on Matplotlib :: Anaconda Cloud, install it with the conda install command in the Terminal window in the same way as installing Jupyter Notebook. If Jupyter Notebook is running in the Terminal window, open a new Terminal in the tensorflow environment from Anaconda Navigator, or press Ctrl + C in the Terminal window where Jupyter Notebook is running to stop and run the Jupyter Notebook process. please.

(tensorflow)> conda install -c anaconda matplotlib

It will install the related packages as you did with Jupyter Notebook. WS000162.JPG

After installing, let's check the operation with Jupyter Notebook. Launch Jupyter Notebook and select "New"> "Python3" in the upper right corner. WS000028.JPG

Then, in a new window (tab), enter the following code in the editor part (the part called In []) and press the run button at the top. It is OK if the scatter plot is displayed as shown below.

%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt

#Random coordinates(x,y)To generate 10
x = np.random.randn(10)
y = np.random.randn(10)
print(x)
print(y)
#Draw a scatter plot
plt.plot(x,y,'o')
plt.xlabel("x")
plt.ylabel("y")

WS000160.JPG

Start and stop Jupyter Notebook

By the way, what is displayed on the Jupyter Notebook screen of the browser ("Contacts", "Desktop", etc.) is a list of files and folders of the folder where the jupyter notebook command was executed in the Terminal window. Therefore, when starting Jupyter Notebook, it is a good idea to create a working folder for Jupyter Notebook, cd to the working directory in the Terminal window, and then start it. It's a hassle to start Anaconda Navigator every time you start Jupyter Notebook. Therefore, you can start it by following the steps below.

--Start the Windows command prompt with Windos button + cmd. --Run the Anaconda installation directory \ Scripts \ activate command to activate the virtual environment. Specify the created virtual environment name (example: tensorflow) in the argument. --The prompt will change to something like (tensorflow). --Cd to your working folder and run the jupyter notebook command. WS000025.JPG

To stop the Jupyter Notebook, press Ctrl + C in the Terminal window where you ran the jupyter notebook command to stop the process.

that's all.

Recommended Posts

Environment construction of TensorFlow + JupyterNotebook + Matplotlib on Windows version Anaconda (August 2017 version)
[Tensorflow] Tensorflow environment construction on Windows 10
Python environment construction (Anaconda + VSCode) @ Windows10 [January 2020 version]
Anaconda environment construction on CentOS7
[Environment construction] @anaconda that runs keras / tensorflow on GPU
Memo of Linux environment construction using VirtualBox + Vagrant on Windows 10
Python environment construction memo on Windows 10
Python environment construction (pyenv, anaconda, tensorflow)
Use Tensorflow 2.1.0 with Anaconda on Windows 10!
Environment construction of python3.8 on mac
Environment construction of "Tello_Video" on Ubuntu
I built a TensorFlow environment on windows10
June 2017 version to build Tensorflow / Keras environment on GPU instance of AWS
Build Python3.5 + matplotlib environment on Ubuntu 12 using Anaconda
[0] TensorFlow-GPU environment construction built with Anaconda on Ubuntu
How to install the deep learning framework Tensorflow 1.0 in the Anaconda environment of Windows
python windows environment construction
Create a comfortable Python 3 (Anaconda) development environment on windows
Building a TensorFlow environment that uses GPU on Windows 10
Anaconda on Windows Terminal
Install Anaconda on Windows 10
Build TensorFlow on Windows
Make anaconda environment available from command prompt on windows
I built an environment for machine learning from scratch (windows10 + Anaconda + VSCode + Tensorflow + GPU version)
OpenJTalk on Windows10 (Speak Japanese with Python from environment construction)
Seaborn, matplotlib garbled characters resolved in Windows10, Anaconda virtual environment
Memo of python + numpy/scipy/pandas/matplotlib/jupyterlab environment construction on M1 macOS (as of 2020/12/24)
Double-click ipynb in windows + anaconda environment to open with jupyter-notebook
Using Docker (Hyper-V) with PyCharm on Windows 10 (as of August 2017)
Python environment construction procedure memo using Docker on Windows10 Home
Python + Anaconda + Pycharm environment construction
Introduced Tensorflow (Win / Anaconda environment)
Install cvxpy on windows, Anaconda
Prepare Chainer environment on Windows
Python environment construction (Windows10 + Emacs)
[Memo] Construction of cygwin environment
Anaconda3 python environment construction procedure
Build Python environment on Windows
Version upgrade of python Anaconda
Anaconda3 × Pycharm environment construction memo
Python environment construction and TensorFlow
Django environment development on Windows 10
NumPy and matplotlib environment construction
Build python environment on windows
Python environment construction under Windows7 environment
Ubuntu14.04 + GPU + TensorFlow environment construction
Notes on installing Anaconda 3 on Windows
Linux environment construction (on WSL environment)
Environment construction of python2 & 3 (OSX)
Example of building python development environment on windows (wsl2, vscode, pipenv)
Environment construction of monitoring server Zabbix 4.4 on CentOS7 (Apache2.4 / PHP5.4 / MariaDB5.5)
Environment construction of Tensorflow and Chainer by Window with CUDA (with GPU)
Error in ordinal number when importing Numpy in Anaconda environment of Windows
How to set up the development environment of ev3dev [Windows version]
Environment construction of python and opencv
Try running tensorflow on Docker + anaconda
Start of self-made OS 1. Environment construction
Install python2.7 on windows 32bit environment
Install an older version of Tensorflow
[Django] Memorandum of environment construction procedure
Install xgboost (python version) on Windows