1
00:00:00,000 --> 00:00:05,000
So guys, one of the most important question that I've been asked by many people who implement end to

2
00:00:05,000 --> 00:00:09,000
end project, that is with respect to creating an environment.

3
00:00:09,000 --> 00:00:13,000
Now, there are multiple ways in creating an environment, uh, for a project.

4
00:00:13,000 --> 00:00:18,000
And it is always a good idea that you probably create a separate environment for every project because

5
00:00:18,000 --> 00:00:23,000
you have a different set of dependencies and libraries that you need to install over there.

6
00:00:23,000 --> 00:00:31,000
Now, considering this right, I usually in my YouTube channel I use conda command to create a environment

7
00:00:31,000 --> 00:00:31,000
itself.

8
00:00:31,000 --> 00:00:32,000
Right.

9
00:00:32,000 --> 00:00:35,000
And many people do not have anaconda installed, they just have Python installed.

10
00:00:35,000 --> 00:00:38,000
So due to that they get some kind of error.

11
00:00:38,000 --> 00:00:39,000
Right?

12
00:00:39,000 --> 00:00:43,000
You can also create an environment through this Python command which I'm going to show you.

13
00:00:43,000 --> 00:00:48,000
So again in this video what all things I'm actually going to cover all the different ways how you can

14
00:00:48,000 --> 00:00:52,000
probably create an environment and start your end to end project itself.

15
00:00:52,000 --> 00:00:55,000
So let me quickly go ahead and show you.

16
00:00:55,000 --> 00:00:57,000
I'm going to show you three different ways.

17
00:00:57,000 --> 00:00:59,000
I'll open my terminal.

18
00:01:00,000 --> 00:01:00,000
Okay.

19
00:01:00,000 --> 00:01:06,000
And the best thing is that you can use along with you can use as a Linux command.

20
00:01:06,000 --> 00:01:09,000
Also you can use as in Windows Command Prompt also.

21
00:01:09,000 --> 00:01:11,000
So let me just show you the first way.

22
00:01:11,000 --> 00:01:17,000
The first way will be using python command right conda create command I usually show you.

23
00:01:17,000 --> 00:01:20,000
But today I will show you all the three ways how you can actually do it.

24
00:01:20,000 --> 00:01:23,000
So let me go ahead and write by using the Python command.

25
00:01:23,000 --> 00:01:27,000
So I will write p y t h and python okay.

26
00:01:27,000 --> 00:01:30,000
And then here I will go ahead and write minus m okay.

27
00:01:30,000 --> 00:01:35,000
And my command name that is v and v inside what folder.

28
00:01:35,000 --> 00:01:35,000
Okay.

29
00:01:35,000 --> 00:01:38,000
So here let's say my folder is y my e and v.

30
00:01:38,000 --> 00:01:42,000
So once I do this this folder will automatically get created okay.

31
00:01:42,000 --> 00:01:45,000
And by default my a environment will be set up.

32
00:01:45,000 --> 00:01:51,000
Now inside this particular environment, what kind of, uh, Python version you specifically have for

33
00:01:51,000 --> 00:01:52,000
that?

34
00:01:52,000 --> 00:01:54,000
First of all, let's go ahead and activate it okay.

35
00:01:54,000 --> 00:02:00,000
Now to activate this, what I will do inside my me env there will be include libraries folders and all

36
00:02:00,000 --> 00:02:01,000
inside script.

37
00:02:01,000 --> 00:02:02,000
There is one activate file.

38
00:02:02,000 --> 00:02:07,000
So I just need to go ahead and activate this to activate this particular environment.

39
00:02:07,000 --> 00:02:16,000
So for that what I will do I will write my env slash scripts slash activate okay.

40
00:02:16,000 --> 00:02:20,000
So once I write this and now here you can see that my environment is activated.

41
00:02:20,000 --> 00:02:24,000
Now I can probably go ahead and install any kind of libraries that I specifically want.

42
00:02:24,000 --> 00:02:26,000
Let's say pip install pandas.

43
00:02:26,000 --> 00:02:34,000
If I do or pip install numpy, then automatically the numpy will get installed in this specific library.

44
00:02:34,000 --> 00:02:34,000
Okay.

45
00:02:34,000 --> 00:02:39,000
And later on, if you have many number of libraries, you can basically create a requirement dot txt

46
00:02:39,000 --> 00:02:40,000
for this.

47
00:02:40,000 --> 00:02:43,000
The prerequisite is that you only need to have python installed.

48
00:02:43,000 --> 00:02:48,000
Now, which version of Python is probably getting installed over here that also you really need to check

49
00:02:48,000 --> 00:02:49,000
by default.

50
00:02:49,000 --> 00:02:53,000
Let's say in my Python environment right now I just shot right.

51
00:02:53,000 --> 00:02:55,000
Let's let's go and see my Python version.

