r/Python • • Apr 30 '18

xkcd: Python Environment

Post image
2.4k Upvotes

388 comments sorted by

View all comments

197

u/the_hoser Apr 30 '18

It's really easy to avoid this problem if you treat your python environments as disposable artifacts of your projects.

91

u/earthboundkid Apr 30 '18

Except that means it's a huge PITA to install Python command line tools.

At this point, when I see a command line tool looks cool but is written in Python it makes me really sad because there's not going to be a good way to get it installed without first going through a disproportionate amount of work to give it a working environment.

35

u/[deleted] Apr 30 '18

If you're on linux you can usually use your distribution package manager, otherwise I reccomend https://github.com/mitsuhiko/pipsi

58

u/blahehblah Apr 30 '18

All you're doing is adding an extra box and set of arrows to that chart

2

u/gimboland May 02 '18

It's still a solution. "Use virtualenv" is some of the boxes/arrows on the chart, but it's still the right solution for that problem. For command-line tools, pipsi is a good solution.

67

u/mardiros Apr 30 '18

You are just saying that the mess is incomplete...

13

u/jjolla888 Apr 30 '18

i'm still trying to find where pip3 is on that map

3

u/AstroPhysician May 01 '18

Use virtualenvs you savage

4

u/jjolla888 May 01 '18

Do we need to add this to OP's diagram ?

→ More replies (1)

19

u/no_condoments May 01 '18

Situation: There are 14 competing python installation standards.

/u/Rerecursing : 14?! Ridiculous! We need to develop one universal standard that covers everyone's use cases.

Soon: Situation: There are 15 competing standards.

https://xkcd.com/927/

2

u/earthboundkid Apr 30 '18

Nice. I had been using pex, but it tends not to work if the package has any extra requirements beyond pure Python.

→ More replies (4)

17

u/kenfar Apr 30 '18

Hmm, I use CLIs all the time without any headaches at all - not sure what the issue is here.

Create a virtualenv, pip install into it, activate your environment and run your commands. If you want to cron them up, just run command via that virtualenv's python. If you want to run a lot of tools and not switch virtualenvs that often, create a group one for related (or all) projects.

Admittedly, it's easiest if you're using linux & pip consistently rather than macos, homebrew and conda. But it's not that much worse.

6

u/[deleted] Apr 30 '18

Having to use two version of python is a pain.

7

u/liquidpele Apr 30 '18

That’s true of any language...

→ More replies (3)

4

u/twigboy Apr 30 '18 edited Dec 09 '23

In publishing and graphic design, Lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document or a typeface without relying on meaningful content. Lorem ipsum may be used as a placeholder before final copy is available. Wikipediacln61bof3yw0000000000000000000000000000000000000000000000000000000000000

→ More replies (4)
→ More replies (2)

3

u/metabun Apr 30 '18

This is how I feel about tools in perl, go or js. I guess it all just depends on how familiar you are with the environment and package ecosystem.

3

u/tetroxid Apr 30 '18

Not on Linux

→ More replies (25)

39

u/qubedView Apr 30 '18

Or, like all things, it can be fixed with docker containers. Or rather, like all things, your problem can be shifted to a different one.

0

u/[deleted] Apr 30 '18

[deleted]

→ More replies (5)

6

u/the_hoser Apr 30 '18

We never get to do things without problems. We only have the option of choosing the problems we're comfortable living with.

19

u/Deto Apr 30 '18

The best way to avoid this problem, IMO, is to just learn these two things:

  1. How does the PATH variable work in UNIX?

  2. How does the Python interpreter know where to look for packages?

If you understand these two things, you can have multiple versions of Python all over your system and still understand what's going on.

3

u/rohit275 Apr 30 '18

I'm a noob, so I'm pretty sure i don't understand those two things. Do you think you could lend some insight?

→ More replies (6)
→ More replies (1)

10

u/not_perfect_yet Apr 30 '18

It's really easy to avoid multiply this problem if you treat your python environments as disposable artifacts of your projects.

4

u/the_hoser Apr 30 '18

Only if you're not lazy enough to automate the boring parts.

3

u/marcosdumay Apr 30 '18

And don't use sudo.

So the point stands.

→ More replies (34)