WEBVTT - This file was automatically generated by VIMEO

0
00:00:07.850 --> 00:00:08.330
Hi.

1
00:00:08.330 --> 00:00:13.110
In this video we will learn how to use Kernel from another Python

2
00:00:13.110 --> 00:00:16.430
environment. First we have to explain a few things.

3
00:00:17.050 --> 00:00:18.350
The Jupyter app,

4
00:00:18.620 --> 00:00:22.430
what we are using was launched from the base environment,

5
00:00:23.290 --> 00:00:28.270
and this is also the environment which our notebook uses for executing

6
00:00:28.330 --> 00:00:33.150
its code. We can verify it with this command.

7
00:00:42.510 --> 00:00:44.330
We print the Python executable,

8
00:00:46.520 --> 00:00:49.900
and this is the location of the Anacondas base environment.

9
00:00:54.500 --> 00:00:58.920
It is possible that the Jupiter app uses one environment

10
00:00:59.580 --> 00:01:03.800
and the notebook uses for executing its code, another environment,

11
00:01:04.020 --> 00:01:07.450
or in another word, the kernel. Uh,

12
00:01:07.470 --> 00:01:12.250
we can see available kernels from the UI or we can list them using a command.

13
00:01:12.250 --> 00:01:13.083
In our terminal,

14
00:01:17.270 --> 00:01:19.450
we have seen just three kernels available

15
00:01:22.140 --> 00:01:26.400
and from our terminal, we can list them using this command.

16
00:01:32.710 --> 00:01:34.970
Now let's print the contents of these folders.

17
00:01:54.400 --> 00:01:58.250
Here in this J S O N file is the save the definition of the kernel.

18
00:01:58.910 --> 00:02:00.460
Let's print it contents,

19
00:02:11.540 --> 00:02:14.520
and we can see here now the name of the kernel

20
00:02:16.030 --> 00:02:19.290
and also, uh, location of the Python executable.

21
00:02:24.250 --> 00:02:25.150
Now let's see,

22
00:02:25.380 --> 00:02:29.990
what is the process of letting Jupyter know about other Python environments?

23
00:02:31.220 --> 00:02:33.130
Let's create a new Anaconda environment,

24
00:02:33.300 --> 00:02:36.850
which we would like to use as a new kernel in our notebook.

25
00:02:43.140 --> 00:02:46.200
We can create new Anaconda environment. With this command,

26
00:02:56.930 --> 00:02:59.360
we specify the name of the environment

27
00:03:06.850 --> 00:03:09.470
and we also specify the version of Python.

28
00:03:46.530 --> 00:03:49.880
We'll use Anaconda only for creating the environment,

29
00:03:50.220 --> 00:03:53.360
but we will install the remaining packages using P.

30
00:04:01.870 --> 00:04:03.260
Let's activate this environment.

31
00:04:12.070 --> 00:04:15.450
The package that we need is the IPI kernel,

32
00:04:15.950 --> 00:04:20.850
but we will install multiple packages defined in our requirements file.

33
00:04:21.720 --> 00:04:25.900
The reason is that in later videos, we will use this environment as well.

34
00:04:30.050 --> 00:04:31.440
Let's, uh, open this file.

35
00:04:35.410 --> 00:04:36.243
This is it.

36
00:04:41.190 --> 00:04:43.690
And we see here out of packages, uh,

37
00:04:43.690 --> 00:04:48.090
including the IPI kernel and every package has specified.

38
00:04:48.280 --> 00:04:49.113
Also its version.

39
00:04:52.440 --> 00:04:57.350
These versions are defined specifically because we want to avoid dependency

40
00:04:57.350 --> 00:05:01.880
issues between packages. And with these, uh, versions of packages,

41
00:05:01.960 --> 00:05:04.720
I have tested functionality I want to show you in later videos.

42
00:05:07.400 --> 00:05:08.700
Now, let's install them.

43
00:05:16.970 --> 00:05:20.750
The r parameter is to use, uh, the requirements file.

44
00:05:38.640 --> 00:05:42.080
I forgot to go to our folder for our module.

45
00:05:53.930 --> 00:05:54.763
Now it'll work.

46
00:06:23.590 --> 00:06:27.280
Okay. All the packages in our new environment are installed.

47
00:06:29.350 --> 00:06:31.610
Now let's execute the command, uh,

48
00:06:32.440 --> 00:06:36.150
which installs our definition of the new kernel.

49
00:06:51.910 --> 00:06:53.530
We must execute it, uh,

50
00:06:53.640 --> 00:06:57.850
from the activated environment because we are using Python executable of that

51
00:06:57.850 --> 00:06:58.683
environment.

52
00:07:04.360 --> 00:07:05.400
Now let's verify it.

53
00:07:17.270 --> 00:07:21.850
It seems it's here. Now let's check it from the UI

54
00:07:35.790 --> 00:07:37.450
and it's already here.

55
00:07:38.480 --> 00:07:41.470
Let's change it and let's verify it from the Python code.

56
00:07:48.570 --> 00:07:50.670
Yes, it's working correctly. In

57
00:07:54.420 --> 00:07:55.340
our next video,

58
00:07:55.960 --> 00:08:00.500
we will learn how to execute R and Python code in the same

59
00:08:00.780 --> 00:08:00.980
notebook.
