Need of Virtual Environments in the Python
Debugging and resolving the issues while installing the libraries for Building the AI Model

I was building the model in Machine Learning and I got couple of errors while installing the libraries. I debugged and resolved with resources as explained below.
Issue 1: compatibility issue while installing library
I was using the Base environment and while installing the tensorflow library I got the conflicting of the versions of lib/files.
- When I installed the tensorflow, it brought a newer version of protobuf (7.34.1) which broke Streamlit's compatibility. See below screenshot :-
So decided to create the virtual environment to avoid the conflicts .
Since then, I am following the best practices to create and use the separate virtual environment (venv)for every new project.
Steps to create venv on Mac Terminal:-
(base) % conda create --name myenv
(base) % conda env list (
base) % conda activate myenv1
(myenv1) % pip3 install ipykernel
(myenv) % python3 -m ipykernel install --user --name myenv --display-name "MyenvKernel"
- From Jupyter select the MyenvKernel and install the lib peacefully and with no conflict and no compatibility issue:
- Install the library
Issue2 : Install the scikit-learn library was throwing the syntax error
The syntax was correct.
Also tried with !pip install scikit-learn but it was showing the same error. There I tried to install it from the backend on terminal.
Activate the virtual environment:
% conda env list% conda activate myenv1% pip3 install scikit-learn
And the scikit-learn library was installed successfully!
Thank you for reading! ๐
If you found this blog helpful, please like โค๏ธ and Share ๐ it.
Feel free to drop your questions or feedback in the comments below. ๐ฌ

