Installing TensorFlow and Environment Setup

Jose Portilla
A free video tutorial from Jose Portilla
Head of Data Science, Pierian Data Inc.
4.6 instructor rating • 32 courses • 2,251,677 students

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 [Auto] Welcome back everyone. The course installation and setup lecture in this lecture will 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 Jupiter in case you haven't used that before. Let's go to our browser and go to Anaconda. Com slash download. OK so here's the. Anaconda dot com slash download. And keep in mind sometimes Anaconda changes the look or styling of the site but the content should be the same. It's where you can download the Anaconda distribution. The 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 going to 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 a boon to systems and windows a Mac OS pretty straightforward. You just click on whatever your operating system is and then download and then it's going to be a graphical installer. 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 again you ever get stuck on either Windows Mac or us or Linux. There's a really nice helpful links here that says how to install Anaconda. You can go ahead and click on that and if you run Linux it will take you to direct commands for Linux. So essentially you just in your browser download Yianna installer for Linux and then 2 is optional so you can basically skip that and then three is the following to install an account for her 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. They can continue on the rest of these steps so that is for Linux. If you come over here 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 and they'll say the Nikon installer and you can basically follow along here. Now there is a quick notes. I want to make about installing with anaconda to your path variable to Lotus 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 and Akala themselves recommend that you don't do this because it can interfere with prior distributions of Python in your computer. We're going to assume that if your Delanie anaconda you want this to be your main distribution of Python. So make sure you click to add anaconda to your path environment variable. That's a really important step. If you don't end up clicking that what's going to happen is you have to add the PAF manually and if you want you can do that as well. But you might as well do it since the beginning. So again to make sure you click on this word says add anaconda to my path environment variable. Even though it says not recommended we recommend that 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. OK so by now you should have downloaded 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 fakey 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 a Mac OS or Linux. Open up your terminal so that you can just do a search for terminal in your computer and you should find it. If you're a Windows user go ahead and open up the command prompt or CNID. In other alternative is to open up the Anaconda prompt and that's especially useful if in case you ever get errors like Konda 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 or so once you're in your terminal or command line where you're going to do is use CD to change directory to where ever the unzips course notes are. Then you're going to run the following command Kano's space Ian EMV space create space dash f space FDL underscore Ian V Y and L. So that's going to then use the environment file that's provided for you and create an environment that we'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 that activate it. If you're on a Mac OS or Linux you're going to use source. Activate T.F. deep learning that's the name of the environment. If you're on a Windows computer then you're going to use just activate T.F. deep learning. Ok so I'm going to actually walk through these steps on a computer. So let's hop over to my command line. OK so real quick I want to make the note again. You should have already unzipped the tensor flow 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 IPY in the files so there's the notebook files we'll be using throughout the course. So again here you can see the IPY and B files and then also you'll sometimes see some data files. So the other important thing to note is that you have the dot y m l file. That's going to be the environment file that we'll be using for this course. So we need to somehow get to this tensor flow bootcamp in order to do that we'll come over to our command prompt. So here I am now at my command prompt. So all 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 you see the dot dot and that will go back up a directory. So if I did it again I would say CD that thought and now that 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 autocomplete and it will auto complete the next directory over. So then this has changed directory into the data courses and then it can change directory again into tents or float bootcamp. So again see the dot to go back up 1 and then see the dot and then her CD and then whatever the name of your directory is to get there. Once you're actually located in the tents flow bootcamp folder. It's time to create the environment file. So you're going to run the line you're going to say Konda space into the space. Create dash F and then you'll say T.F. DL underscore E and V. Y M L. So this is basically telling conver 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 T.F. d hit tab and it should autocomplete for you. If this is if it does not autocomplete that's probably an indicator that you're not in the right directory so go ahead and then run this line. Can the environment create FDL environment that why m-L. So I've already run that. Once you've done that and you've 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 deep learning. So then you're going to say activates or remember if you're a Mac or Linux you'll see source activate T.F. deep learning enter and then you'll eventually see the falling imprint you'll see TFT learning that's basically indicating that right now you're in this virtual environment of TFT learning if you ever want to escape out of this environment. You'll just say de-activate deactivates actually you just need to say de-activate. There you go. So again if you want to go into the virtual environment you'll say activate the learning or activate TFT learning. If you're on a Mac or Linux you'll see a source activate or source deactivate. OK once you've done that what you're going to do is type Jupiter notebook and hit enter. This should automatically open up a browser for you. If it does not go ahead and copy this you are along with the token link if especially if it's your first time ever using Jupiter. So if you don't see your browser automatically pop up there should be a nice link here. They can just copy and paste into your browser. And remember to copy along with that token. OK. Let's hop over to the browser. OK so your browser should look something like this in order to start a new notebook. We're going to 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 Can the router 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 going to make sure that everything's working for you. So we'll say import tents or flow as T.F. do shift enter to run a cell that you put Jupiter notebook system uses cells and then we'll say hello is equal to T.F.. Constance you'll type the the string hello world do shift enter there and then you'll say S E S S is equal to T.F. session and the way we'll will go over this code a lot more detail in the future. This is just the check that senseful is working for you. And then you're going to do the following you'll say Prince as Iesous that run an imprint c.s. Hello. So just passing in that hello variable you made do shift and try to run this you should get out a string that says Hello world. And that shows you successfully ran tensor flow on your computer and you are all ready to go. OK. So that's it. If you already know how to use Jupiter you can go ahead and skip to the next lecture just now for one or two minutes. I'm going to go over a couple of things to know about the Jupiter note book. So in the Jupiter note book you have this cell structure and the cell structure is really useful because it allows you to basically segment portions of your code something else you can do is write Mark down text into this. So I going say View toggle header you toggle toolbar. You may have already seen these I toggle it automatically if you want to change the name is no book just click here on untitled and say something like my new notebook that hit rename that renames your notebook. So if you come back out tome you'll notice it's my new notebook now. The thing is you can do is create markdown text so right now this is a code cell that I can change just to be marked down. 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 marked down commands so if you're familiar with Mark down you can do sizing or italics those kind of things with those marked on commands in the notebook. The next thing I want to show you is really useful and it's just tab and tab. So if you create a string so say as is a string do shift enter to run that cell. And then if you do as 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 dots and hit tab. Nothing's going to happen because technically the Jupiter note book doesn't know that this is already a global variable. You need to run the cell in order for that to work. So then if I run this do X that tab then I can see everything. Once you have that ready to go you can do shift tab off methods to see the doc strings and you can also do this off functions. So again you can do something like T.F. session and the new 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. But that Jupiter notebook again it's shift enter to run a cell if you want to input a cell. You could just go to sell it or insert and then say insert cell above or insert cell below. And that's really all you need to do. All right thanks everyone. I'll see you at the next lecture.