I tested installing python3 using the instructions at https://passingcuriosity.com/2015/installing-python-from-source/ and sure enough I received the same Traceback.
Setting up python3.5-minimal (3.5.3-1) ... Traceback (most recent call last): File "/usr/lib/python3.5/py_compile.py", line 6, in <module> import importlib._bootstrap_external File "/usr/lib/python3.5/importlib/__init__.py", line 57, in <module> import types File "/usr/lib/python3.5/types.py", line 166, in <module> import functools as _functools File "/usr/lib/python3.5/functools.py", line 23, in <module> from weakref import WeakKeyDictionary File "/usr/lib/python3.5/weakref.py", line 12, in <module> from _weakref import ( ImportError: cannot import name '_remove_dead_weakref' dpkg: error processing package python3.5-minimal (--configure): subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of python3-minimal: python3-minimal depends on python3.5-minimal (>= 3.5.3-1~); however: Package python3.5-minimal is not configured yet. dpkg: error processing package python3-minimal (--configure): dependency problems - leaving unconfigured No apport report written because the error message indicates its a followup error from a previous failure. Errors were encountered while processing: python3.5-minimal python3-minimal Once I removed /usr/local/bin/python3.5 I was then able to fix the upgrade via 'sudo apt-get -f install'. -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to python3-defaults in Ubuntu. https://bugs.launchpad.net/bugs/1682934 Title: package python3 3.5.1-4 failed to install/upgrade: pre-dependency problem - not installing python3 Status in python3-defaults package in Ubuntu: Confirmed Bug description: Got this error while using "Transmageddon Video Transcoder" and again while updating 16.10 to 17.04. Seems to have something to do with needing that Python3 version for Teletext decoding in media that is in transport stream format (.ts). ProblemType: Package DistroRelease: Ubuntu 17.04 Package: python3 3.5.1-4 ProcVersionSignature: Ubuntu 4.10.0-19.21-generic 4.10.8 Uname: Linux 4.10.0-19-generic x86_64 ApportVersion: 2.20.4-0ubuntu4 Architecture: amd64 Date: Fri Apr 14 19:27:33 2017 ErrorMessage: pre-dependency problem - not installing python3 InstallationDate: Installed on 2015-05-01 (714 days ago) InstallationMedia: Ubuntu 15.04 "Vivid Vervet" - Release amd64 (20150422) RelatedPackageVersions: dpkg 1.18.10ubuntu2 apt 1.4 SourcePackage: python3-defaults Title: package python3 3.5.1-4 failed to install/upgrade: pre-dependency problem - not installing python3 UpgradeStatus: Upgraded to zesty on 2017-04-14 (0 days ago) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/python3-defaults/+bug/1682934/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp