Udemy

Installing TensorFlow and Environment Setup

A free video tutorial from Jose Portilla
Head of Data Science at Pierian Training
Rating: 4.6 out of 5Instructor rating
86 courses
4,652,302 students
Installing TensorFlow and Environment Setup

Lecture description

Learn how to install Tensorflow on your computer and setup using our environment file.

Learn more from the full course

Complete Guide to TensorFlow for Deep Learning with Python

Learn how to use Google's Deep Learning Framework - TensorFlow with Python! Solve problems with cutting edge techniques!

14:07:23 of on-demand video • Updated April 2020

Understand how Neural Networks Work
Build your own Neural Network from Scratch with Python
Use TensorFlow for Classification and Regression Tasks
Use TensorFlow for Image Classification with Convolutional Neural Networks
Use TensorFlow for Time Series Analysis with Recurrent Neural Networks
Use TensorFlow for solving Unsupervised Learning Problems with AutoEncoders
Learn how to conduct Reinforcement Learning with OpenAI Gym
Create Generative Adversarial Networks with TensorFlow
Become a Deep Learning Guru!
English [CC]
(slow futuristic music) -: Welcome back everyone, to the course installation and setup lecture. In this lecture we'll be showing you how to download Anaconda, how to restore the environment file that's included with the zip download for this course. And then a quick overview of Jupyter in case you haven't used it before. Let's go to our browser and go to anaconda.com/download. Okay, so here I am at anaconda.com/download. And keep in mind, sometimes Anaconda changes the look or styling of this site, but the content should be the same. It's where you can download the Anaconda distribution. The Anaconda distribution is just a high performance distribution of a lot of data science packages for Python. It's extremely popular in the data science space, which is why we're gonna be using it here. So the first thing we need to do is actually download the Anaconda distribution, and it comes for the Windows, Mac OS, or Linux or Ubuntu Systems. And Windows and Mac OS pretty straightforward. You just click on whatever your operating system is, and then hit Download and then it's going to be a graphical installer. So, you basically just follow the steps that it says on the graphical installer. The Mac OS is essentially the same deal, graphical installer, click Download, and then follow the steps. Linux, if you click on that link, it's going to be an installer for you, which you'll have to download and run at the command line. So, in case you ever get stuck on either Windows, Mac OS, or Linux, there's really nice helpful links here that says "How to Install Anaconda." You can go ahead and click on that, and if you were on Linux, it will take you to the direct commands for Linux. So essentially, you just, in your browser download the Anaconda installer for Linux, and then, two is optional, so you can basically skip that. And then three, is enter the following to install Anaconda for Python 3.6. So basically, you just say Bash, and then wherever the location is of that .sh file that you just downloaded from Anaconda. Then you can continue on with the rest of these steps. So that is for Linux. If you come over here to where it says Installation, it will then take you to the more detailed information for Windows and Mac OS users. You can click here on Windows, it'll say, "Download the Anaconda installer," and then you can basically follow along here. Now there is a quick note I want to make about installing with Anaconda to your PATH variable. So you'll notice here, one of the very first things you do as you're installing, is to decide whether you want to add Anaconda to your PATH environment variable. Anaconda themselves recommend that you don't do this because it can interfere with prior distributions of Python on your computer. We're going to assume that if you're downloading Anaconda, you want this to be your main distribution of Python. So make sure you click to add Anaconda to your PATH environment variable. So that's a really important step. If you don't end up clicking that, what's gonna happen is you have to add the PATH manually and if you want, you can do that as well, but you might as well do it since the beginning. So again, make sure you click on this, where it says, "Add Anaconda to my PATH environment variable." Even though it says "Not Recommended," we recommend it for this course. All right, so that's it. Go ahead and install Anaconda and then we'll show you how you can restore the environment file. Let's jump back to our desktop. Okay, so by now you should have downloaded and installed Anaconda onto your computer. So it's time to restore the environment file. Remember that you should have downloaded the zip file by now from either the FAQ lecture, or the course overview lecture. If you haven't done so, go back and view the course overview lecture, download the zip file that's a resource there and then unzip it somewhere on your computer. Then the next step, if you're on Mac OS or Linux, open up your terminal so that you can just do a search for terminal on your computer, and you should find it. If you're a Windows user, go ahead and open up the command prompt or cmd. Another alternative is to open up the Anaconda prompt, and that's especially useful if, in case you ever get errors like, "Conda not recognized," as you go throughout this installation process. So again, Windows users either use cmd, or if that's giving you trouble, use the Anaconda prompt. Again, just search your computer for it. All right, so once you're in your terminal or command line, what you're going to do is use cd to change directory to wherever the unzipped course notes are. Then, you're going to run the following command, "Conda space env space create space dash f space tfdl underscore env dot yml. So that's going to then use the environment file that's provided for you and create an environment. That way you're using all the same versions of all the libraries we use while making this course. Once you've created the environment file, you can then activate it. If you're on Mac OS or a Linux, you're going to use Source Activate TF Deep Learning. That's the name of the environment. If you're on a Windows computer, then you're going to use just Activate TF Deep Learning. Okay, so I'm gonna actually walk through these steps on a computer. So, let's hop over to my command line. Okay, so real quick, I wanna make the note again, you should have already unzipped the TensorFlow bootcamp file, that zip file that comes from the resource notes, and have something that looks like this. You'll see a bunch of folders, if you click on one of these folders, you'll notice that there's these .ipynb files. So those are the notebook files we'll be using throughout the course. So again, here you can see the .ipynb files and then also you'll sometimes see some data files. So the other important thing to note, is that you have this .yml file. That's gonna be the environment file that we'll be using for this course. So we need to somehow get to this TensorFlow bootcamp. In order to do that, we'll come over to our command prompt. So here I am now at my command prompt. So, what we're gonna do is use cd to get there. Notice that I'm actually already here. So, in case you need to move around, you can use "cd dot dot" and that will go back up a directory. So if I did it again, I would say, "cd dot dot," and now I'm at my user directory. If I need to go into a directory, I just say, "cd" and then begin to type the directory's name. And you should be able to then Tab auto-complete and it will auto-complete the next directory over. So then this is changing directory into the data course's, and then it can change directory again, into TensorFlow bootcamp. So again, it's cd dot dot to go back up one, and then cd dot and then- or cd and then whatever the name of your directory is to get there. Once you're actually located in the TensorFlow bootcamp folder, it's time to create the environment file. So you're gonna run this line, you're gonna say, "Conda space env space create dash F" and then you'll say, "TF DL underscore env dot yml." So this is basically telling Conda to create this environment file. And to double-check that you're in the correct directory, you should be able to, once you start typing TFD, hit Tab and it should auto-complete for you. If it does not auto-complete, that's probably an indicator that you're not in the right directory. So go ahead and then run this line, "conda environment create tfdl environment dot yml." So I've already run that. Once you've done that and created the file, it should be kind of a bunch of pop-ups asking you to create stuff or install stuff. You may need to click Y on your keyboard to give it permission to do stuff. The next step is to actually activate the environment. So that should have created an environment called TF Deep Learning. So then you're gonna say, "Activate," or remember if you're on Mac or Linux, you'll say, "Source Activate TF Deep learning." Hit Enter and then you'll eventually see the following. In parenthesis, you'll see TF Deep Learning. That's basically indicating that right now, you're in this virtual environment of TF Deep Learning. If you ever want to escape outta this environment you'll just say, "Deactivate," deactivate. Actually, you just need to say deactivate. There you go. So again, if you want to go into the virtual environment you'll say, "Activate Deep Learning" or "Activate TF Deep learning." If you're on Mac or Linux, you'll say, "Source Activate" or "Source Deactivate." Okay, once you've done that, what you're gonna do is type Jupyter Notebook and hit Enter. This should automatically open up a browser for you. If it does not, go ahead and copy this URL along with the token link, especially if it's your first time ever using Jupyter. So, if you don't see your browser automatically pop-up, there should be a nice link here that you can just copy and paste into your browser, and remember to copy along with that token. Okay, so let's hop over to the browser. Okay, so your browser should look something like this. In order to start a new notebook, what we're gonna end up doing is say, "New" and then underneath notebook, you'll see Python 3, go ahead and click on it. This may say something like Conda route or Conda default. It should say Python 3, but whatever is underneath this notebook, go ahead and click on it. So here I have Python 3, and then we're gonna make sure that everything's working for you. So we'll say, import TensorFlow as TF, do Shift+Enter to run a cell. The Jupyter Notebook system uses cells. And then we'll say, "Hello is equal to TF constant" and you'll type the wor- the string, "Hello world," do Shift+Enter there, and then you'll say, "sess is equal to TF session." And don't worry, we'll go over this code in a lot more detail in the future. This is just to check that TensorFlow is working for you. And then you're gonna do the following. You'll say, "Print sess dot run" and in parentheses, "Hello." So you're just passing in that hello variable you made. Do Shift+Enter to run this and you should get out a string that says, "Hello world." And that shows that you successfully ran TensorFlow on your computer and you are all ready to go. Okay, so that's it. If you already know how to use Jupyter you can go ahead and skip to the next lecture. Just now for one or two minutes, I'm gonna go over a couple of things to know about the Jupyter Notebook. So, in the Jupyter Notebook you have this cell structure, and the cell structures really useful because it allows you to basically segment portions of your code. Something else you can do is write markdown text into this. So, I'm going to say, "view toggle header," "view toggle toolbar." You may have already seen these. I untoggle them automatically. If you wanna change the name of this notebook just click here on Untitled, and say something like, My New Notebook. Then hit Rename, that renames your notebook. So if you come back out to Home, you'll notice it's My New Notebook now. The other thing's you can do is create markdown text. So right now this is a code cell that I can change this to be markdown, and then I can write myself little notes here. So, here are some notes. And then do Shift+Enter to have those little notes. And this also copies markdown command. So if you're familiar with markdown, you can do sizing or italics, those kind of things with those markdown commands in the Jupyter Notebook. The next thing I wanna show you is really useful and it's Shift+Tab+Tab. So if you create a string, so we'll say S is a string, do Shift+Enter to run that cell, and then if you do S dot and then hit Tab, you'll find a list of all the methods available for that string. Now keep in mind, this string has to already be defined in a cell above. If I try to do this in the same cell, so I say X is equal to string, and then within the same cell I say, X dot and hit Tab, nothing's gonna happen because technically, the Jupyter Notebook doesn't know that this is already a global variable. You need to run this cell, in order for that to work. So then if I run this, do x.tab, then I can see everything. Once you have that ready to go, you can do Shift+Tab off methods to see their doc strings. And you can also do this off functions. So again, you can do something like, TF session and then do Shift+Tab here, and you should be able to see the documentation string for any classes or functions or methods. Remember, these need to be defined before you can see anything. All right, That's really all we need to know about the Jupyter Notebook. Again, it's Shift+Enter to run a cell. If you want to input a cell, you can just go to Cell or Insert and then say, "Insert cell above" or "Insert cell below." And that's really all you need to know. All right, thanks everyone and I'll see you at the next lecture.