Python for the .NET developer Transcripts
Chapter: Computational notebooks
Lecture: Concept: Getting started with Jupyter

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