Managing Python environments has always been tricky, but a couple of great tools have come along in the last decade. If you hang around enough programmers you’ll hear about Conda (which we love) and virtual environments or VENV. Virtual environments are another great way to encapsulate your Python setup for reproducibility, deployment to production, or simply for archival. In this week’s MetPy Monday John – via our friends at Unidata provides a quick tutorial on how to use venv and how it stacks up to Conda. Each has its own advantages and disadvantages as we’ll see.

Virtual Environments Vs. Conda

Virtual Environments

  • Part of Python
  • Creates lightweight environments on top of the base python install
  • Environment lives with project (local)

Conda

  • Third party tool that manages not just packages, but entire environments
  • Language agnostic
  • Centralized environment management
  • Can manage multiple pythons, not limited to building on top of base
  • Conda forge and other channels!

What’s more common?

In data science/science in general I think conda is a better tool

  • Takes care of worrying about multiple python versions
  • Tighter encapsulation at the expense of storage

In software dev venv is still dominant

  • Smaller
  • Local
  • Often running on system python

Personally I think running on system Python is risky and I use conda even in production. Especially as scientists I don’t think that you can beat conda for convenience and reliability. You should know enough about venv to utilize it should it come up though!

If you want to know more about Conda, checkout these other posts and videos on setting up conda, creating conda environment files, and the Windows Miniconda Setup Guide! Still need more help? Contact us today to get a quick and easy quote on how our team can help your project move faster than you thought possible!

 

John Leeman
Follow me