Here’s the result of an apt update / apt upgrade / apt dist-upgrade
sudo apt dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
python-cryptography
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
24 not fully installed or removed.
Need to get 0 B/212 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Reading changelogs... Done
(Reading database ... 81174 files and directories currently installed.)
Preparing to unpack .../python-cryptography_1.7.1-3+deb9u2_amd64.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-cryptography_1.7.1-3+deb9u2_amd64.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
Errors were encountered while processing:
/var/cache/apt/archives/python-cryptography_1.7.1-3+deb9u2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
I’m not really sure what I’ve actually done here, but I can’t get past it. I can’t seem to remove that package, or fix it, or reinstall it, everything just fails with that or a similar error. Could someone help me get rid of this damn thing please, I’ve been trying for a couple of days now.
Thanks!!!
2
Answers
Thanks Tom, while it wasn't quite my issue, it did lead me down the right path. Basically, this whole issue was caused because I'd set Python 3.5 as default at some point and apparently Debian could not find a way to deal with that for whatever reason. As soon as I reverted back to 2.7, everything was fine.
I ran into this today as well, python-cryptography was blocking me in a similar way.
I ran pyclean manually on python-cryptography package. I was root so you may need to prepend sudo to the command
/usr/bin/pyclean python-cryptography
This got me to a different set of errors (unrelated to your problem most likely. My system was very broken), but dpkg was happy enough to start working again. Give it a shot
-Tom