WEBVTT

00:00.380 --> 00:01.100
Hello guys.

00:01.100 --> 00:02.960
So welcome to the Python series.

00:02.960 --> 00:07.970
Uh, now we are going to start our first session with respect to Python.

00:08.030 --> 00:13.400
Now what we are going to do in this video is that, uh, uh, and the entire code that I'm actually

00:13.400 --> 00:17.930
going to specifically write, I'm going to use the VS code ID, uh, vs code ID.

00:17.930 --> 00:24.290
I find it really amazing because here you'll be able to execute your Jupyter notebook files, your.py

00:24.320 --> 00:24.710
files.

00:24.710 --> 00:28.910
Along with that, you'll also be able to create all the environments very much easily.

00:29.090 --> 00:32.660
Uh, so it is feasible that I specifically use VS code.

00:32.660 --> 00:38.030
Along with that, you have lot of features like extensions, code assistance, and many more things.

00:38.150 --> 00:44.090
So the first step, uh, as we are starting, you know, uh, what I'm actually going to do is that

00:44.120 --> 00:50.270
over here, we are going to create our new environment, as I said, um, in this Python series, I'm

00:50.270 --> 00:53.900
going to use the newest Python version that is Python 3.12.

00:53.930 --> 01:00.080
And I am going to teach in such a way that we all, we see all the new features that have actually come

01:00.080 --> 01:05.540
from 3.10 to 3.12, so all the new features that are specifically there.

01:05.750 --> 01:09.410
We will be also discussing about them in this Python series.

01:09.800 --> 01:14.840
Uh, the first step, as you know that I'm going to create an environment and again, why you specifically

01:14.840 --> 01:15.830
require an environment.

01:15.830 --> 01:22.670
Because an environment is necessary whenever you start a new project, because in our Python project

01:22.670 --> 01:27.440
or in our data science project, we make sure that we use multiple packages, multiple libraries and.

01:27.440 --> 01:27.830
All right.

01:27.830 --> 01:33.440
And uh, every couple of months this packages or this libraries have new features and most of them are

01:33.440 --> 01:34.880
open source packages or libraries.

01:34.910 --> 01:35.090
Right.

01:35.120 --> 01:39.920
So they definitely have a lot of features that gets included every couple of months.

01:39.920 --> 01:45.620
So it is always necessary that you always maintain, uh, or try to create your entire projects in a

01:45.620 --> 01:50.990
separate, uh, with a separate environment so that there should be not any conflict, as you probably

01:50.990 --> 01:55.700
go ahead, uh, whenever a new feature is probably coming up, you know, with respect to the packages,

01:55.700 --> 01:59.570
uh, you can actually create a new project, create a new environment out there.

01:59.570 --> 02:03.950
But here, uh, the first step, what I'm actually going to do is that let's go ahead and create our

02:03.950 --> 02:04.430
environment.

02:04.430 --> 02:07.580
And for this also I will be using conda command.

02:07.580 --> 02:10.190
So first of all, I'll not go ahead and write in PowerShell.

02:10.190 --> 02:13.040
Instead, I'll go and click on Command Prompt.

02:13.040 --> 02:15.560
So quickly let's go ahead and write it down.

02:15.560 --> 02:21.860
So here I'm going to write conda create minus p v and v python uh double equal to.

02:21.890 --> 02:25.040
Let's say I want to go ahead with Python 3.12 okay.

02:25.040 --> 02:33.020
And understand one thing is that, uh over here we are using this conda create command v and v is specifically

02:33.020 --> 02:34.370
your environment name.

02:34.370 --> 02:37.160
And which Python version we are specifically using.

02:37.160 --> 02:38.090
It is 3.12.

02:38.120 --> 02:40.520
Again based on different different projects.

02:40.520 --> 02:43.370
It is not necessary that you always need to use 3.12.

02:43.400 --> 02:48.050
It depends on the kind of packages that are available, let's say open source packages.

02:48.050 --> 02:51.830
When we are creating deep learning projects or any machine learning projects as such.

02:51.860 --> 02:52.070
Right.

02:52.070 --> 02:56.630
So but here, uh, since we are learning this Python series completely from basics, I'm going to go