52
00:02:55,000 --> 00:02:58,000
So let me go ahead and write Python version.

53
00:02:59,000 --> 00:03:01,000
So inside my Python version oops.

54
00:03:02,000 --> 00:03:05,000
You can see Python 3.8.5 is there, right?

55
00:03:05,000 --> 00:03:08,000
So by default whenever I create an environment.

56
00:03:08,000 --> 00:03:12,000
So this Python 3.85 only will get created.

57
00:03:12,000 --> 00:03:14,000
Because in my system I have this specific thing installed.

58
00:03:14,000 --> 00:03:18,000
Let's say I want to create with another Python version.

59
00:03:18,000 --> 00:03:21,000
Then I need to upgrade my Python package itself, right?

60
00:03:21,000 --> 00:03:24,000
I need to probably make it to 3.1. 3.1.0 or 3.1.2.

61
00:03:24,000 --> 00:03:27,000
What I need to do is that just go to Google, okay?

62
00:03:27,000 --> 00:03:32,000
And probably let's say I go to python.org and here I download the recent version.

63
00:03:32,000 --> 00:03:33,000
Now automatically.

64
00:03:33,000 --> 00:03:37,000
What will happen is that whenever I create an environment that through that way then I will get this

65
00:03:37,000 --> 00:03:38,000
specific version.

66
00:03:38,000 --> 00:03:40,000
So this is one way okay.

67
00:03:40,000 --> 00:03:41,000
The another way.

68
00:03:41,000 --> 00:03:44,000
So let me quickly I've activated it.

69
00:03:44,000 --> 00:03:46,000
Now I will go ahead and deactivate it.

70
00:03:46,000 --> 00:03:47,000
I will clear the screen.

71
00:03:47,000 --> 00:03:50,000
So this is one environment that has got created.

72
00:03:50,000 --> 00:03:54,000
Now there is also another way which we specifically use for Linux.

73
00:03:54,000 --> 00:03:55,000
Uh, Linux commands itself.

74
00:03:55,000 --> 00:03:59,000
So first of all I will go ahead and install virtualenv.

75
00:03:59,000 --> 00:04:02,000
So this virtual env sorry I think it will get an error.

76
00:04:02,000 --> 00:04:06,000
So virtual env this I will try to install.

77
00:04:06,000 --> 00:04:12,000
So once I probably install virtualenv I'll show you how you can create a command an environment through

78
00:04:12,000 --> 00:04:17,000
using virtual envy itself, and that also you can also use it in PowerShell or Good Bash.

79
00:04:17,000 --> 00:04:21,000
So in Virtual Envy I will go ahead and write virtual envy okay.

80
00:04:21,000 --> 00:04:27,000
And after writing virtual envy, let me go and go ahead and write it minus pi P.

81
00:04:27,000 --> 00:04:29,000
And then I will go ahead and write Python.

82
00:04:29,000 --> 00:04:30,000
Okay.

83
00:04:30,000 --> 00:04:33,000
Python the version I know that it is somewhere around three.

84
00:04:33,000 --> 00:04:38,000
And this will basically be my virtual environment name virtual underscore EMV.

85
00:04:38,000 --> 00:04:44,000
So once I go ahead and execute it, you'll be able to see that now inside this virtual EMV is also getting

86
00:04:44,000 --> 00:04:44,000
created.

87
00:04:44,000 --> 00:04:47,000
And inside this also you have a script folder.

88
00:04:47,000 --> 00:04:50,000
So if you want to activate somewhere activate via.

89
00:04:50,000 --> 00:04:51,000
This will also be there right?

90
00:04:51,000 --> 00:04:53,000
Activate file will be there to activate those commands.

91
00:04:53,000 --> 00:04:59,000
So in order to activate it what I will do, I will quickly go ahead and clear the screen and go ahead

92
00:04:59,000 --> 00:05:05,000
and write virtual env I think the the folder name is virtual envy, I guess.

93
00:05:06,000 --> 00:05:07,000
Let's see.

94
00:05:07,000 --> 00:05:09,000
Virtual underscore envy.

95
00:05:10,000 --> 00:05:12,000
Virtual underscore envy.

96
00:05:12,000 --> 00:05:18,000
So slash scripts slash back slash activate.

97
00:05:18,000 --> 00:05:22,000
So once I activate now here you can see I'm getting some error.

98
00:05:22,000 --> 00:05:24,000
Let's see what is the file name.

99
00:05:24,000 --> 00:05:25,000
Scripts.

100
00:05:26,000 --> 00:05:27,000
Scripts?

101
00:05:27,000 --> 00:05:29,000
Uh, slash.

102
00:05:29,000 --> 00:05:32,000
I think the spelling is somewhere here itself.

103
00:05:32,000 --> 00:05:33,000
Let's see.

