conda VS pip

I decided to write this post, as I myself when for the first time tried to use conda (the package manager for Anaconda Python distribution, the first question was in what ways conda is better then pip, and so why one should think of preferring condo over the de-facto pip. Here I have put a comprehensive post about ‘getting started with conda’ i.e. what extra condo can offer.

A short comparison

  • Can only be used for Python packages.
  • The supported package manger by the Python foundation, hence widely used.
  • Handles library dependencies even outside Python i.e. packages for C libraries, or R packages, or really anything.
  • Supports virtual environment out of the box.
  • Developed to be used with Anaconda Python distribution, though can be used with the standard Python distribution – but highly not recommended.

Virtual environment with conda

Out of the box conda provides the virtual environment creation and management functionality (with normal distribution you have to install virtualenv). For example, you need to test a package with different Python version, let say Python 2.7

Create venv

conda create -n <venv> python=<python-version>
conda venv

Activate venv

source activate <venv>
activate venv

Deactivate venv

source deactivate <venv>
deactivate venv

List the environments

At the core, same as virtualenv Anaconda’s environments are mere directories. To list all the environments
conda info -e
venv list

List packages of a virtualenv

Can list the installed packages of an inactive environment
conda list -n <venv>
venv packages

Leave a Reply

Your email address will not be published. Required fields are marked *