Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Conda replace the need for virtualenv?

I recently discovered Conda after I was having trouble installing SciPy, specifically on a Heroku app that I am developing.

With Conda you create environments, very similar to what virtualenv does. My questions are:

  1. If I use Conda will it replace the need for virtualenv? If not, how do I use the two together? Do I install virtualenv in Conda, or Conda in virtualenv?
  2. Do I still need to use pip? If so, will I still be able to install packages with pip in an isolated environment?
like image 233
Kritz Avatar asked Dec 21 '15 15:12

Kritz


People also ask

Is conda better than virtualenv?

conda is both a package and environment manager and is language agnostic . Whereas venv creates isolated environments for Python development only, conda can create isolated environments for any language (in theory).

Is a conda environment a virtual environment?

In other words, Conda makes it seamless to create virtual environments using different versions of Python. With Venv, we will need to use an additional tool to manage Python versions or install multiple Python versions before creating virtual environments.

Is virtualenv necessary?

VirtualEnv helps you create a Local Environment(not System wide) Specific to the Project you are working upon. Hence, As you start working on Multiple projects, your projects would have different Dependencies (e.g different Django versions) hence you would need a different virtual Environment for each Project.

Should I use conda or not?

It's fully recommended to use pip inside of conda. It's better to install using conda, but for any packages that don't have a conda build, it's perfectly acceptable to use pip.


2 Answers

  1. Conda replaces virtualenv. In my opinion it is better. It is not limited to Python but can be used for other languages too. In my experience it provides a much smoother experience, especially for scientific packages. The first time I got MayaVi properly installed on Mac was with conda.

  2. You can still use pip. In fact, conda installs pip in each new environment. It knows about pip-installed packages.

For example:

conda list 

lists all installed packages in your current environment. Conda-installed packages show up like this:

sphinx_rtd_theme          0.1.7                    py35_0    defaults 

and the ones installed via pip have the <pip> marker:

wxpython-common           3.0.0.0                   <pip> 
like image 198
Mike Müller Avatar answered Sep 27 '22 23:09

Mike Müller


Short answer is, you only need conda.

  1. Conda effectively combines the functionality of pip and virtualenv in a single package, so you do not need virtualenv if you are using conda.

  2. You would be surprised how many packages conda supports. If it is not enough, you can use pip under conda.

Here is a link to the conda page comparing conda, pip and virtualenv:

https://docs.conda.io/projects/conda/en/latest/commands.html#conda-vs-pip-vs-virtualenv-commands.

like image 33
Mad Physicist Avatar answered Sep 28 '22 00:09

Mad Physicist