Re: Safest way to set python3 as default for `python`

2018-07-19 Thread Brian May
Stuart Prescott  writes:

> There's a reasonable number of things in /usr/bin with "#!/usr/bin/env
> python" that would be unhappy with this configuration.

I don't think binaries in /usr/bin should be using "#!/usr/bin/env
python". These will also break with virtualenvs. Packaged programs in
Debian should be using /usr/bin/python*.

Having said that, I can confirm you are correct, this does appear to be
common.
-- 
Brian May 



Re: Safest way to set python3 as default for `python`

2018-07-18 Thread Stuart Prescott
Ben Finney wrote:
> To have a command with custom behaviour, the recommendation is the
> general one: put an executable file at ‘/usr/local/bin/python’ with
> whatever behaviour you want.

eeek, please don't! 

If a user created an incompatible /usr/local/bin/rm (didn't delete files, 
didn't exit 0), that would break a lot of tools and we'd tell the user not 
to do that. Fortunately, users don't tend to. /usr/local/bin/python is no 
different but for some reason users feel they can meddle with it.

Do not put locally versions of system tools like 'python' in root's PATH (or 
indeed in any user's PATH if the user expects to be able to run packaged 
tools). Doing so ends up potentially breaking packaged modules (they can 
find the wrong versions of dependencies in /usr/local since that is also in 
sys.path), and packaged applications (broken modules plus perhaps now 
running with the wrong version of the interpreter which is either 
incompatible or doesn't have the necessary modules installed). There's a 
reasonable number of things in /usr/bin with "#!/usr/bin/env python" that 
would be unhappy with this configuration.

We have lots of experience of this sort of breakage in #debian, where we see 
the this breaking maintainer scripts or packaged tools. As soon as we see a 
python backtrace with /usr/local in it, we know that is going to be the 
problem and expunging the local python installation from /usr/local is what 
is needed.

Putting python in other places such as /opt or ~/.local would be fine; even 
better still is to use one of the many virtualenv approaches so you're not 
even leaking that incompatible interpreter into a user's default 
environment.

(see also: please don't run pip as root)

cheers
Stuart

-- 
Stuart Prescotthttp://www.nanonanonano.net/   stu...@nanonanonano.net
Debian Developer   http://www.debian.org/ stu...@debian.org
GPG fingerprint90E2 D2C1 AD14 6A1B 7EBB 891D BBC1 7EBB 1396 F2F7



Re: Safest way to set python3 as default for `python`

2018-07-17 Thread Ben Finney
Bastian Venthur  writes:

> sorry if this question has been asked before. What is the currently
> recommended way to make `python` point to `python3`? I'd like to have
> it set on a system default level if possible.

At a system default level, in Debian, the command ‘python’ (if it is
installed) invokes the default Python 2 interpreter.

Based on existing discussions I am confident there will not be a
recommendation for a ‘python’ command to invoke anything except the
default Python 2 interpreter, until long after Debian ceases support for
Python 2 — and there is no current plan to drop Python 2 support in
Debian.

If you want a ‘python’ command at the system default level with
different behaviour from that today, that's going against
recommendations so I think you won't find a recommended way to have
different behaviour.

To have a command with custom behaviour, the recommendation is the
general one: put an executable file at ‘/usr/local/bin/python’ with
whatever behaviour you want.

-- 
 \   “But Marge, what if we chose the wrong religion? Each week we |
  `\  just make God madder and madder.” —Homer, _The Simpsons_ |
_o__)  |
Ben Finney



Re: Safest way to set python3 as default for `python`

2018-07-16 Thread Bastian Venthur

Hi Matthias,

thanks for the reply and the explanation.


Cheers,

Bastian




Re: Safest way to set python3 as default for `python`

2018-07-16 Thread Matthias Klose

On 16.07.2018 09:44, Bastian Venthur wrote:

Hi,

sorry if this question has been asked before. What is the currently recommended 
way to make `python` point to `python3`? I'd like to have it set on a system 
default level if possible.


There is none.  Maybe in the far future when Debian doesn't ship a python 
command anymore, and doesn't rely on a python binary anymore, you can screw up 
your system as you like.  But until that, don't mess around with the python symlink.




Re: Safest way to set python3 as default for `python`

2018-07-16 Thread Andrey Rahmatullin
On Mon, Jul 16, 2018 at 09:44:00AM +0200, Bastian Venthur wrote:
> sorry if this question has been asked before. What is the currently
> recommended way to make `python` point to `python3`? I'd like to have it set
> on a system default level if possible.
We don't recommend it so there is none AFAIK.

-- 
WBR, wRAR


signature.asc
Description: PGP signature


Safest way to set python3 as default for `python`

2018-07-16 Thread Bastian Venthur

Hi,

sorry if this question has been asked before. What is the currently 
recommended way to make `python` point to `python3`? I'd like to have it 
set on a system default level if possible.



Cheers,

Bastian

--
Dr. Bastian Venthur  http://venthur.de
Debian Developer venthur at debian org