DEV Community

Cover image for Why you should use environment managers to manage multiple versions?
Furkan Kalkan
Furkan Kalkan

Posted on

Why you should use environment managers to manage multiple versions?

Different projects has different needs. Different versions of libraries, different versions of SDKs, even different versions of compilers/interpreters... But installing and managing multiple versions of them is huge pain.

How should install that:

Compiling from source ??

Official repositories (you're lucky) ??

Adding some questionable (!) PPAs ??

Homebrew, nuget, ... ??

Congratulations, your computer has turned into the Amazon rainforest over the years, complete with its own delicate ecosystem.

Compiling from source code

It's quite popular method for installing software in Unix and Linux. But properly removing or upgrading source-compiled software is usually hard. There is a high chance that after a long time you will not remember where and how you installed it. Another issue is handling symlinks and dependencies conflicts.

So, don't do it yourself :)

Using official repositories

Using own repositories of distro or official repositories/packages is better solution. It handles removing, upgrading, symlinks and dependencies conflicts for you. Sometimes they permit installing different versions of compilers/interpreters simultaneously.

Unfortunately, my experiences was not shiny with this method. Removing packages in Debian package system may gone bad in some cases, especially when they're part of meta-packages (don't know about RPM, I'm not use it).

Another issue is managing the versions. In modern Linux distros, lot of application (including some of system applications) written in Python. They use system Python by default. Installing multiple versions of Python may break them. Installing multiple versions of NodeJS, Golang or Java may break your installed applications, too.

Using PPAs or 3rd party package managers

They have similar advantages and disadvantages with using official repositories. In additions to them using 3rd party PPAs or package managers like Homebrew or Nuget may risky due supply-chain attacks. You don't simply trust random guy's PPA blindly, promoted in blog post or forum post. Don't put risk you and your company.

If your project needed very specific version, you may not find any repository or package for that. In this situation, you should package it or compile it yourself.

Using environment managers

We actively use environment managers pyenv, goenv and nvm for managing multiple versions of Python, Golang and NodeJS at Mantis. These provide us with an easily manageable, robust development environments.

Using environment managers has several advantages over above methods:

  • Less chance of breaking system
  • Easy removal of unneeded version
  • Versions usable in both system-wide or project wide
  • Can install, remove and manage all versions in one place
  • Predictable installation path

Caveats of using environment managers:

  • Versions installed with environment managers still interference with system versions and break applications
  • You may need install required dependencies manually before installing versions
  • In rare conditions environment managers can broken and solving this may need long debugging sessions or re-installing environment manager itself and all installed versions

Top comments (0)