Hello guys.
So welcome to the Python series.
Uh, now we are going to start our first session with respect to Python.
Now, what we are going to do in this video is that, uh, uh, and the entire code that I'm actually
going to specifically write, I'm going to use the VS code ID, uh, vs code ID.
I find it really amazing because here you'll be able to execute your Jupyter notebook files, your.py
files.
Along with that, you'll also be able to create all the environments very much easily.
Uh, so it is feasible that I specifically use VS code.
Along with that, you have a lot of features like extensions, code assistance, and many more things.
So the first step, uh, as we have seen starting, you know, uh, what I'm actually going to do is
that over here, we are going to create our new environment, as I said, um, in this Python series,
I'm going to use the newest Python version that is Python 3.12, and I am going to teach in such a way
that we all, we see all the new features that have actually come from 3.10 to 3.12.
So all the new features that are specifically there, uh, we will be also discussing about them in
this Python series.
Uh, the first step, as you know, that, uh, I'm going to create an environment and again, why you
specifically require an environment because, uh, an environment is, necessary whenever you start
a new project.
Because in our Python project or in our data science project, we make sure that we use multiple packages,
multiple libraries and.
All right.
And uh, every couple of months this packages or this libraries have new features and most of them are
open source packages or libraries.
Right.
So they definitely have a lot of features that gets included every couple of months.
So it is always necessary that you always maintain, uh, or try to create your entire projects in a
separate, uh, with a separate environment so that there should be not any conflict, as you probably
go ahead, uh, whenever a new feature is probably coming up, you know, with respect to the packages,
uh, you can actually create a new project and create a new environment out there.
But here, uh, the first step, what I'm actually going to do is that let's go ahead and create our
environment.
And for this also I will be using conda command.
So first of all I'll not go ahead and write in PowerShell.
Instead I'll go and click on uh Command prompt.
So quickly let's go ahead and write it down.
So here I'm going to write conda create minus p v and v python uh double equal to.
Let's say I want to go ahead with Python 3.12 okay.
And uh understand one thing is that, uh, over here we are using this conda create command v, and
v is specifically your environment name.
And which Python version we are specifically using.
It is 3.12.
Again based on different different projects.
It is not necessary that you always need to use 3.12.
It depends on the kind of packages that are available, let's say open source packages.
When we are creating deep learning projects or any machine learning projects as such.
Right.
So but here, uh, since we are learning this Python series completely from basics, I'm going to go
ahead and use this environment.
So once I probably click this.
So here you'll be able to see the installation will start taking place.
And when we are creating a virtual environment, some basic libraries or packages will be automatically
downloaded by this conda command.
So now here uh you can see over here what are the basic commands, uh, basic new packages that are
basically getting installed.
So here are all the packages.
So I'm just going to go ahead and click on uh press Y.
And once I probably do this all the installation of the libraries will happen.
Right.
So it is going to take some amount of time.
Again it depends on your internet speed.
But let me just go ahead and show you.
So here you can see a V and V environment is basically created.
And these are all the default packages that you will be able to find out.
Inside this right there will be a DLL folder.
There will be an include folder.
Right.
So, uh, what is the basic environment that is required for any Python project.
So that will be covered up inside this particular folder.
Okay.
Now once you go ahead and click this uh now the next thing is that let's say um, you, you want to
activate this environment, right?
So in order to activate this environment I will go ahead and write conda activate.
And we go ahead and use this v and v folder itself.
Write the same v and v folder.
And here we are just going to give the location of this write.
So once we press this you'll be able to see that I have activated the V and V environment okay.
And now you can probably run any kind of.py files directly from here by using Python specifically,
let's say I probably go ahead and create my app.py.
And let's say that I am just going to write over here print one plus one.
Right.
So this is the basic command.
Uh, and I'm printing this particular numerical operation one plus one.
Now if I really want to run this app dot pi, I have to make sure that I'm in the same folder location.
I have activated my venv environment.
And now within this particular environment, we will go ahead and just execute this file.
In order to execute it, you just need to write Python app.py.
So once you do this here, you'll be able to see that I'm able to get the response.
Okay.
Now uh, let me show you one more thing because see uh, as we go ahead with more lectures.
Right.
I'm actually going to create a folder, let's say this is first folder is Python basics okay.
Python basics.
So inside this folder itself I will go ahead and create my Jupyter notebook file or.py file.
Anything that I require.
Let's say I go ahead and create my Jupyter notebook file.
By default, uh, let's say this is my test dot ipynb.
Okay.
Now this Jupyter notebook file, uh, will be the similar Jupyter notebook file that we actually use
in, uh, Anaconda.
Right.
Uh, the Jupyter notebook, but in Python also, uh, sorry, in VS code, you will be able to see that.
Yes, internally you will be able to execute this text, uh, this uh, Jupyter notebook file also.
Now, initially, if I go ahead and uh, let's say over here, an option is probably coming up saying
that, hey, detecting kernels.
So if I want to say select the same environment right V and V I can go ahead and click on Detect kernels.
So here you'll get an option of selecting the Python environment.
Let's say this is the environment that I have created right.
Uh v and v Python 3.12.0.
And these are all the other environments that I have actually created in my, uh, local system.
Right.
So I'm just going to go ahead and select uh, 3.12.
Oh okay.
Now let's go ahead and execute any code.
Right.
So this is my code cell okay I can create any number of code cell that I really want right now.
Code cell is nothing.
But here I will be writing all my Python code in order to execute it.
Along with that you also have something like markdown.
So let's say that I, uh I have this markdown cell.
I can basically write comments saying like this, like let's say Python example.
And if I execute it, in order to execute this cell I have to press shift enter.
Okay.
So if I probably press shift enter automatically this will get executed.
Now the the reason we have used some markdown because I needed to write some information over here.
So like title and all.
So I'm writing it over here.
Right.
So if you press shift enter then automatically this cell will get executed.
Uh, along with this you also have an option of run all you know, if you want to run all the cells
over here, if you go ahead and, uh, see if you just go, go ahead and press right click, you'll
be having so many different, different options.
Okay.
But we are just going to use shift run uh shift enter so that we'll be able to execute it okay.
Now this is fine.
Let's run our first code in Jupyter Notebook.
So if I am going to write one plus one.
So here you can see I'm getting an error running cell with v and v.
Python 3.20120 requires the ipykernel package.
Okay, so this is one of the requirement that we really need to do.
Uh, we need to install Ipykernel.
Okay.
So here I'm what I'm going to write is that pip install.
If I want to install any packages I have to just go ahead and write pip install Ipykernel.
Okay.
So once I probably do this you'll be able to see that if I press enter you'll be seeing that hey, my
Ipykernel is basically getting installed now.
What is this Ipykernel package?
Ipykernel package is nothing, but it provides a kernel to this specific Jupyter notebook, which will
be responsible in executing the Python code, right?
It is pretty much necessary and compulsory in Anaconda.
The default Jupyter notebook has Ipykernel already integrated to it.
Okay, so this is the first thing that you really need to do.
Whenever you want to run the Jupyter notebook, you just go ahead and right pip install Ipykernel.
One more thing that you can actually do is that here what I will do, I will go ahead and create one
requirement dot txt because this requirement dot txt you know later on whatever packages I want.
Let's say the first package I want is Ipykernel.
I'll keep a note of this over here and any number of packages I will be requiring, let's say in the
future classes you'll be seeing pandas, numpy, different different packages.
So we will try to install it from here itself.
We'll write over here and we'll run this requirement dot txt which will be responsible in installing
all the packages.
Now you can see that uh, the Ipykernel has got successfully executed.
Now let me just go ahead and run this same code.
So here you'll be able to see if I run the same code.
Now it is just going to execute.
It is saying that connecting to Colonel.
And here I am having my output.
Right.
So now I can probably go ahead and write any type of code that I want.
Let's say I want to go ahead and write.
Print.
Hello hello world.
Okay.
Something like this.
So here we'll be able to see that it is executing right for.py file.
I don't want any type of colonel because in the terminal in the terminal automatically that particular
terminal uh, has this environment set up.
Right.
So in order to execute it I have to go ahead and write Python app dot p y, right.
Or whatever is the file name.
In this case, if I want to execute any cell, I have to just press that particular cell and press shift
enter.
Okay.
So in this video we have discussed about how you can go ahead and create your environment.
because going forward, any session that is probably going to come up in this course, I'm going to
probably create a folder wise like this.
For first class, I will probably create Python basics, create my Jupyter notebook file or.py file,
execute all the code in front of you, write all the code in front of you and continue right.
So for right now, I will just go ahead and delete this folder because I don't require it.
Because at the end of the day, I will do one thing.
Okay, just a second.
I will just close this, okay?
Yeah.
Now let me just go ahead and delete it, because in the next session I will go ahead and create everything
from scratch requirement dot txt I will keep it so that I keep on updating my packages.
So yes, this was it for my side.
I hope you like this video.
And in the next video we will start our Python basics.
So yes, this was it.
Thank you.
Take care.
Bye bye.