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
- Part of Python
- Creates lightweight environments on top of the base python install
- Environment lives with project (local)
- 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
- 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!
- Spring Slider Earthquake Machine – Software Version 1.1 Released and Open Sourced! - February 14, 2023
- Sediment Provenance with Microscopes and Raman – Don’t Panic Podcast Episode 352 - December 23, 2022
- XArray Multidimensional Groupby – Quick Data Analysis in 1 line! - December 19, 2022