02:56.660 --> 02:58.130
ahead and use this environment.

02:58.130 --> 02:59.750
So once I probably click this.

02:59.750 --> 03:03.320
So here you'll be able to see the installation will start taking place.

03:03.320 --> 03:09.050
And when we are creating a virtual environment, some basic libraries or packages will be automatically

03:09.050 --> 03:10.820
downloaded by this conda command.

03:10.820 --> 03:17.500
So now here you can see over here what are the basic commands, uh, basic new packages that are basically

03:17.500 --> 03:18.310
getting installed.

03:18.310 --> 03:20.110
So here are all the packages.

03:20.110 --> 03:23.320
So I'm just going to go ahead and click on, uh, press Y.

03:23.320 --> 03:27.910
And once I probably do this all the installation of the libraries will happen.

03:27.940 --> 03:28.360
Right.

03:28.360 --> 03:30.790
So it is going to take some amount of time.

03:30.790 --> 03:32.650
Again it depends on your internet speed.

03:32.650 --> 03:34.360
But let me just go ahead and show you.

03:34.360 --> 03:37.660
So here you can see a V and V environment is basically created.

03:37.660 --> 03:40.990
And these are all the default packages that you will be able to find out.

03:40.990 --> 03:43.660
Inside this right there will be a DLL folder.

03:43.690 --> 03:45.490
There will be an include folder.

03:45.520 --> 03:45.850
Right.

03:45.850 --> 03:50.890
So uh what is the basic environment that is required for any Python project.

03:50.920 --> 03:54.010
So that will be covered up inside this particular folder.

03:54.040 --> 03:54.580
Okay.

03:54.790 --> 04:00.520
Now once you go ahead and click this uh now the next thing is that let's say uh, you want to activate

04:00.520 --> 04:01.600
this environment, right.

04:01.600 --> 04:05.440
So in order to activate this environment I will go ahead and write conda activate.

04:05.440 --> 04:09.340
And we go ahead and use this v and v folder itself.

04:09.370 --> 04:09.610
Right.

04:09.640 --> 04:11.050
The same v and v folder.

04:11.050 --> 04:13.930
And here we are just going to give the location of this right.

04:13.960 --> 04:19.110
So once we press this, you'll be able to see that I have activated the venv environment.

04:19.140 --> 04:19.680
Okay.

04:19.770 --> 04:26.040
And now you can probably run any kind of.py files directly from here by using Python.

04:26.400 --> 04:31.170
Specifically, let's say I probably go ahead and create my app.py.

04:31.170 --> 04:36.510
And let's say that I am just going to write over here print one plus one right.

04:36.510 --> 04:38.040
So this is the basic command.

04:38.160 --> 04:41.340
And I'm printing this particular numerical operation one plus one.

04:41.370 --> 04:47.100
Now if I really want to run this app.py I have to make sure that I'm in the same folder location.

04:47.100 --> 04:52.260
I have activated my venv environment and now within this particular environment, we will go ahead and

04:52.260 --> 04:53.760
just execute this file.

04:53.760 --> 04:57.090
In order to execute it, you just need to write python app.py.

04:57.180 --> 05:00.960
So once you do this here, you'll be able to see that I'm able to get the response.

05:00.990 --> 05:01.530
Okay.

05:01.680 --> 05:03.810
Now let me show you one more thing.

05:03.810 --> 05:09.420
Because see as we go ahead with more lectures right I'm actually going to create a folder.

05:09.420 --> 05:13.500
Let's say this is first folder is Python Basics okay.

05:13.500 --> 05:14.670
Python basics.

05:14.670 --> 05:20.890
So inside this folder itself I will go ahead and create my Jupyter notebook file or.py file, anything

05:20.890 --> 05:21.670
that I require.

05:21.700 --> 05:25.270
Let's say I go ahead and create my Jupyter notebook file by default.

05:25.630 --> 05:28.120
Let's say this is my test dot Ipynb.

05:28.360 --> 05:29.020
Okay.

05:29.230 --> 05:35.890
Now this Jupyter notebook file will be the similar Jupyter notebook file that we actually use in Anaconda,

