1
00:00:04,140 --> 00:00:12,390
So one important recommendation before going into the specifics of the practical part of the program,

2
00:00:12,810 --> 00:00:15,720
use virtual environments.

3
00:00:15,750 --> 00:00:17,760
This is our recommendation.

4
00:00:18,300 --> 00:00:20,400
What are virtual environments?

5
00:00:20,670 --> 00:00:29,040
A using virtual environments allows us to encapsulate the versions of Python and the modules we use.

6
00:00:29,070 --> 00:00:38,100
So using virtual environments is a way to separate what you are going to do for your LM applications

7
00:00:38,100 --> 00:00:41,730
from the rest of the things you have in your computer.

8
00:00:41,850 --> 00:00:51,240
And this is important because it is going to prevent, uh, from contaminating ourselves with the version

9
00:00:51,240 --> 00:00:54,540
of Python or other global installed modules.

10
00:00:54,750 --> 00:01:02,070
And it's also going to prevent us from contaminating the global environment with our own version of

11
00:01:02,070 --> 00:01:04,709
Python or the modules we have.

12
00:01:05,099 --> 00:01:07,200
Uh, or we are going to install.

13
00:01:07,200 --> 00:01:09,240
So it's just a.

14
00:01:10,400 --> 00:01:16,340
A way to separate everything you are going to do for your applications with the rest of the things you

15
00:01:16,340 --> 00:01:17,570
have in your computer.

16
00:01:17,570 --> 00:01:27,020
And this in some cases is very, very, uh, useful because it is going to avoid conflicts, because

17
00:01:27,020 --> 00:01:33,020
in some cases, for example, if you are a mac user, you are going to have a default version of Python

18
00:01:33,020 --> 00:01:35,150
installed with your Mac.

19
00:01:35,150 --> 00:01:40,820
And you may have, you know, different things on top of that, different applications or whatever running

20
00:01:40,820 --> 00:01:43,370
on top of that Python version.

21
00:01:43,370 --> 00:01:49,520
And if you install an updated version of Python, you know, in order to build your LM applications,

22
00:01:49,520 --> 00:01:52,220
this may have conflicts with the one you have.

23
00:01:52,220 --> 00:01:58,250
Well, it can be very messy and it's very simple to create, you know, virtual environments.

24
00:01:58,250 --> 00:02:03,530
And it's going to prevent you a painful, uh, situations.

25
00:02:03,530 --> 00:02:07,340
So it is not necessary but is advisable.

26
00:02:07,340 --> 00:02:13,340
It can save you headaches, I mean, an old version of Python installed on your computer, or having

27
00:02:13,340 --> 00:02:17,660
other projects that use older versions of the modules you are going to to use.

28
00:02:17,780 --> 00:02:26,060
If you are already familiar with the virtual environments A or already have another system installed

29
00:02:26,180 --> 00:02:31,010
to manage this such Anaconda or Miniconda, you can ignore the following tips.

30
00:02:31,370 --> 00:02:42,350
If you are not familiar with virtual environments, you, um, probably have the best option with Pyenv.

31
00:02:42,350 --> 00:02:52,160
Pi env is a free framework you can install in your computer, and it will help you to create a virtual

32
00:02:52,160 --> 00:02:54,530
environment for each of your projects.

33
00:02:56,170 --> 00:03:06,490
So just in case, if you are using Anaconda or other similar tools and you want to use a pi env no pi

34
00:03:06,490 --> 00:03:08,440
dev here you see this?

35
00:03:08,440 --> 00:03:09,340
This is a typo.

36
00:03:09,340 --> 00:03:12,400
It's not pi dev is pi env.

37
00:03:12,400 --> 00:03:19,270
So if you want to use pi env to create a virtual environment and you have other platforms like Anaconda

38
00:03:19,270 --> 00:03:26,110
or Miniconda running in your computer already, you will need to deactivate the Anaconda environment

39
00:03:26,110 --> 00:03:30,400
first with this, uh, command conda deactivate.

40
00:03:30,400 --> 00:03:30,970
Why?

41
00:03:31,000 --> 00:03:36,250
Because Anaconda by default is going to create virtual environments for you.

42
00:03:36,250 --> 00:03:40,330
So this this can be a conflict with pi m.

43
00:03:42,480 --> 00:03:43,740
To install Pyenv.

44
00:03:43,770 --> 00:03:52,530
The best thing you can do is you go to ChatGPT and ask how to install Pi in my computer, and it's going

45
00:03:52,530 --> 00:03:57,030
to be super easy and super fast for you to solve it.

46
00:03:57,030 --> 00:04:01,140
In short, what are you going to do first?

47
00:04:01,140 --> 00:04:04,020
If you are on Mac, you will need to have homebrew.

48
00:04:04,050 --> 00:04:08,970
Homebrew is the tool that is going to help you install other things.

