Python Environment Setup - macOS - Installing Anaconda for zsh

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back we're still working on our environment set up on a mac uh in our last video we talked about bash versus the z show uh if you haven't sorted that out make sure you go to one video previous to this in the playlist and make sure that you're on z shell although you should be able to do this even if you haven't done that the next thing that we're gonna do is we are gonna go ahead and we are going to download and install anaconda uh most people use the uh most people are going to actually use the visual installer so we'll go ahead and do that we're going to be using the individual edition that's the data science toolkit we want to go to our downloads i'm dealing with a mac os i'm going to go ahead and use the graphical installer we could certainly use the command line installer instead although the graphical installer is a little bit more user-friendly so we'll go ahead and do that method instead um while this is downloading we can also talk about the fact that you don't even need to actually go to this website to make this download right there are tools in the command line where you could go to this url if you had it and make this download and execute this file from the command line without ever having to open a browser there are also package managers that you could use on your computer to install anaconda directly um without ever having to go to the anaconda website right and the main one of those is called homebrew right if i go to uh homebrew right and i go to their website um it tells me right this is it gives me a single command that i can run in my terminal to actually install homebrew talks a little bit about what homebrew does homebrew is a package manager it installs packages into their own directory and then um it sim links their files into the user local right that might not mean a ton to you but what this means is that me um to to on a systems level is that it's really easy to uninstall packages right typically when we install a package or a piece of software it kind of puts files all over the place right most of the files are in its own folders and things are self-contained but it does have files that the system needs access to that is put into system folders that are actually linked in different places and homebrew just helps you manage that so you can have really clean uninstalls as well as clean installs anaconda there's not a huge issue with that anaconda is a really clean install on its own so we're not going to need to worry about that uh just too much on its own um but that's homebrew you can certainly read about it i would suggest that you do use homebrew at some point it's mostly a tool for mac os linux also uses it um they make a version for linux it's not very popular linux actually has a built-in version that works pretty well but uh my download is completed here so i'll just go ahead and start first thing it says hey are you sure you knew where you downloaded this from i want to make sure it's safe then we have our typical license agreements and i'm going to install this just for myself only i don't need to install it in a very specific place uh or for all of the users of this con computer so i'm just going to go ahead and hit continue there um i'm going to go ahead and let it install in its default location because i think that's what most people will do and it's been putting it in a little bit of an odd place and there have been some issues and that's an issue that i want to make sure that i work through in this video so everyone can understand how to do this really effectively so we've got this uh this is running it's doing its package script thing we'll just give it a moment i guess it is worth time take to take a moment and talk about exactly what anaconda is so it says that anaconda is you know this data science product or this data science sort of um package but what anaconda is really in terms of the way that we're going to use it is a package manager right and you might say well hey we were just talking about homebrew you said that homebrew was a package manager right so the difference between these two things are that homebrew is a package manager for uh your entire computer so it will manage different pieces of software installations say if you were working in multiple languages for example i have a lot of java stuff on here i have some javascript development things on this computer as well i use homebrew to manage all of those things anaconda specifically is a package manager for python right and it comes pre-packaged with a number of things uh you'll see that it does come with on ide ide is short for integrated development environment that's not something that you're going to be using in the data science immersive very often and the um it also comes with like some other desktop utilities most of which you will not be using in fact i've never used any uh it actually comes with a an anaconda navigator or anaconda uh launcher and that's not anything that i've ever used uh before so most of what we're going to use from anaconda is its set of python packages and then we're going to use it as a package manager so now that we've gotten that done it says oh you know we can work with python and jupyter notebooks and we can do that in pycharm professional um with the pycharm ide which it is suggesting that i install and i'm not really too worried about that at the end asked me do you want me to move this file to the trash and i said i sure do i uh don't need or want that anymore so i'm just gonna make sure that i have a nice new terminal open here to make sure that any changes that needed to happen have been updated and the first thing i want to do is i kind of want to check in here and just see if my conda has installed correctly and i it looks as if it has but i want to make sure that's actually the case so i'm going to type conda info and it actually tells me a bunch of information about anaconda here right so i was actually unable to recreate the error that i was looking for so bear with me for a second i think i will be able to recreate that error if you can be a moment i want to be in my users and me and i am looking for the dot cshrc file open up this file i'm gonna get rid of this i just need to make sure that i have something open where i have all of that gobbledygook saved before i get rid of it i'm going to save that save that go ahead and close it down and i'm going to close this terminal then i'm going to open up a new one and zoom in so this is likely what most of you are going to encounter after you have installed your anaconda using the visual installer uh if you've already switched to the z shell right and you're gonna say okay i've got anaconda i want to make sure it's there the the command that we're going to make sure it's there with is conda info and right now we have this issue called uh conda art uh the z shell is saying that command is not found conda command is not found i don't know where to find that right so anaconda's installer package for some reason is still making the assumption that most of the users are using a bash terminal so the information that it's giving for the computer to actually find um the anaconda command is in a folder that's in a different place than we're looking for so what we're going to want to do is we're going to um first we need to make sure that we know where our anaconda 3 installation is we're going to do that the folder will be named anaconda3 right we're going to need to search our entire mac you're likely going to have a bunch of files with that in it so we're actually going to want to make sure that we limit that search down to [Music] folders right and the default place where it's installing and anaconda 3 is in the home directory in a folder called opt short for opt um so we just need to remember that and what we're gonna do is we need to put this in the path right and there's a couple of ways we could do that but i'm gonna i'm gonna say conda command not found mac it autofilled for me this is a very common thing um this is happening to a lot of people so um you know it's it's pretty common that it's a common skill that you're going to develop that you can just take your error code copy and paste it and put it into uh put it into google and see what comes up right and here's what we're dealing anaconda not found in z shell that's exactly the problem that we have this actually gives us a solution right and this tells us um export path right blah blah blah this is something that we want to do and what it wants us to do is it wants us to put this into our zshrc file right that's a file that i had open a little bit previously if i go back to my users my home directory look at it in the form of a list go to dot zshrc take a look at that right this is all of the customization that i have done to my terminal window and the last thing that i'm going to want to do is it's given me this command that i want to do this export path but it's given me this export path in sort of generic terms right this is not my actual username right my actual username is lance parto right and then this is miniconda3 that's not the name of our folder the name of our folder is anaconda3 and then it has its own uh bin folder full of binaries right and just so you know um path is a variable a share shell variable that references all of the places that your terminal will look for commands when you type a command in so we are adding this this path this uh directory to the places where our terminal can find commands right it has a set of those set up by default but we're adding to that default by adding this to our cshrc file so what i'm going to want to do is i'm going to want to make sure that i go ahead and give that a save and then go ahead and close it and close my terminal get another new one open and get zoomed in here again for you so you can all see and now i still have conda not found let me double check oh that's because i did not put in the correct path for those of you watching you were probably watching me saying no you forgot the opt you forgot the opt put that opt in there right um now i open this up we'll see i'm not seeing what i want to so i'm not sure if this is going to work but it actually does work right so i've added that directory um now i'm gonna check this out real quick and see if it does what i want it to do so i've run this command called conda init and what it does is it actually initializes conda specifically to um my um it's actually doing it to my bash profile right as i mentioned anaconda is still sort of operating under this assumption that um i'm using a bash profile but that's not the case so it says for these changes to effect you need to close and reopen uh the current uh instance of the terminal but um i'm not going to worry about doing that i am going to quit my terminal entirely and open up a new one and um you know let's go ahead and go into that bash profile oops so the bash profile will be in the same place that the zshrc file is so that's going to be a dot bash profile you can see that here and i can see that there's a bunch of stuff in here but specifically right a lot of this actually has to do with conda right some of these are um some exports some of these are actually artifacts from previous conda installs that i've had but the one that i'm looking for right now is the conda initialize right and when i see this conda initialize it says contents within this block are managed by conda init right it has this conda setup right it has this this file path that i gave it right the an opt anaconda 3 bin conda it has an if else statement right this might seem somewhat familiar this is not python but we can kind of understand what some of these things are talking about um right and amongst this right we can actually see that command that we put into our file right but what i'm going to want to do is that command conda init actually added this to this dot bash profile i'm going to copy all of these contents then i'm going to go zoom on over to my zshrc file and where i previously just had that single command i'm going to go ahead and replace that with this entire thing this entire conda initialize block right and then i'll go ahead give that a save and give that a close and then i will close my terminal i'll get a brand new terminal open all the way from scratch and now i'm seeing what i want to see right you'll notice that before right my prompt just started with this lance's mvp for macbook pro right now what i have over here is this little indicator on the left that tells me that my conda environment is working right and what it's indicating is that i am in my base environment right conda gives you the ability to manage some different environments at different times and we're not going to use that a ton in the dsi it's a very powerful and useful tool i would encourage you to explore that i think if you actually go to conda documentation most uh and then you go to the managing environments part of the documentation it tells you all about creating different environments switching between them you can actually export an environment with a project so you could send it to someone else and they could build the environment when i talk about the environment it's the set of packages with exact versions that you built your project on so they would be able to ensure that everyone is working with the exact same set of tools so if you have a team working on a project together this can be really helpful to make sure that everyone's working on the same page but that's something you can explore a little bit more on your own if you'd like to or you can just leave for for down the road but for the sake of this video um you know we used that visual installer we got anaconda installed um we ran into the conda not found issue which is likely something you're going to encounter with the z shell we found a command just to get us uh temporary access to conda and that was just um exporting a path we found that from google i'm also going to make sure that text is in this lesson for you um that command is in this lesson for you and you'll just have to confirm the path of where your actual anaconda is and once we've done that we ran that command conda init that actually put some uh stuff into our dot bash profile file we searched out that that code snippet that it added the conda initialize block we copied and pasted that we moved it over to our zshrc file and we saved that and now we have a working version of anaconda for example right now if i want to check my python version i can do so with this command python um hyphen v or if um we said conda is a package manager i know that numpy is already installed as default but i can say conda install numpy and it's going to go out and it's going to install numpy likely this is going to say you already have that installed so you don't need to so that's how we're going to use conda primarily is to manage our packages manage the things we import when we're working on our python machine learning data science projects so that's it for this video in the next video we're going to talk a little bit about uh how we can create a python file using the command line opening that file in vs code and then actually executing that uh from the command line and that will be it for the setup videos for the mac users i look forward to seeing you in the next video
Info
Channel: Galvanize Data Science
Views: 5,026
Rating: undefined out of 5
Keywords:
Id: 6JeiTetkVGg
Channel Id: undefined
Length: 21min 11sec (1271 seconds)
Published: Thu Aug 06 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.