News for hackers. Stuff that matters.
Re:A non-magical introduction to pip and virtualenv for Pyth... by JulianWasTaken on Thursday April 18, 2013 @10:06AM (#5570635)
> Python actually has another, more primitive, package manager called easy_install, which is installed automatically when you install Python itself.

It's actually not, it's part of setuptools/distribute, though some Python distributions (actually just brew that I know of) include distribute alongside Python.

Also, while the quick skim of the rest of this looks mostly good, there's some unnecessary advice which complicates things.

virtualenv is not necessary if the crux of the advice is "don't install packages globally" (which is fantastic advice, second probably to the more important advice "don't install stuff with sudo").

What beginners (and even some more experienced programmers) need to learn about is --user. You install packages with `pip install --user thing`, and they become per-user installed (be sure to add `~/.local/bin` to your `$PATH`). This is enough to not require sudo and for 99% of cases is actually sufficient.

There is a rare case where you actually have packages that depend on different, conflicting versions of another dependency. This has happened ~1 time to me.

Don't get me wrong, I like virtualenv for other reasons (relating to workflow and maintenance), but if we're teaching people about packaging, there's no particularly great reason to dedicate most of a tutorial on it.

Re:A non-magical introduction to pip and virtualenv for Pyth... by euroclydon on Thursday April 18, 2013 @10:34AM (#5570799)
> What beginners (and even some more experienced programmers) need to learn about is --user. You install packages with `pip install --user thing`, and they become per-user installed (be sure to add `~/.local/bin` to your `$PATH`). This is enough to not require sudo and for 99% of cases is actually sufficient.

Is this relevant advice for packages needed by your web server account, e.g. www-data?

Re:A non-magical introduction to pip and virtualenv for Pyth... by j4mie on Thursday April 18, 2013 @10:15AM (#5570684)
Thanks, this is great advice. easy_install comes preinstalled on a Mac, which is where the confusion arose. Will update the article when I get a chance.
Re:A non-magical introduction to pip and virtualenv for Pyth... by mixmastamyk on Thursday April 18, 2013 @12:58PM (#5571683)
As I install/develop my python apps into VMs with a fixed python version, I rarely use virtualenv... don't see the need for the extra complexity.

I've eagerly read pieces like this but haven't yet found out the reason this solution is problematic or that I'm doing it wrong. Just that no one else seems to be recommending it. Anyone have an idea?

Btw, one of the best discussions of the various deployment options I've seen is from the Pylons book: http://pylonsbook.com/en/1.1/deployment.html#choosing-or-set...

One other thing I'm not happy about regarding packaging best-practices (and PyPi) is that security updates are not able to be automated leading to vulnerable packages.

Re:A non-magical introduction to pip and virtualenv for Pyth... by tomku on Thursday April 18, 2013 @03:13PM (#5572448)
Virtualenv is about managing multiple/conflicting versions of libraries, not different versions of Python itself. You're accomplishing the same thing by using a different VM for each app, just with higher overhead and isolation of things other than Python as well.
Re:A non-magical introduction to pip and virtualenv for Pyth... by pstuart on Thursday April 18, 2013 @11:03AM (#5570986)
I recently learned the lesson about global packages. I thought it would be so nice to have all packages readily on hand, but now startup time is about 15 seconds of crawling the filesystem looking for files (over NFS).

Go is looking more attractive day by day.....

Re:A non-magical introduction to pip and virtualenv for Pyth... by andybak on Thursday April 18, 2013 @05:47PM (#5573349)
"It hurts"

"Well, stop doing it then..."

Jests aside - Go is appealing for many reasons but your self-inflicted pain is not necessarily one of them. ;-)

Re:A non-magical introduction to pip and virtualenv for Pyth... by pirer on Thursday April 18, 2013 @01:35PM (#5571911)
How would you someone who has used pip with sudo undo the mess that has created in his computer?

Uninstall everything and start over?

Re:A non-magical introduction to pip and virtualenv for Pyth... by dagw on Thursday April 18, 2013 @02:32PM (#5572221)
Just start using virtualenv for everything. By default virtualenv starts you with a clean python setup each time and nothing you've installed globally with pip will affect you.
Re:A non-magical introduction to pip and virtualenv for Pyth... by jyap on Thursday April 18, 2013 @02:31PM (#5572213)
Yeah. You can use 'pip uninstall'.
Re:A non-magical introduction to pip and virtualenv for Pyth... by pirer on Thursday April 18, 2013 @11:44PM (#5574664)
I ended doing the following for those who are in the same situation:

    pip freeze > pip_list_with_sudo.txt
    sudo pip uninstall -r pip_list_with_sudo.txt
So now let's start doing things right with virtualenv...