[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Broken pip

On 08/29/2018 09:05 PM, Michael F. Stemper wrote:

> I can certainly see a use case for user-specific versions of
> modules, and even user-specific presence of modules. For
> instance, at school, different researchers might need to have
> specific modules for their work. Possibly one person is doing
> something with a 3PP built on a specific version of a module
> that would be incompatible with a later version.
> However, why would I want this on my home servers? It seems to
> me that having different versions for different people on my
> home network would rapidly become a maintenance problem.
> I'm the only one who writes code here. If I was to tell somebody,
> "Hey, look at what I wrote," it'd be nice if their environment
> had all of the same stuff as mine.
I'd stick with distribution packages as far as possible if I were you. 
The nice thing about installing custom packages from PyPI in ~/.local 
only is that while I /might/ mess up my own environment, I'm not risking 
the functionality of system components/daemons/etc. running as root. But 
I'm no sysadmin.
> (I realize that you're the messenger, not the designer. It seems
> as if my beef is probably with Canonical or even Debian.)
Oh no, the problem exists on every Linux distro, and I assume Ruby, Perl 
and R users have the same kinds of problems. Heck, I've had similar 
problems with LaTeX/TeXlive...
>> Also, PLEASE use Python 3. Still using Python 2 today is like still
>> using Windows XP in early 2013.
> I'm using the default version for the current release of my
> OS (Ubuntu 16.04 LTS):
> user at host$ ls -lrtd python python?
> lrwxrwxrwx 1 root root 9 Nov 22  2016 python3 -> python3.5
> lrwxrwxrwx 1 root root 9 Nov 23  2017 python2 -> python2.7
> lrwxrwxrwx 1 root root 9 Nov 23  2017 python -> python2.7
> user at host$
> My understanding is that when I get around to upgrading to 18.04 LTS,
> python3 will be the default.
> Since I don't hard-code a version in any of my programs, but simply
> write "#!/usr/bin/python", all of my programs will automatically change
> to the new version then.

No, actually.

As I understand it, Ubuntu 18.04 LTS uses python2 a lot less, and I 
don't think it's included in the default install. However, it's still in 
main, the name of the package is still "python", and it's still required 
by some common software... (including the recommended personal backup 
tool, duplicity :-/)

In any case, as per PEP 394, /usr/bin/python continues to point to 
Python 2.7 (if installed), it it will likely remain that way for the 
foreseeable future. (including, presumably, Ubuntu 20.04 LTS)

PEP 394: https://www.python.org/dev/peps/pep-0394/
> If I was to change all of my programs to say "#!/usr/bin/python3", I'd
> have a slight head-start. However, then I'd need to change them all
> again when python 4 came out. And python 5.
> I prefer to maintain version independence, or at least to avoid
> implementing version dependence.

You should know that there were some (deliberate) incompatible changes 
(vastly for the better) in Python 3.0 (almost ten years ago). It's 
normally easy to port your code, and not too hard to write code that 
runs on both Python 2 and Python 3 if required, but in any case you have 
to do this consciously, and code written for Python 2 will not in 
general work unmodified on Python 3.

At least for new scripts, just use #!/usr/bin/python3 or #!/usr/bin/env 

As for the "Python 4 problem" ? at the moment nobody knows whether there 
will even /be/ a Python 4. Maybe Python 4.0 will be the version after 
3.9 (doubtful IMHO). Maybe it'll come later. Maybe it never will. It 
certainly won't include any major breaking changes, and considering PEP 
394, I could imagine that when the time comes we will see 
/usr/bin/python3 pointing to /usr/bin/python4.0 (as silly as that sounds).

-- Thomas