web-dev-qa-db-ja.com

Python 18.10から19.04へのアップグレード時のエラー

Python 2.7.15+がpythonにシンボリックリンクされており、Python 3.6.7がpython3にシンボリックリンクされています。 Ubuntuを19.04にアップグレードします

Sudo do-release-upgrade

次のエラーを返します。

Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-k7w2kx7r/disco", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeMain.py", line 238, in main
    if app.run():
  File "/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeController.py", line 2085, in run
    return self.fullUpgrade()
  File "/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeController.py", line 1906, in fullUpgrade
    if not self.askLivepatch():
  File "/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeController.py", line 1175, in askLivepatch
    version = next((r.version for r in di.get_all("object") if r.series == self.toDist), self.toDist)
AttributeError: 'UbuntuDistroInfo' object has no attribute 'get_all'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/problem_report.py", line 497, in add_to_existing
    self.write(f)
  File "/usr/lib/python3/dist-packages/problem_report.py", line 450, in write
    block = f.read(1048576)
  File "/usr/lib/python3.6/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

Original exception was:
Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-k7w2kx7r/disco", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeMain.py", line 238, in main
    if app.run():
  File "/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeController.py", line 2085, in run
    return self.fullUpgrade()
  File "/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeController.py", line 1906, in fullUpgrade
    if not self.askLivepatch():
  File "/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeController.py", line 1175, in askLivepatch
    version = next((r.version for r in di.get_all("object") if r.series == self.toDist), self.toDist)
AttributeError: 'UbuntuDistroInfo' object has no attribute 'get_all'

Ubuntuをアップグレードする前に、すべてのPythonパッケージをアップグレードしようとしました:

pip freeze --local | grep -v '^-e' | cut -d = -f 1  | xargs -n1 pip install -U

それが失敗する理由ですか?

3
Nichts Hsu

私はその問題を自分で解決しました。

問題のあるpythonスクリプトを見つけます:

/usr/local/lib/python3.6/dist-packages/distro_info.py

次に、それをカバーします:

https://salsa.debian.org/debian/distro-info/raw/master/python/distro_info.py

次に、Sudo do-release-upgradeを正常に実行します。

4
Nichts Hsu