user697911 user697911 - 3 days ago 9
Python Question

Once Anaconda is installed is there no need to install a virtual environment?

I am new to Python. Just installed Anaconda and everything works fine. also the documentation mentioned it is good to configure virtual environment.

Since Anaconda works like a virtual environment, I don't need to configure another virtual environment.

Right or wrong?

Answer

Wrong, but also right.

Even when using Anaconda, it is good to use virtual environments (conda env) for each project so that you avoid issues with conflicting dependencies between projects. For example, one project you are working on requires Python 2.7 + flask 0.9 (not Python 3 compatible), whereas another project requires Python 3.4 + flask 0.11. The easiest way to manage these different dependencies is via conda virtual environments.

Note that conda envs function in a similar way to standard virtual environments, but do have a few differences. You are right in that you don't need traditional Python virtual environments any more. You still need to set up a new environment for each project, but this now becomes a conda env.

An additional benefit to using virtual environments is that you can easily create a requirements file which only contains the packages required for that project:

conda env export > environment.yml

If you try to do this outside your virtual environment, then you will end up putting every package you've ever installed into your environment.yml file.

http://conda.pydata.org/docs/using/envs.html

Comments