6 ms·
I understand what Zed's saying here - particularly as I came to programming from a sys admin background. Just like Perl before it, Python (and to some extent,
by nailer 16y ago
I understand what Zed's saying here - particularly as I came to programming from a sys admin background.
Just like Perl before it, Python (and to some extent, Ruby if you use Puppet) are part of the OS (Linux OS or OS X that is).
Shit can and will break if you mess with your OS.
You never got this with PHP because people didn't use it in their OSs.
But there's a simple solution: not only does the Ministry of Packaging want you to use virtualenv, your OS maker does too.
The faster pip and virtualenv become standard the better.
- dagw 16y agoShit can and will break if you mess with your OS. Updating a program I use should never constitute "messing" with my OS, it should constitute "using". Why should I as an OS user have to constantly worry about upsetting the OS maker? Why should I have to jump through obscure hoops just to install some software without breaking my OS? Wouldn't a better solution be for the OS makers to wall off their magic python behind some wall where I cannot see, touch nor use it, and let me install whatever python I want without fear.
- nailer 16y agoFirstly: no hoops are required to install any version of python or any required Python module your app needs: * Just use pip and virtualenv. * Your OS remains intact, and you get better deployment for free! Replacing a component of your OS (Python 2.x) with another one (python 2.x +1 ) affects: * The OS installer (Anaconda on RHEL, Ubuntu'sequivalent) * The packaging system (yum) * Many GNOME system admin apps. * The config management tools (puppet sits on ruby)
- dagw 16y agoMy point is that /usr/bin/python probably shouldn't be a core OS component. /usr/bin/python should be whatever I want it to be. The core OS-component should be something like /sys/bin/centos-python which I will never directly use, touch or even necessarily know about. The bottom line I guess is that mixing core OS components and user installed software in the same directory structure with no way of differentiating them is simply bad design.
- munchhausen 16y ago> /usr/bin/python should be whatever I want it to be. Why /usr/bin/python? /usr/bin/ has been for ages the "system" area - why would you want to suddenly usurp it for yourself? /usr/local/bin/python will on most Linux systems be executed ahead of /usr/bin/python, because /usr/local/bin/ usually precedes /usr/bin/ on the $PATH. Thus you can have your cake and eat it too. > The bottom line I guess is that mixing core OS components and user installed software in the same directory structure with no way of differentiating them is simply bad design. Linux distro makers agree with you - if you do not customize environment variables, user-installed software goes into /usr/local/ and the OS package-management (which can be considered "system" I guess) puts executables into /usr/{bin,sbin}. This tends to work well as long as you keep in mind that everything outside of /usr/local/ (or your customized installation path) may at any update change subject to the will of the "system". I think this is a reasonable setup - it gives the OS vendor the ability to update the system, while giving you free reign in your /usr/local/ playground.
- dagw 16y agoOS package-management (which can be considered "system" I guess) This is where I and the distro makers disagree. When I use synaptic to install the latest version of foobar, that is not in anyway "system" and foobar should not be dumped in the same directory as core system binaries. There should be a directory that contains everything core to the OS (like python 2.4), which was only updated by the OS updater routine (which should be different from the update all the software I've installed routine). Then there should be a directory which contains everything I've chosen to install (like python 2.7) which is where everything that I install via whatever is the normal way to install things on that OS ends up. I don't care too much about what these directories are called, but having them be the same, as it is now, is not an ideal solution in my mind.
- lmz 16y agoIt seems like you want BSD ports, or some alternate package repository that has /usr/local as the root. The packages from the OS repository are the OS.
- gaius 16y agoIn the ancient days, stuff the OS relied on was in /usr/sbin and stuff that was "yours" was in /usr/local/bin (or /opt) and stuff that no-one was quite sure whose it was was in /usr/bin. And lo, peace and harmony did reign upon the face of Unix. And the sysadmin did lie down with the developer, and it was good. Who even knows how it works these days?
- nailer 16y agoStuff that belongs to the OS (but runnable by all users) is in /usr/bin. That's FHS. Stuff that's yours is wherever dir you specified when you ran: export WORKON_HOME=$HOME/.virtualenvs Seriously. Use virtualenv (and virtualenvwrapper). http://www.doughellmann.com/projects/virtualenvwrapper/ http://www.doughellmann.com/projects/virtualenvwrapper/
- dagw 16y agoWhat about stuff that belongs to me (the sysadmin) but runnable by all users? /usr/local/bin? /opt/bin? /my/homemade/solution/bin? There is a bunch of stuff that doesn't (shouldn't) belong to the OS, but still be runnable by all users without all of them needing a copy in their $HOME directory.
- munchhausen 16y agoYou answered your own question - /usr/local/bin. I don't know about MacOSX but on Linux, this is the solution to your problem - "stuff that belongs to me (the sysadmin) but runnable by all users".
- gaius 16y agoWell exactly. People who never learnt the old-skool ways always reinvent the wheel in an over-complex way. /usr/local/bin is stuff for the users, but which the sysadmin installs. So /usr/bin/python for the OS and /usr/local/bin/python for your users.
- nailer 16y ago> What about stuff that belongs to me (the sysadmin) but runnable by all users? If you're writing quick ad-hoc scripts and don't have time to package, /usr/local/bin. Per above, Python is used by your OS. It's installed by default, and not uninstallable, because the OS needs it. We can't and probably don't want to change that, so we'll need to live with it. Use virtualenv. if you need to to, install a quick Python 2.6 package that slots alongside your OS package rather than removing it - using RHEL 5 as an example, you'd install 'python26' alongside your existing 'python' package.
- deleted 16y ago[deleted]
- cdavid 16y agoI am curious: how do you think virtualenv and pip would solve the issue of antiquated python ? The only thing that virtualenv does is to install packages in some temporary location, that you can throw away later without impacting anything outside python. Virtualenv does nothing to solve those issues. I am actually wondering whether it does not even aggravates them because people think those tools magically solve backward compatibility issue (which is the underlying issue here). If something as trivial as virtualenv would solve those issues, people distributing and packaging stuff would have done something similar for ages.
- JeffJenkins 16y agoIt creates an entirely independent python installation, including executable. Of course, you need to install that executable somewhere before you can create an independent copy of it, but there's a decent chance you'll be able to do that even as a normal user in your home directory.
- cookiecaper 16y agoCreate your virtualenv with --no-site-packages. Of course you have to use a different Python to run virtualenv, it's not that hard to build but if you have something against that it shouldn't be too hard to find a newer binary out there somewhere. So, what's the complaint here? You have to obtain a new version of Python if you want to use a newer version of Python than what comes with the system? That's pretty self-evident imo. Distro makers hate statically-linked stuff as a general rule and virtualenv is basically a statically-linked Python application. How many distros do you know that send out games statically linked to SDL or whatever? Most would rather have the application break. The same is true for Python; the distro has a philosophical opposition to static linking and virtualenvs are essentially statically-linked Python apps.
- cdavid 16y agoIf you build yourself a new python, what's the point of virtualenv ? Compiling python is of course possible, although quite a chore if all you want is to configure some software. Concerning the need to obtain a new python if you want to use a newer python: yes, it is more or less evident, but that's Zed Shaw's point, not mine. Where he has a point IMO is about the brokenness of the installed python - many distributions make too many changes w.r.t. upstream without understanding the consequences. To distro's defend, the python packaging solutions are so poorly thought out that python itself is not helping the situation.
- deleted 16y ago[deleted]
- cookiecaper 16y agoStrong agree, virtualenv is a pre-requisite. We are running 2.6 in a venv on CentOS and it works fine and doesn't interfere with anything from the distro that relies on system Python. This is really the better approach anyway because if you get another project that requires conflicting library versions with your last project, it's a simple thing. It also makes it easy to take your project across servers, just make another venv (usually pretty fast to get going) or use the portability flags and take the venv with you. I don't see much point in trying to make everything play nicely with system Python when you're doing real work, but it would be nice if the distros would start keeping normal system Python up and distribute virtualenvs for their stupid broken old crap that they won't update.
- zedshaw 16y agopip and virtualenv don't work for a program like m2sh that has to be in the PATH all the time so you can run it from anywhere. Another thing is that non-python programmers wouldn't even bother to use virtualenv. Really only Python programmers would.