How To Setup & Run Jupyter Notebooks in VS Code w/ Virtual Environment & Kernels (Remote & Local)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right let's set up a Jupiter notebook in vs code so I'm just going to start from scratch so you know there's no funny business going on over here and let's get this onto this side of the screen new terminal go into my videos folder and let's make a directory for vs code video CD into it and open up visual studio code all right brand new situation going on here fun times for all so what I need to do because my vs code is totally jacked is I need to get into here so let's see the N2 vs code video and now I'm in the right directory all right this is probably about the time when you're going to start the thing so I'm just going to follow along with what's on here so you know that everything is legit I'm going to skip the prerequisites you can watch that do it yourself anyways here's the process step one create your project folder hey we already did that okay great so we created our project holder and we did it like this make directory make project good now we're on step two what do you know so navigate to it and blah blah blah blah so the first thing I want to do is create a virtual environment you don't have to do this but here you go Python 3 for me let's make this a little bit bigger for y'alls python 3. virtual environment virtual environment dupes video hmm [Music] Python 3 Dash m irtual environment virtual environment dupes video that created my virtual environment now I need to activate it with source vent tab completion bin activate do I have that right cool there it is now you have your virtual environment and it is activated step three step three we're going to install ipy kernel so pip install IPI kernel it runs things happen Magic step four now that we have that installed we have to create a new kernel so this syntax is a little bit crazy you can copy and paste it but I type fast and I have this super loud annoying keyboard which I love so I'm going to type it so we're going to go python3 Dash Mi Pi kernel install and then dash dash user dash dash name equals and you can name it whatever you want let's call it a vs code video wasn't sure if I was supposed to put that in quotes or not I guess we're going to see what happens it looks like it worked okay so now we want to do that we already did that now we're going to start Jupiter okay so hopefully you have the Jupiter extension installed all that stuff that we just got through blah blah here's the fun stuff right so we're going to start Jupiter notebook this is at least how I do it we're going to start Jupiter notebook like we normally would it opens up a browser ta-da and there's a couple routes you can go here so if you did this right you should see some nonsense like this down here and you can see to access this notebook in a open this file in a browser or paste one of these URLs so you have a whole bunch of choices yippee but what we need to basically the main point right here is that we have started Jupiter and we have this thing running on our system and actually if I zoom out a little bit okay we'll see in a minute so we want to select a kernel for our project and this is where you can go a couple different directions so you can open up the VS code search bar and create a new jupyter notebook like this just start typing in create and you can see new jupyter notebook there and you can see like as you start doing stuff you're going to be able to see things happening well I haven't saved this yet but let's just save it call it that Okay cool so there's my notebook that I just saved right so these things are kind of linked so you can do some stuff in the browser and some stuff in vs code if you're more comfortable with it for example if you want to start the kernel you just saw some things happen right there all I did was click on it it says it's not trusted this is a key thing to debug but let's get back on track so we've opened vs code search bar we said create new jupyter notebook it's here something to notice two things one down here Jupiter server local up here python three one whatever it's showing the kernel uh showing that The Interpreter that you're using so I'm using a Mac it's on Homebrew there it is blah blah blah now this is where you want to select a notebook kernel so you can command shift p again and start typing in Notebook and select a notebook kernel because it's running Jupiter's already running and where's the one we just did it was called vs code video and you can see this guy changes over here TVs code video so now you're using that kernel pretty sweet and then at the bottom of your code window you can see down here it says local so if you want to run it locally you totally can or if you want to run it not locally you totally can too I don't even really know the difference I kind of mess around with it and the world hasn't exploded yet so we're probably fine now back here to troubleshooting a situation I'm going to reload this page you can see here that it's now trusted because we went in here and we did the thing where we said select notebook kernel and we chose one so it made the link if that's not working for you guys it's not working for you then what you can do is this other trick where here number two okay so now we have number two here he's probably going to immediately get trusted okay so he's not trusted so if the thing didn't work when you did it in here sometimes it doesn't I don't know why click on not trusted and then just say trust and all of a sudden this one is now trusted but it's running on Python 3 ipy kernel it's still not connected here so if you want to you can go over and select a new one where is our vs code video cool so that one's going to run there and now there's something I left out of this article I believe no here yeah if you want to run it at the bottom of this yada yada okay so if you want to run it not locally this is the part I left out lucky you you watch the video you lazy son of a okay so what you do is you can when we connect it originally okay here so when we connected originally we got these URLs if you click in here you can connect to a remote Jupiter server and use somebody else's resources for your processing and what you want to do is say specify the thing paste in your situation click enter and now you can see I'm using the remote so what have we covered we have covered um create your Jupiter notebook using the create Jupiter notebook situation right there first of all do that then well create your virtual environment first then create that then what you want to do is you have to install the IPI kernel and activate it blah blah blah and you choose your kernels here and then you choose whether or not you want to do local or remote down here and then if you have any problems kind of go back and forth between the browser and you should be good to go those are like all the situations I've run into that made this super annoying but you're done see you later click like subscribe something go tell your mom that you know how to run virtual environments and Jupiter notebooks and vs code just get out of here see ya
Info
Channel: devin schumacher
Views: 26,263
Rating: undefined out of 5
Keywords: how to run jupyter notebooks in vs code, jupyter notebooks in vscode, jupyter notebook vscode, visual studio code with jupyter notebook, jupyter notebook on vs code, Setting up Jupyter Notebook in Visual Studio Code, visual studio code, jupyter notebooks, walkthrough, vscode, jupyter notebook in vscode, how to run jupyter notebook, how to use jupyter notebook, how to use jupyter notebook in vscode, setting up jupyter notebook in visual studio code
Id: -j6y-5t37os
Channel Id: undefined
Length: 8min 1sec (481 seconds)
Published: Wed Dec 28 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.