Why do we need a virtual or separate environment in python?
Being an open-source platform, python is widely popular not only among developers but also among the scientific community, who have built many cool packages to be used in their respective fields. But this flexibility also creates problems, as the packages are dependent on the version of python on which they are built. So, to work with different packages dependent on different python versions can create a clash if only one version of python or associated packages are used.Virtual environment solves this clash by creating a separate environment within python. In this environment, we can use our desired package of desired versions, and it won't change the settings of the root environment. So, as long as we are in a virtual environment, we can experiment with various packages without altering the root environment settings.
It is better to install TensorFlow in a separate environment in anaconda
Tensorflow is a useful package for analyzing data with neural network. But proper operation or installation of tensorflow is highly dependent on the version of python, pip etc. Again, anaconda pip install often fails to fetch the proper tensor flow version. So, a customized environment containing necessary packages can be helpful, specially if the windows version or the python version is not updated.
Tensorflow environment types
Tensorflow comes with two versions for windows, one is cpu dependent,and another is gpu dependent. If you have a graphics card and required specifications (you can find them in Tensorflow website), you can work with gpu based tensorflow. Or, if you don't have the required specifications like me, you should go for the cpu based TensorFlow. Here I will explain the later process.
Working with CPU based tensorflow with a virtual environment:
Step 1: Create a virtual environment
Go to anaconda prompt.
Type conda create --environment name
As I want to work with tensorflow here, I can install it while creating it like below
For example, I have created an environment named tf like below:
Comments
Post a Comment