As I set up my dev environment for my master's research, I want to get in front of Python package dependency conflict nightmares. I have pretty basic requirements at the moment: I want to be able to easily switch Python versions and create virtual environments. That's it.

I've been digging through a number of posts on the topic and it looks like, for my needs, pyenv with the pyenv-virtualenv plugin is the way to go. It's a straightforward solution and does what I need it to do.

I am also considering manually installing Python versions, manually switching between them, and then using the built-in venv module to create the virtual environments. However, this is guaranteed to lead to headaches; I know with this process I'm bound to break something at some point - did you notice how I used the word manually twice in the first sentence of this paragraph?

Another option is to use pyenv to manage the Python versions and then use venv to manage the virtual environments. There is really no need to use two tools though, it's unnecessary complication. The pyenv-virtualenv plugin will make life easier and will ultimately use venv under the hood (as I don't have virtualenv or conda installed).

Of course, there are many other tools out there and, I'll admit, I was getting a bit confused between all the options. Here's my understanding of some of the tools I read about:

  • pyenv is a simple Python version manager that does not rely on Python itself.
  • pyenv-virtualenv is a plugin for pyenv used to create virtual environments. It uses venv, virtualenv, or conda under the hood to create the virtual environments depending on your setup.
  • pyenv-virtualenvwrapper is a plugin for pyenv used to create virtual environments with virtualenvwrapper.
  • venv is a module in the standard library (as of Python 3.3) used to create virtual environments.
  • virtualenv is a Python library used to create virtual environments. It offers more features than venv.
  • virtualenvwrapper is a set of extensions for virtualenv.
  • pyvenv is deprecated (in favour of venv). Don't worry about it.
  • conda is a command line tool for package and environment management. It's popular in the Python community but is language agnostic.
  • miniconda is a distribution that includes conda, Python, and some useful Python packages. It's a lightweight version of anaconda.
  • anaconda is a distribution that includes conda, Python, and a heck of a lot more Python packages (mostly data science related) than miniconda.
  • poetry is a tool for dependency management and packaging in Python. It automatically creates and manages virtual environments.
  • asdf is a version manager that can be used for a wide range of languages.

Your situation might be different than mine, and you might go a different direction. Though if all you need is a simple, no-fuss setup, it seems pyenv is the answer.