05:35.890 --> 05:36.190
right?

05:36.460 --> 05:42.070
The Jupyter notebook, but in Python also sorry, in VS code you will be able to see that yes, internally

05:42.070 --> 05:46.120
you will be able to execute this text or this Jupyter notebook file also.

05:46.150 --> 05:51.760
Now initially if I go ahead and let's say over here, an option is probably coming up saying that,

05:51.790 --> 05:53.320
hey detecting kernels.

05:53.320 --> 05:59.650
So if I want to say select the same environment right V and V I can go ahead and click on Detect kernels.

05:59.650 --> 06:03.070
So here you'll get an option of selecting the Python environment.

06:03.070 --> 06:05.650
Let's say this is the environment that I have created right.

06:05.830 --> 06:08.890
Uh v and v Python 3.12.0.

06:08.890 --> 06:13.180
And these are all the other environments that I've actually created in my, uh, local system.

06:13.210 --> 06:13.510
Right.

06:13.510 --> 06:16.390
So I'm just going to go ahead and select uh, 3.12.

06:16.420 --> 06:17.320
Oh okay.

06:17.350 --> 06:19.510
Now let's go ahead and execute any code.

06:19.510 --> 06:19.720
Right.

06:19.750 --> 06:21.370
So this is my code cell okay.

06:21.400 --> 06:22.950
I can create any number of codes.

06:22.950 --> 06:25.470
Cell that I really want right now.

06:25.470 --> 06:26.310
Code cell is nothing.

06:26.310 --> 06:30.090
But here I will be writing all my Python code in order to execute it.

06:30.180 --> 06:32.400
Along with that, you also have something like markdown.

06:32.400 --> 06:36.330
So let's say that I, uh, I have this markdown cell.

06:36.330 --> 06:40.590
I can basically write comments saying like this, like let's say Python example.

06:40.590 --> 06:46.830
And if I execute it, in order to execute this cell I have to press shift enter.

06:46.860 --> 06:47.250
Okay.

06:47.280 --> 06:50.760
So if I probably press shift enter automatically this will get executed.

06:50.760 --> 06:55.170
Now the the reason we have used some markdown because I needed to write some information over here.

06:55.170 --> 06:56.160
So like title.

06:56.160 --> 06:57.750
And also I'm writing it over here.

06:57.780 --> 06:58.230
Right.

06:58.230 --> 07:02.280
So if you press shift enter then automatically this cell will get executed.

07:02.550 --> 07:07.770
Uh along with this you also have an option of run all you know, if you want to run all the cells over

07:07.770 --> 07:13.230
here, if you go ahead and, uh, see if you just go ahead and press right click, you'll be having

07:13.230 --> 07:14.550
so many different, different options.

07:14.580 --> 07:15.060
Okay.

07:15.060 --> 07:20.400
But we are just going to use shift run shift enter so that we'll be able to execute it okay.

07:20.400 --> 07:21.330
Now this is fine.

07:21.330 --> 07:24.210
Let's run our first code in Jupyter Notebook.

07:24.210 --> 07:25.830
So if I am going to write one plus one.

07:25.830 --> 07:29.910
So here you can see I'm getting an error running cell with v and v.

07:29.940 --> 07:34.710
Python 3.41 to 0 requires the ipykernel package.

07:34.740 --> 07:37.830
Okay, so this is one of the requirement that we really need to do.

07:38.040 --> 07:40.560
We need to install Ipykernel.

07:40.590 --> 07:41.040
Okay.

07:41.040 --> 07:44.340
So here I'm what I'm going to write is that pip install.

07:44.340 --> 07:49.230
If I want to install any packages I have to just go ahead and write pip install Ipykernel.

07:49.260 --> 07:49.680
Okay.

07:49.680 --> 07:55.410
So once I probably do this you'll be able to see that if I press enter you'll be seeing that hey, my

07:55.440 --> 07:57.210
Ipykernel is basically getting installed.

07:57.240 --> 07:59.130
Now what is this Ipykernel package?

07:59.160 --> 08:03.930
Ipykernel package is nothing, but it provides a kernel to this specific Jupyter notebook, which will

08:03.960 --> 08:07.020
be responsible in executing the Python code.

