r/Python • • Dec 06 '13

Why I hate virtualenv and pip

http://pythonrants.wordpress.com/2013/12/06/why-i-hate-virtualenv-and-pip/
2 Upvotes

11 comments sorted by

7

u/Lukasa Hyper, Requests, Twisted Dec 06 '13

I find this article totally perplexing. Some of the criticisms are valid: yes, virtualenv doesn't provide perfect isolation. Fine. Agreed.

But the author doesn't like pip because it contains more functionality than easy_install? That's a bizarre complaint. easy_install contains exactly one bit of function: it can install something. I like my package managers to be able to do more than that: uninstall something, for instance. God forbid our tools have more useful functions.

10

u/ionelmc .ro Dec 06 '13

Would be way more useful to show how you would actually use LXC instead of just subjectively bashing virtualenv and pip ...

5

u/kevinastone Dec 06 '13

This is so over the top to be useless. Yes, virtualenv helps with isolation, but it's not perfect. There's a leaky abstraction in python package management with development libraries and other dependencies. It's not an anti-pattern, it helps construct the necessary environment for a deployed application. Sure, other virtualization options like hyper visors and LXC might mitigate some of the benefits of virtualenvs, but don't discount the entire pip/virtualenv/requirements chain. A big problem with containers and other modularization approaches is how you build one from scratch. A recipe like requirements.txt is an important component along with devops tools like chef or puppet.

2

u/forsaken Dec 06 '13

Note that pip supports wheels, which are a better binary package format.

http://www.pip-installer.org/en/latest/cookbook.html#building-and-installing-wheels

2

u/Evanescent_contrail Dec 06 '13

I agree with most of your points, but so what. I am on Windows, don't have drive space for the virtual machine option.

WHAT DO YOU PROPOSE AS AN ALTERNATIVE?

This type of post with a clear alternative is constructive. Without it, it's just whining.

-1

u/indieinvader Dec 06 '13

Disk space is cheap, get a bigger HD

1

u/[deleted] Dec 06 '13 edited Apr 22 '16

1

u/hairlesscaveman Dec 09 '13

I wonder what this guy's take on zc.buildout is...

0

u/Dirty_Rapscallion Dec 06 '13

Not really a fan of his opinion on pip. I really wish Python had a much more standardized package manager. It's such an amazing language but it has the crappiest command line tools.

1

u/Evanescent_contrail Dec 06 '13

You have more or less characterized Python. It is so amazing, but has some really clangers that make you facepalm.

0

u/[deleted] Dec 06 '13

[deleted]

2

u/miketheanimal Dec 06 '13

I worked for a while on a system where the target servers where running Debian, and the devs were developing on Macs. Virtualenv seemed to be used to make the Python environment on the servers look like that on the Macs.

This really gave me the willies. Sure, use virtualenv to make your development environment look like the target servers, but not the other way round (though, for anything other than a toy system I'd want the development and the target environments to be the same).

I've heard the arguments like "virtualenv protects you when the sysadmins decide to upgrade". Bollox. If the sysadmins are upgrading without the developers knowing about it, then your organisation is seriously fsck'd. And "virtualenv saves you when the system doesn't have the package you need and you can't install it". Again, bollox. If you need such a package, the sysadmins should install it.

Two packaging systems is a lurking nasty that can bite you in subtle ways.