Python for the .NET Developer Transcripts
Chapter: Computational notebooks
Lecture: Concept: Getting started with Jupyter
0:00 Now before we move on with a little bit more notebook exploration let's review the steps of getting started
0:06 with clean machine and I'm going to get started and use JupyterLab. So first of all we're going to create a virtual environment
0:13 so, Python3 -m venv, venv. Remember on Windows it might not have the 3. It depends which version of Python you have installed.
0:22 Older ones you just have to have Python with the right path. You should be used to that by now. We're going to activate it on this computer 'cause it's
0:29 POSIX, it's . venv/bin/activate no . on Windows, scripts instead of bin. And then, while you're at it, they always start out
0:38 with an out of date pip, so let's go ahead and just fix that so you don't get that warning and you get the latest greatest stuff. Step two.
0:46 We're going to pip install JupyterLab, and let's go ahead and throw in some other stuff that we're going to need
0:52 talk more about this in a second, in our demo side of things, but, of JupyterLab, scipy, numpy matplotlib, ipywidgets, and feedparser, you don't
1:02 normally need feedparser, but that's what we're using. So, we're going to run this command to install the dependencies JupyterLab plus what we need.
1:10 Now there's another step that you haven't seen that's necessary yet. We're going to go look at another notebook that is much
1:16 more interactive than this basic one that I built. Because, honestly, I do more web development than
1:20 Jupyter notebook type stuff, so I'm not that good at it. I'm going to look at a really cool one in a little bit.
1:25 There's some cool interactive live stuff done in this browser session. And for that to work, you need to have Node installed.
1:34 So here, just run version to make sure something comes back, rather than an error. And then, with the virtual environment active
1:40 we're going to run some extensions. Enable the widget extension. And then we're going to install this Lab extension here.
1:49 Okay, so if we do that you'll see, we'll get some more cool interactive stuff. In order to really run it, and use our virtual
1:55 environment correctly, our Jupyter notebooks could not locate the actual virtual environment even when Jupyter is running out of that
2:03 virtual environment. It's one thing to have Jupyter running. It actually runs multiple environments and even multiple languages.
2:09 So it's not tied to where it's running from. We need to register it. So, we won't do the steps here to install ipykernel.
2:16 With the virtual environment active we run this command at the bottom. We just give it some name that we can refer to and it gets everything set up.
2:23 After we rerun the Jupyter server, we now have our course venv as an option and that's how we get back to the right place for running
2:32 our virtual environment with all of our dependencies. So here's the link at the bottom. You can follow along, do what they got there
2:37 but we also did that in the demo. Finally, it's easiest probably to run from the folder where you want to keep your notebooks.
2:45 But you can also have sub folders and so on. Look where we want to run, virtual environment is active and we just type JuypterLab. Boom, off it goes.
2:53 You notice it automatically starts the default browser and it also has these authenticated links which then log you in.
2:59 You can go further and set up accounts and stuff like that I think. But this is good for local stuff at least. And that's it.
3:06 This is how we set up JupyterLab on our system. It's really cool, isn't it?