Why Virtual Environments important for Machine Learning Projects in Python?
Virtual environment is nothing but one sub environment inside of your physical system.
If you install all your project related dependencies on your system then it goes under system environment that we also call as Global environment.
Now, Just think about scenario where you are working on two machine learning / data science project.
Project X and Project Y
For project X you are using python 3.x version
Bu due to some project constraint you have to use python 2.7 version for your Project Y
Now,
how you can maintain these two python version?
How you can make sure right version getting used for respective project?
How you can manage is simple and efficient way?
The solution is Virtual Environment.
You can create separate virtual environment for each project according to their python version need.
Now let’s talk about second scenario,
You have project A and PRoject be both are using python 3.x and both needs Tensorflow API.
But project A needs Tensorflow 2.0 version
where as Project B needs Tensorflow 2.2 Version.
To handle this kind of scenario we can create separate virtual environment for each project and install required version of packages/API’s/Libraries as per project requirement.
Keeping the dependencies separate for each project in different virtual environment helps to work on multiple projects same time without any issues of library version conflicts.