Python for the .NET developer Transcripts
Chapter: Computational notebooks
Lecture: Installing JupyterLab

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Python really dominates the space of these
0:02 computational notebooks.
0:04 So we're just going to get started
0:05 and the thing we need to do is
0:06 actually set up a little bit of stuff
0:09 for us to do that.
0:11 Now, PyCharm does have some support for notebooks
0:13 but most of what we do is actually
0:16 just install and run Jupyter Lab
0:18 and then work in Jupyter Lab
0:19 but we're going to start by doing at least
0:22 maybe we'll come back to PyCharm at the end.
0:24 So, here we are in our Python code
0:27 section of the Git Repo.
0:29 I'll make a directory.
0:35 We also need to make sure we activate
0:39 our environment.
0:40 Remember venv\scripts\activate on Windows
0:43 without the dot.
0:44 So we have that here and we need to
0:47 install Jupyter. Notice that in the j's
0:50 we don't have a Jupyter
0:52 so we're going to install a couple of things.
0:55 Start by installing, jupyter.
1:00 Alright, that's a good start.
1:01 We've got a bunch of dependencies installed there.
1:05 Also need Jupyter Lab.
1:07 We can run this by saying just, jupyterlab.
1:11 So, it does a bunch of stuff
1:13 Kicks off our browser and logs us in.
1:15 If you are super quick you be able to see like
1:17 Hey, it's using this temporary token
1:20 to make sure that we're allowed to access it.
1:23 and then it does some redirects over to it.
1:26 So right now we've got our notebook section over here.
1:28 Let's go in there and we can add all sorts of new things.
1:34 I could even click that
1:35 or I could just go here and say
1:37 Your notebook, if for some reason
1:38 you're remoted into the system
1:40 you could fire up a terminal in say
1:42 pip list or do various thing like this actually.
1:46 See where we are. Go to our notebooks.
1:49 Right, so we can do arbitrary stuff
1:51 in the terminal here
1:53 but we just want to create one
1:54 of these new notebooks, for now.
1:57 And now notice it says
1:58 What kernel do you want to use?
2:00 This is a little bit tricky because
2:02 we installed Jupyter into our
2:03 virtual environment but this Python 3
2:06 even thought it looks like it's going to be okay
2:08 turns out to be not what we want.
2:11 Let's name this notebook something like
2:15 References, or something to that affect.
2:17 So we're going to go and do some work with this
2:19 and I'll tell you about the problem
2:21 we're going to solve.
2:22 We're going to do some cool analysis
2:23 and real-time interactive exploration
2:26 of some data and then visualize it.
2:28 Like, that's the role of these things
2:30 but I just want to show you something really simple.
2:32 Well, first of all, we could actually
2:33 come up with like just let me show you how it runs.
2:35 y=2, we could run this little section
2:39 and then down here we could come up and say
2:41 x+y let's put 7xy.
2:45 We run that and we get an answer, like so.
2:48 When you just explore we can import some libraries.
2:51 Start working with them.
2:52 So this is all well and good
2:54 except for, watch this.
2:57 Going to say, No no no! Problem! Problem here!
3:00 We don't have this library! So, we're going to need a couple of libraries
3:02 and this Python here if we say, import sys
3:07 then we say Sys.path Python path.
3:10 Oh we got to get rid of this.
3:12 Notice, what working version
3:14 of Python we're using.
3:15 We're using just the system Python
3:18 and then the path obviously goes here
3:20 but it, get it to print out
3:22 which Python we're using
3:23 it's turns out that this is the system Python
3:25 not the Python that we're wanting to work with.
3:28 This is not our virtual environment Python.
3:30 With everything we're installing.
3:32 So, in order to finish setting this up
3:33 we do need to do one more step
3:35 to tell Jupyter, Hey! I want you to register
3:38 an option for us to select here
3:40 that is our virtual environment.
3:42 but once we get that done we can just go up here
3:43 and start typing some code.
3:45 So far it's not very impressive
3:46 because it's just numbers
3:48 as a calculator, basically
3:50 but we're going to be able to improve upon this
3:52 and put all sorts of cool interactive graphics
3:54 and stuff up here.