49
00:04:08,970 --> 00:04:11,130
On top of homebrew.

50
00:04:11,160 --> 00:04:17,459
You are going to install first a couple of dependencies and then pi env.

51
00:04:17,459 --> 00:04:18,660
Now pi dev.

52
00:04:18,870 --> 00:04:22,320
This is a typo you are going to install is pi env.

53
00:04:22,320 --> 00:04:30,420
Okay, so once you install pi env, you will need to update the configuration file of your computer.

54
00:04:30,420 --> 00:04:36,510
And this is the bash or the this other file with this super strange name.

55
00:04:36,510 --> 00:04:41,340
And the best thing you can do is to follow the instructions of GPT.

56
00:04:41,370 --> 00:04:41,880
There.

57
00:04:41,880 --> 00:04:46,770
It's going to tell you open the file, include this line there and that's it okay.

58
00:04:46,770 --> 00:04:47,880
So do that.

59
00:04:47,880 --> 00:04:52,890
Usually safe to restart terminal as ChatGPT will tell you.

60
00:04:52,890 --> 00:05:02,790
And then once you have pi env install you are going to decide what versions of Python you will want

61
00:05:02,790 --> 00:05:07,710
to have in your computer in order to choose among them, you know, for your different projects.

62
00:05:07,710 --> 00:05:13,230
In my case, I installed the version 311 four.

63
00:05:13,260 --> 00:05:16,170
I want to go to the 312 I.

64
00:05:16,170 --> 00:05:23,430
I am happy with the 311 four version of Python, so I install that and restart the terminal.

65
00:05:23,940 --> 00:05:30,330
Once you have that you will need to install pi env virtualenv.

66
00:05:30,510 --> 00:05:36,540
And with that ready you can create a virtual environment.

67
00:05:36,540 --> 00:05:40,470
So the first thing you have to do is pi env virtualenv init.

68
00:05:40,470 --> 00:05:42,660
Then you restart the terminal.

69
00:05:42,660 --> 00:05:49,320
And then in order to create the virtual environment you will go to the project directory.

70
00:05:50,330 --> 00:05:53,420
You will create a virtual environment.

71
00:05:53,630 --> 00:05:54,680
Uh.

72
00:05:54,680 --> 00:05:55,580
This way.

73
00:05:56,570 --> 00:06:01,070
So Pyenv is the command virtual environment.

74
00:06:01,100 --> 00:06:06,140
This is the version of Python you want to have installed in your build environment.

75
00:06:06,140 --> 00:06:09,590
And this is the name of your virtual environment, whatever you want.

76
00:06:09,800 --> 00:06:12,170
Okay, this is the name that you are going to choose.

77
00:06:12,980 --> 00:06:18,080
You activate the virtual environment with this, uh, command.

78
00:06:18,080 --> 00:06:20,720
Remember that this is going to be the name you choose.

79
00:06:20,810 --> 00:06:26,720
And once you have the virtual environment, you will see that in your terminal you are going to have

80
00:06:26,720 --> 00:06:30,140
the name of your environment and in parentheses.

81
00:06:30,140 --> 00:06:34,820
And there it means that you are right now in your new virtual environment.

82
00:06:34,820 --> 00:06:41,210
And then you need to start installing the different software you want to have there.

83
00:06:41,210 --> 00:06:45,500
So in our case we are going to install and chain.

84
00:06:45,980 --> 00:06:49,730
We are going to install Jupyter and we are going to install Python.

85
00:06:50,060 --> 00:06:58,280
And this is important because this is going to be necessary for us to have the hidden env file for our

86
00:06:58,280 --> 00:07:01,430
passwords and API keys, etc., etc..

87
00:07:01,580 --> 00:07:02,120
Right.

88
00:07:02,570 --> 00:07:03,830
So.

89
00:07:05,210 --> 00:07:10,040
If you are not familiar with terminal, don't worry, we have a chapter coming for for that.

90
00:07:10,370 --> 00:07:19,790
So once you have a pi env installed, you normally will will create a different virtual environment

91
00:07:19,790 --> 00:07:22,730
for each of your professional projects.

92
00:07:22,880 --> 00:07:28,490
And in the case of the projects included in this course, if you want, you can create a different virtual

93
00:07:28,490 --> 00:07:29,990
environments for each of them.

94
00:07:29,990 --> 00:07:34,220
Or you can have the same virtual environment for all of them.

95
00:07:34,220 --> 00:07:34,730
Why?

96
00:07:34,730 --> 00:07:40,280
Because we are going to use the same version of Python and the same version of the modules.

97
00:07:40,280 --> 00:07:47,480
So, uh, then being in a virtual environment, you don't contaminate it with other elements in your

98
00:07:47,480 --> 00:07:48,200
computer.

99
00:07:48,200 --> 00:07:48,860
Okay.

100
00:07:49,940 --> 00:07:53,180
So that's it about the virtual environment.

