banner



How To Install Tensorflow On Windows

In this tutorial, nosotros will explain how to install TensorFlow Anaconda Windows. You will learn how to use TensorFlow in Jupyter Notebook. Jupyter is a notebook viewer.

TensorFlow Versions

TensorFlow supports computations beyond multiple CPUs and GPUs. Information technology means that the computations can be distributed across devices to improve the speed of the grooming. With parallelization, you don't demand to wait for weeks to obtain the results of training algorithms.

For Windows user, TensorFlow provides two versions:

  • TensorFlow with CPU support only: If your Machine does not run on NVIDIA GPU, y'all tin merely install this version
  • TensorFlow with GPU support: For faster computation, you tin download TensorFlow GPU supported version. This version makes sense only if you need potent computational chapters.

During this tutorial, the basic version of TensorFlow is sufficient.

Note: TensorFlow does not provides GPU support on MacOS.

Here is how to proceed

MacOS User:

  • Install Anaconda
  • Create a .yml file to install Tensorflow and dependencies
  • Launch Jupyter Notebook

For Windows

  • Install Anaconda
  • Create a .yml file to install dependencies
  • Use pip to add together TensorFlow
  • Launch Jupyter Notebook

To run Tensorflow with Jupyter, you need to create an environment within Anaconda. It means you lot will install Ipython, Jupyter, and TensorFlow in an appropriate binder inside our auto. On meridian of this, yous will add together one essential library for information scientific discipline: "Pandas". The Pandas library helps to dispense a data frame.

Install Anaconda

Download Anaconda version 4.3.1 (for Python 3.six) for the appropriate system.

Anaconda will help you to manage all the libraries required either for Python or R. Refer this tutorial to install Anaconda

Create .yml file to install Tensorflow and dependencies

It includes

  • Locate the path of Anaconda
  • Ready the working directory to Anaconda
  • Create the yml file (For MacOS user, TensorFlow is installed here)
  • Edit the yml file
  • Compile the yml file
  • Activate Anaconda
  • Install TensorFlow (Windows user only)

Footstep 1) Locate Anaconda,

The first footstep yous demand to do is to locate the path of Anaconda.

You will create a new conda environs that includes the necessaries libraries yous will use during the tutorials about TensorFlow.

Windows

If you lot are a Windows user, you can apply Anaconda Prompt and type:

C:\>where anaconda

How to install Tensorflow and dependencies for Windows

We are interested to know the name of the binder where Anaconda is installed considering we want to create our new environment within this path. For instance, in the pic above, Anaconda is installed in the Admin binder. For y'all, it tin can the same, i.due east. Admin or the user'southward name.

In the next, we will set up the working directory from c:\ to Anaconda3.

MacOS

for MacOS user, you lot tin use the Concluding and type:

which anaconda

How to install Tensorflow and dependencies

Yous will need to create a new folder inside Anaconda which volition contains Ipython, Jupyter and TensorFlow. A quick way to install libraries and software is to write a yml file.

Step two) Set working directory

Y'all need to specify the working directory where you lot want to create the yml file.

Every bit said before, it will be located inside Anaconda.

For MacOS user:

The Terminal sets the default working directory to Users/USERNAME. As yous can see in the figure beneath, the path of anaconda3 and the working directory are identical. In MacOS, the latest folder is shown before the $. The Last will install all the libraries in this working directory.

If the path on the text editor does non match the working directory, you tin can change it by writing cd PATH in the Last. PATH is the path yous pasted in the text editor. Don't forget to wrap the PATH with 'PATH'. This activeness will change the working directory to PATH.

How to install Tensorflow and dependencies

Open up your Terminal, and blazon:

cd anaconda3

For Windows user (make sure of the folder earlier Anaconda3):

cd C:\Users\Admin\Anaconda3

or the path "where anaconda" command gives you

How to install Tensorflow and dependencies

Step three) Create the yml file

You can create the yml file inside the new working directory.

The file will install the dependencies y'all need to run TensorFlow. Copy and paste this code into the Final.

For MacOS user:

touch hello-tf.yml

A new file named howdy-tf.yml should appear within anaconda3

How to install Tensorflow and dependencies

For Windows user:

echo.>hello-tf.yml

A new file named how-do-you-do-tf.yml should appear

Installing Tensorflow and dependencies

Step 4) Edit the yml file

Yous are ready to edit the yml file.

For MacOS user:

You can paste the following code in the Last to edit the file. MacOS user can use vim to edit the yml file.

vi hello-tf.yml

So far, your Terminal looks like this

Installing Tensorflow and dependencies

You enter an edit manner. Inside this fashion, you can, after pressing esc:

  • Press i to edit
  • Press w to salve
  • Printing q! to quit

Write the following lawmaking in the edit mode and printing esc followed by :due west

Installing Tensorflow and dependencies

Note: The file is example and intend sensitive. 2 spaces are required after each intend.

For MacOS

proper name: hello-tfdependencies:     - python=3.vi     - jupyter     - ipython     - pandas     - pip:         - https://storage.googleapis.com/tensorflow/MacOS/cpu/tensorflow-1.5.0-py3-none-whatever.whl

Code Caption

  • name: hello-tf: Name of the yml file
  • dependencies:
  • python=3.vi
  • jupyter
  • ipython
  • pandas: Install Python version 3.6, Jupyter, Ipython,and pandas libraries
  • pip: Install a Python library
    • https://storage.googleapis.com/tensorflow/MacOS/cpu/tensorflow-1.five.0-py3-none-whatever.whl: Install TensorFlow from Google apis.

