Motivation

Until now, I was a happy user of a combination of Anaconda/Miniconda and Python’s virtualenv. Until lately I learned that using Conda’s repositories is not free for larger companies, hence I cannot use it any more. Since I want to have a similar setup at home and actually did not like conda that much anyways, this is a good impulse to change my setup and switch to something else.

Lately, I did not use Conda anyways for most things: For most Python versions, I had an installation in Conda, and then I actually just worked in local environments generated from these base environments using venv.

Available alternatives

There are quite a lot of alternatives, but it mostly comes down to Conda and derivatives, venv (which does not fit my use case) and potential derivatives and some more complex stuff. I opted for pyenv, as this was simple enough for me.

Installation

Installation is actually quite simple on a developer system. The most required tool is Git, which should be natively avaliable on any machine anyways in my opinion. Then you just run curl -fsSL https://pyenv.run | bash. Note that I am not going into the curl | bash discussion here.

After that, I had to add Pyenv to my shell. Since I am using Fish, this was done in two steps:

  • Run set -Ux PYENV_ROOT $HOME/.pyenv; fish_add_path $PYENV_ROOT/bin. This adds the pyenv binary path to the fish. Also, this configuration is stored in a fish config file, so I only have to do that once.
  • Actually activate pyenv: Add pyenv init - fish | source to ~/.config/fish/config.fish.
  • Finally, since Pyenv downloads sources and builds them locally, I had to install some further dependencies. Taken from their docs, for Debian: sudo apt install make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev curl git libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

And that’s it!

Basic Commands & Usage

  • Let’s start with installing some Python version: pyenv install 3.13, which installs the latest patch version of 3.13 (so, 3.13.2 at the time of writing).
  • Set 3.13 as the default Python version to be used globally: pyenv global 3.13. From now on, if you type python in the terminal, it will use Pyenv’s 3.13 installation.
  • Temporary set another version: First install it, then run pyenv shell 3.12. Now for this shell, 3.12 will be used.
  • From here on, I can create virtual environments like I had done beforehand, and everything works as expected!

What’s still to do

I have got a quite large installation of Jupyter Notebook, including a set of custom kernels (Sagemath, R, Octave and some others). I am not yet sure how to replace these. This will probably be subject of some future posts.

Conclusion

If I would have known how simple the transfer is, I would have migrated away from Conda a long time ago. I like the setup, and am thrilled to play around with it in the future.