Tech With Tim Logo
Go back

Introduction & Setup

This tutorial is dedicated to setting up a virtual environment and installing tensorflow and keras into that environment so we are ready to start coding in later environments. Please closely follow along with the video or text below as you will not be able to continue with the tutorial if you do not setup your environment properly.

IMPORTANT If you have a CUDA enabled GPU you can follow this video to download and install tensorflow GPU version. The GPU version of tensorflow is much faster than the CPU version and this should save you quit a bit of time when training models.

Installing an IDE

Although this is not necessary I highly recommend you download and install the pycharm IDE. This is what I will be using throughout all of my videos and it makes setting up tensorflow and other packages much easier.

If you'd like to learn how to use Pycharm you can check out these videos.

Installing Anaconda

We are going to be using anaconda to setup our virtual environment. You can download the latest version from here.

IMPORTANT When running through the installation process please check the box to ADD ANACONDA TO PATH. kuva_2023-04-28_184836403.png

Creating a New Virtual Environment Now we are going to create a new virtual environment using anaconda and python 3.6.

  1. Open up a new command prompt window and type the following: conda create -n tensor python=3.6 (tensor can be replaced with whatever you want to name your environment) kuva_2023-04-28_184901355.png

  2. Activate your virtual environment by typing the following: activate tensor (replace tensor with the name of your environment) kuva_2023-04-28_184920998.png

  3. Install the following packages: pip install _____ (replace _____ with the package names below)

  • tensorflow
  • sklearn
  • pickle
  • numpy
  • keras kuva_2023-04-28_185001665.png kuva_2023-04-28_185014272.png kuva_2023-04-28_185024235.png kuva_2023-04-28_185036106.png kuva_2023-04-28_185047260.png

Creating a New Pycharm Project

The last steps are to setup a new pycharm project that uses the environment we just created. To do this we first need to create a New Project.

Step 1: Create a new project.

  • Open Pycharm
  • Select "New Project" and enter a name. kuva_2023-04-28_185106625.png kuva_2023-04-28_185121689.png

Step 2:

  • Create a new python file from within the project direcotry
  • Name it whatever you want. kuva_2023-04-28_185136518.png

Step 3:

  • Configure the Project Interpreter

Go to File > Settings kuva_2023-04-28_185151368.png Select Project: "Name" and then click "Project Interpreter" kuva_2023-04-28_185206735.png Click on the gear icon and then click "add" kuva_2023-04-28_185222902.png Select Conda Environment, Click existing environment and then click on the three dots. kuva_2023-04-28_185241094.png Find your conda environment from the file directory and select the pythonw.exe file. NOTE: The default location for your environment is: C:/Users/Your_User/Anaconda3/envs/environment_name/pythonw.exe kuva_2023-04-28_185305802.png

Now we can test that everything is working by typing import tensorflow in our python file and running it.

import tensorflow

If this executes with no errors then everything has been setup correctly.

Design & Development by Ibezio Logo