104
00:05:33,000 --> 00:05:35,000
I will go ahead and copy this path.

105
00:05:37,000 --> 00:05:38,000
Okay.

106
00:05:45,000 --> 00:05:45,000
Oops.

107
00:05:45,000 --> 00:05:46,000
Let me just see.

108
00:05:46,000 --> 00:05:47,000
Okay.

109
00:05:47,000 --> 00:05:48,000
Activate.

110
00:05:48,000 --> 00:05:50,000
Activate, activate.

111
00:05:50,000 --> 00:05:52,000
I will copy the relative path.

112
00:05:52,000 --> 00:05:53,000
I'll paste it over there.

113
00:05:56,000 --> 00:05:57,000
Now I think it should be.

114
00:05:57,000 --> 00:06:00,000
Now you can see that it has got, uh.

115
00:06:00,000 --> 00:06:02,000
It moves into this particular virtual environment.

116
00:06:02,000 --> 00:06:04,000
Now, in order to deactivate, I will go ahead and deactivate.

117
00:06:04,000 --> 00:06:05,000
Okay.

118
00:06:05,000 --> 00:06:07,000
Now, this is the thing, right?

119
00:06:07,000 --> 00:06:11,000
Uh, through this, what you really need to do is that whenever you upgrade your Python, you'll be

120
00:06:11,000 --> 00:06:17,000
able to create that particular Python, uh, environment with that particular Python version In this,

121
00:06:17,000 --> 00:06:22,000
the third way, which is the most common way in which I also use is by using conda create.

122
00:06:22,000 --> 00:06:28,000
For this you really need to have Anaconda installed, and Anaconda is a better way I feel, because

123
00:06:28,000 --> 00:06:36,000
here you will be able to, you know, make sure that all the packages, all the environments are properly

124
00:06:36,000 --> 00:06:37,000
managed through the Anaconda environment.

125
00:06:37,000 --> 00:06:40,000
You can actually see each and every packages that has got installed.

126
00:06:40,000 --> 00:06:42,000
So you can also use this specifically.

127
00:06:42,000 --> 00:06:49,000
And for this way you only have to write conda create minus p v and v.

128
00:06:49,000 --> 00:06:51,000
Let's say v and v one.

129
00:06:51,000 --> 00:06:57,000
And here I will give my python version with respect to anything that I want 3.10 and dot and y.

130
00:06:57,000 --> 00:06:57,000
Right.

131
00:06:57,000 --> 00:07:03,000
So this command actually helps you to create an environment even though in the base you have different

132
00:07:03,000 --> 00:07:04,000
Python version.

133
00:07:04,000 --> 00:07:14,000
See right now you have Python version Python v okay I will write python dash dash v.

134
00:07:14,000 --> 00:07:16,000
So here okay.

135
00:07:16,000 --> 00:07:20,000
Version okay Python 3.8.5.

136
00:07:20,000 --> 00:07:25,000
Right now what I will do is that I will make sure that I create it through the conda.

137
00:07:25,000 --> 00:07:30,000
So I will write conda create minus p v and v one python.

138
00:07:30,000 --> 00:07:32,000
Let's say I want to go with higher version.

139
00:07:33,000 --> 00:07:35,000
Python double equal to 3.10.

140
00:07:35,000 --> 00:07:36,000
Right.

141
00:07:36,000 --> 00:07:39,000
And if I write w dash y then you can see that automatically.

142
00:07:39,000 --> 00:07:42,000
My entire environment will get created right.

143
00:07:42,000 --> 00:07:45,000
So I still find this as an efficient way.

144
00:07:45,000 --> 00:07:49,000
But again if you don't have Anaconda and whenever because many, many people are getting this kind of

145
00:07:49,000 --> 00:07:54,000
errors when they are doing my project because I only use Conda because that is much more efficient when

146
00:07:54,000 --> 00:07:57,000
I compare it to Python, But it is not possible.

147
00:07:57,000 --> 00:07:59,000
I'm not saying that it is impossible to create in other ways.

148
00:08:00,000 --> 00:08:01,000
You can go with that.

149
00:08:01,000 --> 00:08:06,000
So that is the reason I have shown you all the specific ways to go ahead, and you can create a virtual

150
00:08:06,000 --> 00:08:08,000
environment based on your needs.

151
00:08:08,000 --> 00:08:10,000
So I hope you like this particular video.

152
00:08:10,000 --> 00:08:11,000
This was it for my side.

153
00:08:11,000 --> 00:08:16,000
And this was the video about creating different ways of environment in your Python projects itself.

154
00:08:17,000 --> 00:08:17,000
Uh, yes.

155
00:08:17,000 --> 00:08:21,000
Go ahead and try it out and if you have any queries, please let me know in the comment section of this

156
00:08:21,000 --> 00:08:21,000
particular video.

