Hi.
In this video we will learn how to use Kernel from another Python
environment. First we have to explain a few things.
The Jupyter app,
what we are using was launched from the base environment,
and this is also the environment which our notebook uses for executing
its code. We can verify it with this command.
We print the Python executable,
and this is the location of the Anacondas base environment.
It is possible that the Jupiter app uses one environment
and the notebook uses for executing its code, another environment,
or in another word, the kernel. Uh,
we can see available kernels from the UI or we can list them using a command.
In our terminal,
we have seen just three kernels available
and from our terminal, we can list them using this command.
Now let's print the contents of these folders.
Here in this J S O N file is the save the definition of the kernel.
Let's print it contents,
and we can see here now the name of the kernel
and also, uh, location of the Python executable.
Now let's see,
what is the process of letting Jupyter know about other Python environments?
Let's create a new Anaconda environment,
which we would like to use as a new kernel in our notebook.
We can create new Anaconda environment. With this command,
we specify the name of the environment
and we also specify the version of Python.
We'll use Anaconda only for creating the environment,
but we will install the remaining packages using P.
Let's activate this environment.
The package that we need is the IPI kernel,
but we will install multiple packages defined in our requirements file.
The reason is that in later videos, we will use this environment as well.
Let's, uh, open this file.
This is it.
And we see here out of packages, uh,
including the IPI kernel and every package has specified.
Also its version.
These versions are defined specifically because we want to avoid dependency
issues between packages. And with these, uh, versions of packages,
I have tested functionality I want to show you in later videos.
Now, let's install them.
The r parameter is to use, uh, the requirements file.
I forgot to go to our folder for our module.
Now it'll work.
Okay. All the packages in our new environment are installed.
Now let's execute the command, uh,
which installs our definition of the new kernel.
We must execute it, uh,
from the activated environment because we are using Python executable of that
environment.
Now let's verify it.
It seems it's here. Now let's check it from the UI
and it's already here.
Let's change it and let's verify it from the Python code.
Yes, it's working correctly. In
our next video,
we will learn how to execute R and Python code in the same
notebook.