Ickam
Posts: 16
Joined: Sat May 13, 2017 10:16 am

Fixing (downgrading) Python3

Mon May 13, 2019 3:33 pm

Hi,
Months ago I was playing around with Python3, trying to build something. I think I needed a newer version of python3 than was available in repositories, so I did a stupid thing and added Buster repositories to my sources file for a bit. That left me with Python3 3.6.6
I am trying to install docker on my Pi, and while trying to install dependencies I get

Code: Select all

sudo apt-get install apt-transport-https \
                                         ca-certificates \
                                         software-properties-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
ca-certificates is already the newest version (20161130+nmu1+deb9u1).
apt-transport-https is already the newest version (1.6.4).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 software-properties-common : Depends: python3-dbus but it is not going to be installed
                              Depends: python3-software-properties (= 0.96.20.2-1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
When I try to remove Python 3.6 through synaptic, it tells me that proceeding with that would remove a whole bunch of other packages, including packages vital to lxde. This is the case even if I manually install python 3.5 (which I believe to be default in stretch and compatible with python3-dbus)
Could you please help me get this resolved without losing my gui?
I'm using Raspberry pi 3

hippy
Posts: 8882
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Fixing (downgrading) Python3

Mon May 13, 2019 3:58 pm

IMO this is one of those cases where it's best to grab a new SD card, start with a new installation, allow yourself to progress with Docker, while figuring out what you need to get from the older card to the new.

Ickam
Posts: 16
Joined: Sat May 13, 2017 10:16 am

Re: Fixing (downgrading) Python3

Mon May 13, 2019 4:11 pm

hippy wrote:
Mon May 13, 2019 3:58 pm
IMO this is one of those cases where it's best to grab a new SD card, start with a new installation, allow yourself to progress with Docker, while figuring out what you need to get from the older card to the new.
If only that could be easily done. I am disabled and my raspberry pi sits on top of my projector (it was originally connected to it). I'm prepared to go terminal only for the time-being, if someone helped me restore gui, posting detailed info on what I need to install and in what order. I realise that this will be more time-consuming, but believe me that it would still be easier for me.
On stackexchange or similar forum I read that you can create a preferences file that would allow apt to downgrade packages. The original instructions referenced ubuntu specifically in this file, so I was hoping that maybe somebody knew how to do this with raspbian.

raspyoutine
Posts: 3
Joined: Sun May 12, 2019 2:12 pm

Re: Fixing (downgrading) Python3

Tue May 14, 2019 9:24 am

Hello,
If you can't use SSH try this method using synaptic (for ubuntu):
https://www.howtogeek.com/117929/how-to ... on-ubuntu/

Ickam
Posts: 16
Joined: Sat May 13, 2017 10:16 am

Re: Fixing (downgrading) Python3

Tue May 14, 2019 10:52 am

I removed all the conflicting versions of python3 and now I get:

Code: Select all

 sudo apt install python3=3.5.3-1
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  python3-doc python3-tk python3-venv
The following NEW packages will be installed:
  python3
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
3 not fully installed or removed.
Need to get 0 B/21.6 kB of archives.
After this operation, 68.6 kB of additional disk space will be used.
Setting up python3-minimal (3.5.3-1) ...
/var/lib/dpkg/info/python3-minimal.postinst: 5: /var/lib/dpkg/info/python3-minimal.postinst: py3compile: not found
dpkg: error processing package python3-minimal (--configure):
 subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
 python3-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)

hippy
Posts: 8882
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Fixing (downgrading) Python3

Tue May 14, 2019 12:28 pm

Ickam wrote:
Mon May 13, 2019 4:11 pm
I was hoping that maybe somebody knew how to do this with raspbian.
I understand your situation and can appreciate your desire for an easy fix. I just fear that so few people will have done it, or would know exactly how to do it with guaranteed success, that you'll end up digging a deeper hole and will eventually have to start from scratch anyway. Possibly with a bigger mess to deal with than if you started with a fresh install.

But no reason not to try. Just make sure you have a backup of everything you cannot afford to lose.

Ickam
Posts: 16
Joined: Sat May 13, 2017 10:16 am

Re: Fixing (downgrading) Python3

Wed May 15, 2019 2:41 pm

I managed to fix it by manually downloading (wget from https://packages.debian.org/stretch/all/) dependencies to python3-minimal package. Then I installed it (dpkg -i) and the errors are gone.

Return to “Troubleshooting”