user697911 user697911 - 1 year ago 89
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 Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download