virtualenv

Many times it so happens that you need to work on multiple projects simultaneously. Or your curious mind wants to try out the latest version of some library without affecting your well-set dev environment. What do you do in such a case? Replicating source code in a different location could be one way. But how would you handle system level dependencies and versions? Let’s see how virtualenv can help us.

What is virtualenv?

VirtualEnv

It is a virtual environment which is self-contained in terms of libraries and dependencies. This term comes from Python world and it allows you to have different versions of Python or any other modules located at a specific location in your working directory. These local versions do not interfere with system-wide settings or other virtual environments set up by the user.

One needs to install virtualenv on the system and then she can create as many virtual environments as required. Each such virtual environment would be completely independent of other environments. The user needs to “activate” particular environment before using that environment.

So are there any alternatives for other languages/frameworks?

Yes. Perl has similar framework and can be downloaded as CPAN module. [from here]. Bunch of alternatives available for node.js and can be checked at this link.

How is virtualenv different from Vagrant?

Good Question 🙂 It is easy to get confused between Vagrant and virtualenv (or it’s equivalents). Vagrant primarily abstracts the complete machine. It allows you to specify OS, packages to be installed. However, it will still have problems running multiple versions of your scripting language such as Python and that is where virtual environment is useful. You can find a nice explanation of comparison between virtualenv, vagrant and docker (container) here.

Related Links

Related Keywords

Vagrant, Container, Docker, Virtual Machine, Python, pyenv

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.