背景
#yum updateした時にPythonパッケージでエラーが出たのでごちゃごちゃしていたらいつの間にかLetsEncryptが使えなくなりました。具体的にはcertbot renewで以下のエラー
ImportError: 'pyOpenSSL' module missing required functionality. Try upgrading to v0.14 or newer.
pyOpenSSLはyumでcertbotをインストールした時に自動的にインストールされていてバージョンは0.13.1
これをアップデートをすればいいのですが、、、てこづりました。
対処方法/NG版
まずpipコマンドを使ってアップグレードしようと思いましたが、「削除できない」エラーが発生します。
削除してからインストールしようとしても削除できません。
試したコマンド
# pip uninstall pyOpenSSL
# pip install --upgrade --force-reinstall pyOpenSSL
エラー内容
ERROR: Cannot uninstall 'pyOpenSSL'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
次にyum remove pyOpenSSLを試しますが依存関係のあるライブラリ全て(certbot等)も削除されてしまいます・・・。
対処方法/OK版
yumでインストールしたpyOpenSSLだけを削除するにはrpmコマンドを使います。
rpm -e --nodeps pyOpenSSL
この後にpip install pyOpenSSLでインストール。解決しました。