Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Using conda to Install Packages3:50 with Kenneth Love
Conda is a great tool to use for installing packages
If you don't want to use the Anaconda Navigator GUI, or 0:00 maybe you're in the middle of doing something in your terminal and you just 0:02 don't want to switch apps, there's Conda, which is Anaconda's pip like tool. 0:06 Conda does a bit more than pip though in that it can do pretty much everything that 0:10 the navigator can do. 0:14 So let's jump a little bit into Conda. 0:15 Now I showed you how to make an environment With the navigators, but 0:18 let's do this with conda now. 0:21 So I'm here in my home environment, or my home directory, 0:23 and I'm gonna do conda create --name. 0:27 And the last one I did was for butterflies, 0:30 maybe this time I'm studying, I don't know, angler fish. 0:32 I study a lot of animals. 0:35 So I'm gonna name this one angler fish, and again, I want to install numpy. 0:37 So this will create a new project named Anglerfish and 0:41 it's going to install the NumPy software into it. 0:45 Now it Conda goes through a few processing steps that you saw here with this fetching 0:48 package metadata and solving package specifications. 0:52 And then it gives me this plan, this list of things that it's going to install. 0:55 So it's gonna install it into Users/Kenneth/anaconda/envs/Anglerfish. 1:00 And it's going to install all of these new packages, so 1:04 certifi, mkl, numpy, and so on. 1:07 And it asks me if I want to proceed. 1:10 Now I think this looks fine, so I'm just gonna have to say yes, and 1:12 I'll press enter, and I have to wait a little bit while these things install. 1:16 Now it's not very long. 1:20 It's a few seconds, because these were all already available in my downloaded 1:22 Anaconda stuff, but just so you know. 1:26 Now if for some reason you get an error that Conda wasn't available, 1:29 you'll need to check your path variable in your shell. 1:32 There is simply too many possibilities for what causes this error and 1:35 how to fix it for me to tell you all of those. 1:40 So your friendly local search engine should be your first stop and 1:42 I'm sure you'll get it solved. 1:46 Okay, so everything's installed now I'm gonna hop back into the navigator 1:47 real quick. 1:51 Let's go ahead and launch that. 1:52 And I wanna see if the environment is there. 1:56 And so let's come over here and we look at environments, and look at that, 2:01 there's my Anglerfish environment. 2:04 And if I look at it and I see what's installed, it has numpy and 2:06 all the other stuff installed that I polled it to. 2:09 So that's great. 2:11 Okay so, but I'm gonna go back to the terminal. 2:13 And here at the bottom, Conda told us how to activate our environment. 2:15 So we would use source activate Anglerfish. 2:22 And that will activate our environment. 2:26 And you can see we get this prompt right here, which looks very similar 2:29 to the prompt you would get if you have used virtual env in the past. 2:33 And now we can use our Python Shell just like we normally would. 2:36 We can type python and you can see we get Continuum Analytics thing again, 2:39 and we can import numpy as np and the import works just fine. 2:45 So we've got everything that we had before, but 2:49 what if you need to install an extra package? 2:53 Well, first we need to get out of our shells and 2:56 then I'm going to clear just to bring things up to the top. 2:59 And now we can search for packages if we want. 3:03 So we can do Conda search and then let's say we wanna do some visualization so 3:06 we want bokeh. 3:10 So let it do it's package metadata and 3:14 we get just a ridiculous list of options here. 3:16 So we can just tell Conda to install. 3:20 We don't have to look through all of these. 3:23 This lets us specify exact versions, but 3:25 if we just wanna do conda install bokeh and we press Enter. 3:28 Then it will go and install the one that's correct for our system. 3:32 So you can see here, it's going to install bokeh for Python 36. 3:36 So yep, go for it and it installs everything. 3:39 Now there's a lot more to Conda than I can cover just in this one video so 3:43 be sure and check the teachers notes for more information. 3:47
You need to sign up for Treehouse in order to download course files.Sign up