0

I am having an issues updating my raspbian operating system. After running sudo apt-get update && sudo apt-get upgrade -y I receive the following error messages:

Hit:1 http://raspbian.raspberrypi.org/raspbian stretch InRelease
Get:2 http://archive.raspberrypi.org/debian stretch InRelease [25.4 kB]
Fetched 25.4 kB in 10s (2,331 B/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  libavformat57 piwiz python-gpiozero python3-gpiozero python3-thonny wolfram-engine
The following packages will be upgraded:
  python-automationhat python-piglow python-smbus python3-smbus
4 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
36 not fully installed or removed.
Need to get 19.5 kB/59.5 kB of archives.
After this operation, 46.1 kB disk space will be freed.
Get:1 http://mirrors.switch.ca/raspbian/raspbian stretch/main armhf python-smbus armhf 3.1.2-3 [9,740 B]
Get:2 http://mirrors.switch.ca/raspbian/raspbian stretch/main armhf python3-smbus armhf 3.1.2-3 [9,774 B]
Fetched 19.5 kB in 1s (19.1 kB/s)
apt-listchanges: Reading changelogs...
(Reading database ... 121685 files and directories currently installed.)
Preparing to unpack .../python-automationhat_0.2.0_all.deb ...
  File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:
                             ^
SyntaxError: invalid syntax
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
  File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:
                             ^
SyntaxError: invalid syntax
dpkg: error processing archive /var/cache/apt/archives/python-automationhat_0.2.0_all.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, in <module>
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python/debpython/version.py", line 24, in <module>
    from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Preparing to unpack .../python-piglow_1.2.5_all.deb ...
  File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:
                             ^
SyntaxError: invalid syntax
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
  File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:
                             ^
SyntaxError: invalid syntax
dpkg: error processing archive /var/cache/apt/archives/python-piglow_1.2.5_all.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, in <module>
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python/debpython/version.py", line 24, in <module>
    from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Preparing to unpack .../python-smbus_3.1.2-3_armhf.deb ...
Unpacking python-smbus:armhf (3.1.2-3) over (3.1.1+svn-2) ...
Preparing to unpack .../python3-smbus_3.1.2-3_armhf.deb ...
Unpacking python3-smbus:armhf (3.1.2-3) over (3.1.1+svn-2) ...
Errors were encountered while processing:
 /var/cache/apt/archives/python-automationhat_0.2.0_all.deb
 /var/cache/apt/archives/python-piglow_1.2.5_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

It seems that python-automationhat does not want to cooperate and either purge from the system or update properly. I've tried this:

sudo dpkg -i --force-overwrite /var/cache/apt/archives/python-automationhat_0.2.0_all.deb

And this:

sudo apt remove python-automationhat

I've also tried installing the missing module with:

python pip install ConfigParser

The dpkg -i --force-overwrite and sudo apt remove both come back with errors about having to reinstall the package before continuing, I've also tried that and it still does not work.

Current Raspbian version:

Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 9.11 (stretch)
Release:        9.11
Codename:       stretch

Python version: Python 3.5.3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.