Printing esc followed by :q! to quite the edit mode.

How to install Tensorflow and dependencies

For Windows User:

Windows does not accept vim programme, and then the Notepad is enough to consummate this step.

notepad hello-tf.yml

Enter following into the file

name: hello-tfdependencies:   - python=3.vi   - jupyter   - ipython   - pandas

Code Explanation

  • name: hello-tf: Name of the yml file
  • dependencies:
  • python=iii.vi
  • jupyter
  • ipython
  • pandas: Install Python version 3.six, Jupyter, Ipython,and pandas libraries

Information technology will open the notepad, you can edit the file from here.

How to install Tensorflow and dependencies

Annotation: Windows users will install TensorFlow in the next step. In this pace, you only prepare the conda environment

Step five) Compile the yml file

Yous tin compile the .yml file with the following code :

conda env create -f hello-tf.yml

Note: For Windows users, the new environment is created inside the current user directory.

Information technology takes times. It will take around one.1gb of space in your hd.

Installing Tensorflow and dependencies

In Windows

Installing Tensorflow and dependencies

Stride half-dozen) Activate conda environment

We are almost done. You take at present ii conda environments.

You created an isolated conda environment with the libraries yous will utilize during the tutorials. This is a recommended practice because each car learning projection requires different libraries. When the project is over, you can remove or non this environment.

conda env list

Installing Tensorflow and dependencies

The asterix indicates the default 1. Y'all need to switch to hello-tf to activate the environment

For MacOS user:

source activate hello-tf

For Windows user:

actuate hello-tf

Installing Tensorflow and dependencies

Y'all can check all dependencies are in the aforementioned environment. This is of import considering it allows Python to use Jupyter and TensorFlow from the aforementioned surround. If y'all don't run across the 3 of them located in the aforementioned folder, you need to start all over again.

For MacOS user:

which python which jupyter which ipython

Installing Tensorflow and dependencies

Optional: You lot tin can check for update.

pip install --upgrade tensorflow

Step 7) Install TensorFlow For Windows user

For windows user:

where python where jupyter where ipython

Installing Tensorflow and dependencies

As you can see, y'all now have two Python environments. The chief one and the newly created on i.e. hullo-tf. The main conda environment does non have tensorFlow installed only hello-tf. From the picture, python, jupyter and ipython are installed in the same surroundings. Information technology means, you can use TensorFlow with a Jupyter Notebook.

You need to install TensorFlow using pip command. But for Windows user

pip install tensorflow

How to install Tensorflow and dependencies

Launch Jupyter Notebook

This function is the same for both OS. Now, allow's larn how to import TensorFlow in Jupyter Notebook.

You lot tin open TensorFlow with Jupyter.

Annotation: Each time you desire to open TensorFlow, you lot need to initialize the surroundings

Y'all will proceed as follow:

  • Activate hello-tf conda environment
  • Open Jupyter
  • Import tensorflow
  • Delete Notebook
  • Close Jupyter

Step i) Activate conda

For MacOS user:

source actuate how-do-you-do-tf

For Windows user:

conda activate hello-tf

How to Launch Jupyter Notebook

Footstep two) Open up Jupyter

Later that, y'all can open Jupyter from the Terminal

jupyter notebook

How to Launch Jupyter Notebook

Your browser should open automatically, otherwise re-create and paste the url provided past the Terminal. It starts past http://localhost:8888

Inside the TensorFlow Jupyter Notebook, y'all can encounter all the files inside the working directory. To create a new Notebook, you lot simply click on new and Python 3

Note: The new notebook is automatically saved within the working directory.

How to Launch Jupyter Notebook

Step 3) Import Tensorflow

Inside the notebook, y'all can import TensorFlow in Jupyter Notebook with the tf alias. Click to run. A new cell is created beneath.

import tensorflow as tf

How to Launch Jupyter Notebook

Let'south write your first code with TensorFlow.

howdy = tf.constant('Hello, Guru99!') hello

A new tensor is created. Congratulation. You successfully install TensorFlow with Jupyter on your Machine.

How to Launch Jupyter Notebook

Step 4) Delete file

Y'all can delete the file named Untitled.ipynb inside Jupyer.

Steps to Launch Jupyter Notebook

Step 5) Close Jupyter

There are two ways of closing Jupyter. The first fashion is straight from the notebook. The 2nd way is by using the terminal (or Anaconda Prompt)

From Jupyter

In the main panel of Jupyter Notebook, just click on Logout

How to Launch Jupyter Notebook

You are redirected to the log out folio.

Steps to Launch Jupyter Notebook

From the last

Select the terminal or Anaconda prompt and run twice ctr+c.

The kickoff time you do ctr+c, y'all are asked to confirm y'all want to close down the notebook. Echo ctr+c to confirm

How to Launch Jupyter Notebook

Steps to Launch Jupyter Notebook

You have successfully logged out.

Jupyter with the main conda environment

If you desire to launch TensorFlow with jupyter for hereafter use, you lot demand to open up a new session with

source activate how-do-you-do-tf

If you don't, Jupyter will not detect TensorFlow

How to open Jupyter with the main conda environment

How To Install Tensorflow On Windows,

Source: https://www.guru99.com/download-install-tensorflow.html

Posted by: brightonguttend.blogspot.com

0 Response to "How To Install Tensorflow On Windows"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel