📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

Setup Conda Lab - GenAI Essentials

ExamPro12:52

Transcription

Hey, this is Andrew Brown. In this video, we're going to take a look at setting up Conda and Jupiter Labs locally. I'm logged into remotely, um, a machine on my network, which is, uh, the Intel Developer Kit, um, that has a Lunar Lake chip, so that I can, uh, do good things locally. Uh, this is a very important video, as I feel that if you have a decent, uh, GPU or CPU, um, that there's a lot that you can do, um, uh, with this here. If you don't plan to use GPUs or CPUs but do development and just use serverless APIs, you still would want to do this.

Okay, so I've opened up VS Code and I have a terminal here. There's some existing project, but we're going to ignore that for now because that doesn't really matter. But what I want to do is I want to go ahead and install, um, uh, Jupiter. And so I actually already have, um, some instructions to do this, and so I might just bring them on over, uh, into this project here. So I'm going to go and, uh, get that open here. Just give me a second. I'm going to just manage two environments at the same time here, but I'm going to go over to GitHub. And in here, I have a repo called Exam Pro, [Music] Ji Essentials is what it should be called. There we go. And so in here, we can set up the instructions for installation. So I'm going to just hit period on my keyboard. And as that's going, I'm going to go over to GitHub, as I have a lot of projects. I have the in Training Day workshops, and in this one here, we actually already have the code for us, uh, over here. Okay, so I just want to bring it over and kind of rework it a little bit for our use case. So I'm going to go and wait a moment here, and I'm going to just make a new folder here. Whoops, not there. We're going to make a new folder here. I'm going to call this one, um, uh, Conda local, like Conda Jupiter, or we'll say local development, local dev. And I'll make a new folder in here. This will be Conda and Jupiter. Okay, so we're going to make a new file here, and I'm just going to call it, uh, README.md, as this will be the instructions to get set up here. And so the first thing we'll want to do is we'll want to install Miniconda.

Okay, so install Miniconda. If you've never heard of Conda before, or Miniconda, which is over here, um, so first, let's talk about Anaconda. So Anaconda, um, I, I think of it as a package manager, but basically, it gives you, um, a package manager and trusted libraries that are commonly used, uh, for people that are data scientists or in the data field. So this is a very common way to start working with, um, libraries and to not deal with, deal with so many different kinds of conflicts. But what we're going to want to do is install, uh, Miniconda. This is specifically for Ubuntu here. It's making a, a folder in the home directory. Doesn't necessarily need to do that, but it's not going to hurt anything. Um, and so we're going to go ahead and run it here. You can run this on a Mac. Even if you don't have a home directory, you can still do this. But, um, actually, I'm just trying to decide here, should we change this at all? I think what I'd rather do here, I'm just going to change it slightly. So I want to put this in the home directory, and then here we will then do this. Okay, and that way, um, we will go wherever your, your one is, because mine's called Andrew, right? And so I'm just copying each line over. Okay, this is something that you'll have access to. You can get it at Ji Essentials, right? So I'm going to bring in that first line, which, you know what, I, I don't really, sorry, that's not the right line. There we go, that's the line we want. Okay, and then we want the next line, which will actually download, um, the latest version of Miniconda. Okay, and then the last one here actually executes it. So here it's downloading a bash file and renaming it to temp Miniconda, and then we're executing it here, which will install Miniconda. Okay, so it's installed now. So that's step one, installing Miniconda.

The next step is to, um, get it set up. So these are the first two lines we want to run. So we'll just say setup Miniconda. I might just make this, uh, H2, not that it matters. Okay, and I'm just going to slightly change this. So it's actually this here. Okay, and we'll go ahead and bring those in next. Have to be a little bit careful here. It likes to, um, when you copy-paste on Windows, it likes to not copy what you have. And it's still, it's still, uh, refusing to work. There we go. So I've done the activate, and so now notice that we have base. So now Miniconda is working. This is really important so that, you know, that it's there. If you don't see this, then, uh, Conda is not there. Okay, and the next line is the Conda init. So this is going to set up, uh, some defaults. So it's modified some files, and if we were to open up this file, like our bash RC or Zsh RC, I'm not sure which one we are using right here. I'm just going to cat it out here for a second. It's added stuff so that next time we use terminal, the Conda will get loaded. If you don't run that line, then you'll always have to activate Conda, which is kind of annoying. So anyway, now we have, uh, Conda installed.

And so the next step is to, like, get our environment ready. And so often, what we'll end up doing is we'll be creating a, um, uh, like an environment, and then from there, doing something with it. So let's actually go ahead and do that now. We're not going to do open V here today, uh, but we're going to do something else. And I'm just going to make a very simple environment. So we'll just say, um, create a new environment. Okay, and so what that will do here, just call, call it hello. Right, this will create a new, um, Python environment called hello with Python 3.10. Z. Often, um, I will use an older version of Python because newer versions of Python, especially when working in data science projects, you'll have serious conflicts with libraries, and so you just kind of find which one's more reliable for you. So latest is not always the best. There's definitely a newer version of Python, and so I'm making the deliberate choice of working with 3.10. If it's the future, you just kind of figure out as you go, um, what versions work for you, but right now, at this time, 3.10 is working great for me, and so I'm sticking with it.

So I'm going to go ahead here, and we're going to go and, uh, create ourselves a new Python environment. Now, normally, when you create a Python environment, it would just create it in place. I'm not exactly sure where they place these, but we'll take a look here. I'm just going to do an LS type and LA. So notice that, like, the Python environment is not there. So what we can do is type in Conda EnV, and it should tell us. Conda EnV, it should tell us about the environment. Maybe it's not that. Maybe Conda show. Type in Conda here. Oh, it's Conda info. So we type in Conda info. I'm just seeing if it tells us where this environment currently is. We haven't activated it yet, so there is no, um, environment. But this would be, you know, create, create a new Python environment called hello with Python version 3.10. Okay, and so if we want to use the environment, like activate the environment, we'd write, um, Conda activate hello. Okay, and it's saying here, could not find an environment called that. I could have swore that we created it, right? Did we not? I mean, this one's called open V, so maybe when I copy-pasted it, it actually created one called open Voo, which is not a big deal. So I'm going to try this again. And so now created it. It's just that copy-paste that messes things up. Okay, so I'm going to go here and say hello. So now I'm using hello. You can see this here, it says hello, and, uh, it's not easy to, like, to list out environments. I've never figured that out. But if we go Conda info now, should tell us. Does it tell us what environment we're using? So it's telling us we're using this environment, and it's located here. So I have a feeling if we were to copy this, we could then, um, or write this out, home, Andrew, Miniconda, environments, we could find it. So let's go ahead, and we'll type in Miniconda envs, and I'm going to just do lsy LA to list them all. And so we have hello and open Voo. So I believe that if we want to delete it, I mean, we could manually delete it, but the proper way would be to, um, remove it, whatever the command is. So if we go here, they call it remove. Okay, so we'll go over to here, and I'm going just say get info about current environment, and this is going to be Conda, uh, info. We can see things like where the nvar exists, or the environment, uh, Python environment exists. So let's say we're done with this, we can remove it.

So remove an environment, and this is something you actually do quite a bit because often you will install things, you'll have, you'll make a mess of things, and you just basically have to delete and start over. So I'm doing this all the time. Before you can do that, you have to deactivate. You can't just delete it if you have it activated. So we say deactivate hello. I think that's maybe what it is. Say Conda deactivate hello. It's not that, is it not just deactivate? Oh, it is deactivate. I probably just spelled it wrong. So try, oh, you know what, it's just Conda deactivate because you can't, um, specify the exact one. I'm not sure why they made that as a choice. It's just kind of a habit of me always typing it. And so now we can say Conda remove, and this one's a little bit funny because you have to specify a flag for it. And here it's Conda to remove hyphen name my env, and then hyphen all. So that's what you're supposed to do. Oh, I mean, we have to actually name it what it is. So we have hello here, and we'll say yes, yes. And I think open Voo is here as well. So go ahead and do that. I'll just switch that out. Um, I don't want to have to put the the Y flag every time, so just do that like that. Obviously, you should read what you're deleting. And so that's example there. So I'm going to go back over to here. So this will be Conda remove. Every time I say Conda, sounds like in my head Wakanda, and I just think of that movie. But they say hello here, and then it's hyphen hyphen all, and then it's hyphen yes. And so that's how we're going to remove, uh, remove, uh, an environment. So something you're going to be commonly doing.

Now, there's more to this. Um, this is basically step one, which will just be, uh, setup Conda. We'll just call this Conda instead, okay? And the next part will actually be installing stuff, and specifically what we want to install is, um, uh, Jupiter Lab. But, um, yeah, we'll cover libraries installed in the next one here. But, uh, one thing I wonder is, like, do we have Pip now? So I didn't have this before, which was kind of frustrating. But if you type in Pip, yeah, we have Pip. Okay, great. Okay, so what I'll do is I'm going to, uh, stop the video here, and then we're going to continue on as a separate one. But I'm going to save this here for now because this one's pretty good. And we'll say update. I, I almost feel like I should have made this a separate one. Maybe I'll just rename this to Conda. I'm so sorry for those that are watching. And I'll rename this to README, but that way the next one can be Jupiter server. Okay, okay. And I will see you in the next one. Ciao, ciao.