Python Tutorial: Anaconda - Installation and Using Conda

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hey there. How's [it] going everybody in this video? We'll be learning how to get started with Anaconda by continuum analytics now if you don't know what Anaconda is it is a data science platform that comes with a lot of stuff right out of The box so it comes with a python Distribution a package manager called conda a way to manage environments and a lot of other Libraries and packages pre-installed now these packages are usually related to data science So it comes with things like numpy [Sci] [Pi] [jupiter] Notebooks and things like that now the number one question [people] usually have when they first hear about something like Anaconda is why would you need it? So what benefit you get from Anaconda as opposed to just installing these packages through pip or something like that Well, you shouldn't feel obligated to use Anaconda. It's really just an option that some people prefer So if you're getting along, just fine with regular python and haven't run into any problems then there's really no huge reason to switch But a lot of people especially those in the data science community who might not be full-time developers they find that Anaconda simplifies a lot of common problems that beginners run into and it's also good to use in classrooms So that you know your students are all on the same page, [so] things like installing python on multiple platforms separating out different environments Dealing with not having correct privileges and getting up and running with specific packages and libraries all of those are things that Anaconda can help with so let's go ahead and download Anaconda here, and we'll walk through some of the features So I'm here on the anaconda download Page and if you just Google python Anaconda then this should be one of the first results, [and] you can also [Google] the company name which is continuum analytics So at the top of the download page here We can see that there [is] a link for the list of packages that comes pre-installed with Anaconda So I'm going to go [ahead] and open this up and I'm going to pull up python 3.5 now if we scroll down here then you can see that it comes with a lot of stuff right out of the box So all those packages can take up a lot of space now If hard drive space is an issue for you And you don't want to download all those packages Then they do offer a download here called mini conda and mini Conda is a small bootstrap version that comes with their python Distribution essential packages and conda and we'll talk about Conda in just a second but we're going to go ahead and download the entire thing so that's going to include all of the packages that it comes pre-installed with So the download is pretty straightforward, so I'm going to download this for my mac But if you're on a windows or a linux machine, and you can just choose one of those for your operating system So I'm just going to choose os x here and then I'm going to download this graphical installer So I'm going to go ahead and cancel out of this here, and then I'll just wait for this download to finish [ok] so once that is downloaded. Let's go ahead and open that [up] and run through the installer now We're pretty much [just] going to be clicking through and accepting defaults here So I'm going to go ahead and agree [to] these and I'm going to stall only for me And I'm going to leave the default location and so now I'm just going to fast forward until this is finished installing Ok so now that that download is finished [I'm] just going to go ahead and close down my browser here and pull up my terminal okay? So when we install it anaconda, [it] should have automatically added that to our path So to test this we can just go ahead and type in python now If everything installed correctly and we should have a python version 3 here and you can see that It's using this anaconda distribution, and if you install the full version of Anaconda [then] we should be able to import certain packages that were included with that download so I should just be able to type in import numpy and run that and you can see that that didn't give us an error so that package does exist and just To test that further let's go ahead and also import matplotlib and see if that works so you can see that that worked also So we already have a couple of packages here ok so now let's just go ahead and exit out [of] python here And now I'm just going to go ahead and clear my screen. So that's all there is to installing Anaconda and depending on what kind of system You're on a lot of people find that kind of installation of python much easier than doing it manually Especially whenever you get a lot of popular packages out of the box now if you do need to add more packages We still have pip which most of you are probably familiar with and if you'd like to learn more about pip then I do have a separate video on that, but if I go ahead and type in pip list Then you can see that it lists out all [of] the packages that came pre-installed with Anaconda Now Anaconda also comes with its own package manager called conda And conda is useful because we can [use] it to install non python packages and dependencies So it can install some things that wouldn't necessarily make sense with pip so we can view all the commands that we can use with Conda by running Conda - - [he'll] Now you can see that a lot of these conda commands are similar to our pip commands, so in here We have list and search and install and things like that so let's go ahead and clear the screen here and let's run conda list now if we compare this to our pip list then we notice that all of these with the Py tags here are python packages that were also listed in our pip list so if you ever need to install [additional] packages Then you can try running Conda install and if for some reason you have any issues [with] using Conda or just prefer pip then you can still use pip install? to install packages now one thing that's really interesting and useful about conda is that you can use it to manage your environments - so some of you may have seen my video on virtually envy where you can make isolated virtual environments for different projects and Conda can do that as well, and it even has a few advantages over birthday and B So let's take a look at how we can create some virtual environments now I'm not going to go into too much depth about why we should be using virtual environments I covered that in some previous videos But basically what they're used for is when we want to work on multiple projects these projects may use different versions of different packages and possibly even different versions of python So instead of trying to get all of our projects to conform to [our] global installations and versions We can instead just create these separate environments that have the specific packages and versions that we need So [let's] say that we wanted to start working on a flask app now to create a new environment for this Application using conda then we can just say conda create and then I'm going to do a - - name here I'm just going to call this my app And now I'm going to go ahead and pass in some Starting packages that we want so I'm going to say flask and sql alchemy Now you have to have at least one starting package when you create a new environment with Conda But if you don't want one then you can just pass in something like pip or python But it is required to have a but in this case We're going to be building a flask application anyway So let's just go ahead and pass flask and sql alchemy in as those packages And then it's going to show you what it's going to install and let's just go ahead and [hit] yes Okay, so now we want to activate that new environment that we just created now This is going to be different on a Mac than on windows on windows. I believe you can just say something [like] activate my app, but on Mac This [is] actually going to be source activate my app So if I run that you can tell that we're in our new environment here because it added the name of our environment above our Prompt right here and if I clear my screen You can see that that still stays there and once we have that environment Activated if we do a pip list then you can see that we only have our base flask and sql alchemy Packages and on Mac or linux if we want to see the path to which python we're using then we can run which Python and you can see that the python that we're using is now within this my app environment, okay? And once you're done with your environment and want to deactivate it on windows. You can just say Deactivate but on Mac or linux that's actually going to be source deactivate So we can also use content to create environments using different versions of python also? so let's say that I wanted to create an environment for the same flask at but using python [2] 7 instead of python 3 5 Now I'm just going to bring back up that command that we used to create [that] environment, but instead I'm just going to change this name to my app 2 7 and I'm also going to pass in this keyword here [python] equals two point seven now this python doesn't have Dashes before so it's not an option. It's just python [two] seven there So now I'm going to go ahead and run that and it's going to tell us what packages It's going to install so I'm going to go ahead and hit yes on that and once that environment is done installing Now I'm just going to go ahead and activate it. So I'm going to say Source activate my app [two] seven and now that we have [that] activated let's go ahead and Run python Within here, and you'll see that the version of python that we have here is python 2.7 So specifying that version when we created our environment work for luckly, okay? So now let's just go ahead and exit out [of] python and let's go ahead and also deactivate our Virtual environment there now one useful thing that we can do with conda is that we can view our environments that we've created so if I say conda ENv list and list those out then you can see that both of the environments [that] we created are there and currently this default when this root one is the one that's activated and if you ever want to remove [an] environment Then we can just say conda remove and then we'll pass in the name of our environment So I'll grab this my app here and paste that in and now we need to Specify all of the packages and if we just want to delete the [entire] thing then we can just say all it's going to ask us if we want to continue, and we can just hit yes and Now if I relist those environments, then you can see that the my app is gone So I'm going to go ahead and do that same thing for my 2.7 also say yes, and Clear the screen and if I list those out then you can see we [just] have our root and a content environment Okay, so I think that's going to do it for this video I hope this gave you an idea of why some people would prefer using Anaconda for their python development now It's not for everyone, but if you are someone who is working in Data science? Then it really does come with some nice packages out of the box, and you're probably going to see it recommended on certain sites So I wanted you all to know what it was and why certain sites might suggest it so for example Jupiter notebooks are becoming very popular right now if you go to their website they recommend installing Anaconda because after the installation of Anaconda, you can just say jupiter notebook and fire one of those up And you can see that that just pops up ready to go so speaking of Jupiter Notebooks I plan on doing a tutorial on these very soon So installing Anaconda might be a good starting point if you want to follow along with those videos But it's also real easy to install through pip So if you don't want to install Anaconda, then you'll still be able to follow along just fine So if anyone has any questions about what we cover in this video Then [feel] free to ask in the [comment] section below and I'll do my best to answer those If you [enjoy] these tutorials and would like to support them then there are several ways you can do that These just ways to simply like the video and give it a thumbs up and also it's a huge help to share these videos with anyone who you think would find them useful and if you The means you can contribute through patreon And there's a link to that page in a description section below be sure [to] subscribe for future videos and thank you all for [watching]
Info
Channel: Corey Schafer
Views: 969,211
Rating: undefined out of 5
Keywords: Python, Anaconda, Continuum, Python Tutorial, Python Anaconda, Anaconda Install, Conda, How to use conda, Conda Package Manager, Continuum Analytics, Data Science, Jupyter, Jupyter Notebook, Python Data Science, Python Conda, Python for Beginners, Programming Tutorials, Python Tutorials, Software Engineering, How to, How-to
Id: YJC6ldI3hWk
Channel Id: undefined
Length: 11min 24sec (684 seconds)
Published: Wed Aug 10 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.