On Fri, 19 Mar 2021 12:52:49 +0100 Matthias Klose <[email protected]> wrote:
> On 3/19/21 12:44 PM, наб wrote:
> > Package: python3-minimal
> > Version: 3.9.2-2
> > Severity: wishlist
> > Tags: patch
> >
> > Dear Maintainer,
> >
> > python3-minimal currently contains the following:
> > lrwxrwxrwx root/root 0 2021-03-02 19:55 ./usr/bin/python3 ->
python3.9
> > lrwxrwxrwx root/root 0 2021-03-02 19:55
./usr/share/man/man1/python3.1.gz -> python3.9.1.gz
> >
> > But multiple python3.x versions can be installed simultaneously,
> > and a newer one can break code that worked on a previous one;
> > the standard solution to this is to run
> > update-alternatives --configure python3
> > but imagine my surprise when that returned no results!
>
> No, that would break any extension not built for the newer version. Not doing
that.
Dear Maintainer,
Currently, upgrading from 3.7 to 3.9 breaks scripts that depended on python3
pointing to 3.7, for example because of pip modules or locally built extensions.
Given that 3.7 and 3.9 can coexist as separate binaries on the same system, I
expect I should be able to freely pick which one python3 points to.
Here's a rough repro of what I hit earlier today:
---
sudo debootstrap --variant minbase buster bython-test
sudo chroot bython-test
export DEBIAN_FRONTEND=noninteractive
apt -yq install python3 python3-pip unixodbc-dev
pip3 install pyodbc
python3 -c "import pyodbc" # So far so good
# Upgrade to bullseye, that'll pull in 3.9
sed -i s/buster/bullseye/g /etc/apt/sources.list
apt update; apt -yq dist-upgrade
python3 -m "import pyodbc" # Broken by upgrade
# Setup the alternatives suggested by наб
dpkg-divert --rename --add /usr/bin/python3
dpkg-divert --rename --add /usr/share/man/man1/python3.1.gz
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 390 \
--slave /usr/share/man/man1/python3.1.gz python3.1.gz
/usr/share/man/man1/python3.9.1.gz
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 370 \
--slave /usr/share/man/man1/python3.1.gz python3.1.gz
/usr/share/man/man1/python3.7.1.gz
# Now I can do this
update-alternatives --set python3 /usr/bin/python3.7
python3 -c "import pyodbc" # Functional again
---
Not being an expert on Python I must say I have no idea what having alternatives
would break, but as a Debian sysadmin they are my first reflex when a version
upgrade goes wrong.
Regards,
Y. Le Pennec