08:07.050 --> 08:07.560
Right.

08:07.560 --> 08:10.830
It is pretty much necessary and compulsory in Anaconda.

08:10.860 --> 08:14.910
The default Jupyter notebook has Ipykernel already integrated to it.

08:14.940 --> 08:17.610
Okay, so this is the first thing that you really need to do.

08:17.610 --> 08:22.890
Whenever you want to run the Jupyter notebook, you just go ahead and write pip install Ipykernel.

08:22.920 --> 08:27.150
One more thing that you can actually do is that here what I will do, I will go ahead and create one

08:27.150 --> 08:32.950
requirements.txt TXT because this requirements txt you know later on whatever packages I want.

08:32.980 --> 08:35.410
Let's say the first package I want is Ipykernel.

08:35.440 --> 08:40.630
I'll keep a note of this over here and any number of packages I will be requiring let's say in the future

08:40.630 --> 08:44.260
classes you'll be seeing pandas numpy different different packages.

08:44.260 --> 08:46.570
So we will try to install it from here itself.

08:46.570 --> 08:50.920
We'll write over here and we'll run this requirement dot txt which will be responsible in installing

08:50.920 --> 08:51.820
all the packages.

08:51.820 --> 08:55.480
Now you can see that the Ipykernel has got successfully executed.

08:55.480 --> 08:57.910
Now let me just go ahead and run the same code.

08:57.910 --> 09:00.340
So here you'll be able to see if I run the same code.

09:00.340 --> 09:01.990
Now it is just going to execute.

09:01.990 --> 09:03.640
It is saying that connecting to kernel.

09:03.640 --> 09:06.280
And here I am having my output right.

09:06.280 --> 09:09.640
So now I can probably go ahead and write any type of code that I want.

09:09.670 --> 09:11.590
Let's say I want to go ahead and write print.

09:11.620 --> 09:14.350
Hello hello world.

09:14.350 --> 09:14.680
Okay.

09:14.710 --> 09:15.610
Something like this.

09:15.610 --> 09:19.630
So here you'll be able to see that it is executing right for.py file.

09:19.630 --> 09:25.540
I don't want any type of kernel because in the terminal in the terminal automatically that particular

09:25.540 --> 09:28.600
terminal has this environment set up right.

09:28.600 --> 09:33.440
So in order to execute it I have to go ahead and write Python app dot Pi, right?

09:33.620 --> 09:35.030
Or whatever is the file name.

09:35.030 --> 09:40.850
In this case, if I want to execute any cell, I have to just press that particular cell and press shift

09:40.850 --> 09:41.420
enter.

09:41.450 --> 09:41.990
Okay.

09:42.200 --> 09:46.970
So in this video we have discussed about how you can go ahead and create your environment.

09:46.970 --> 09:51.830
Because going forward, any session that is probably going to come up in this course, I'm going to

09:51.860 --> 09:53.990
probably create a folder wise like this.

09:53.990 --> 09:59.600
For the first class I will probably create Python basics, create my Jupyter notebook file or.py file,

09:59.600 --> 10:03.890
execute all the code in front of you, write all the code in front of you and continue right.

10:03.890 --> 10:08.360
So for right now, I will just go ahead and delete this folder because I don't require it.

10:08.360 --> 10:11.180
Because at the end of the day, I will do one thing.

10:11.210 --> 10:12.200
Okay, just a second.

10:12.230 --> 10:13.850
I will just close this okay.

10:14.360 --> 10:14.780
Yeah.

10:14.810 --> 10:16.670
Now let me just go ahead and delete it.

10:16.670 --> 10:22.100
Because in the next session I will go ahead and create everything from scratch requirement dot txt I

10:22.100 --> 10:24.860
will keep it so that I keep on updating my packages.

10:24.860 --> 10:27.470
So yes, this was it from my side.

10:27.470 --> 10:33.320
I hope you like this video and in the next video we will start our Python basics.

10:33.320 --> 10:34.970
So yes, this was it.

10:34.970 --> 10:35.420
Thank you.

10:35.450 --> 10:35.900
Take care.

10:35.930 --> 10:36.560
Bye bye.
