LoginSignup
2

More than 5 years have passed since last update.

aws-cli 1.14.28 で ImportError: No module named history

Last updated at Posted at 2018-06-04

aws-cli 1.14.28 で ImportError: No module named history

CentOSを7.5にアップデートした際、aws-cliのバージョンが変わり、
ImportError: No module named historyが出るようになってしまいました。

CentOSのリリースノートには、既知の問題としてこのような注意が追加されています。

AWSユーザーは、更新する前に問題に注意する必要があります。RHEL-7.5にawscliのバージョンが追加されました。
これは、現在EPELで利用可能なバージョンからのアップグレードです。
それは、python-s3transferの前提条件を持っています。
ここで、EPELコピーにはpython2-s3transferが必要です。
python2-s3transferを削除せずにawscliを更新し、python-s3transferをインストールすると、awscliはスタックトレースで終了します。
yum swap python2-s3transfer python-s3transferを使って2つのパッケージを交換し、ベースリポジトリからawscliを実行することができます。

現時点での対処法がCentOSのコミュニティで出ていましたので記載します。
https://www.centos.org/forums/viewtopic.php?t=67020

発生環境

CentOS 7.5.1804
aws-cli/1.14.28 Python/2.7.5 Linux/3.10.0-862.2.3.el7.x86_64 botocore/1.8.35

事象

aws-cliをアップデート後、aws --versionなどで、ImportError: No module named historyが出力される。

対処法

python2-s3transferを削除してpython-s3transferに変更する。

yum swap python2-s3transfer python-s3transfer

python2-s3transfernの依存でインストールされたEPELリポジトリの依存関係を削除する。

yum remove python2-botocore python2-futures python2-jmespath

追記:python-s3transfer-0.1.10-8.el7.noarchでは以下の対応が必要でしたが、python-s3transfer-0.1.10-8.el8.noarchからは対応されています

s3へのアップロードなどを行わないなら、ここまででaws --versionが実行できれば完了です。

s3へのアップロードも行う場合、python-s3transferで必要なバージョンが0.1.12ですが、現時点でCentOSは0.1.10が入る為、
手動でパッチを当ててあげなければいけません。
以下のパッチを当ててあげてください。
https://bugzilla.redhat.com/show_bug.cgi?id=1578083t

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2