Introduction & Setup
Subscribe to Tech with Tim
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.
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.
Creating a New Virtual Environment Now we are going to create a new virtual environment using anaconda and python 3.6.
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)
Activate your virtual environment by typing the following: activate tensor (replace tensor with the name of your environment)
Install the following packages: pip install _____ (replace _____ with the package names below)
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.
- Create a new python file from within the project direcotry
- Name it whatever you want.
- Configure the Project Interpreter
Go to File > Settings Select Project: "Name" and then click "Project Interpreter" Click on the gear icon and then click "add" Select Conda Environment, Click existing environment and then click on the three dots. 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
Now we can test that everything is working by typing import tensorflow in our python file and running it.
If this executes with no errors then everything has been setup correctly.