LoginSignup
0
0

More than 3 years have passed since last update.

EC2(Amazon Linux)の certbot-auto renew でエラー/pkg_resources.DistributionNotFound: The 'virtualenv==15.1.0'

Last updated at Posted at 2020-12-21

状況

2016年から利用しているEC2サーバでLetsEncrypt証明書の更新エラー(証明書も2016年から利用)

※同時期からほぼ同一構成の別サーバは問題がないのだが…。

環境

  • Amazon Linux AMI release 2018.03

エラー内容

# certbot-auto renew
FATAL: Amazon Linux support is very experimental at present...
if you would like to work on improving it, please ensure you have backups
and then run this script again with the --debug flag!
Alternatively, you can install OS dependencies yourself and run this script
again with --no-bootstrap.
Creating virtual environment...
Traceback (most recent call last):
  File "/usr/bin/virtualenv", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3049, in <module>
    @_call_aside
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3033, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3062, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 660, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 673, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 858, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'virtualenv==15.1.0' distribution was not found and is required by the application
Traceback (most recent call last):
  File "<stdin>", line 27, in <module>
  File "<stdin>", line 19, in create_venv
  File "/usr/lib64/python2.7/subprocess.py", line 190, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['virtualenv', '--no-site-packages', '--python', '/usr/bin/python2.7', '/opt/eff.org/certbot/venv']' returned non-zero exit status 1

pipvirtualenv==15.1.0をインストールしようとすると以下のエラー

Traceback (most recent call last):
  File "/usr/bin/pip", line 11, in <module>
    load_entry_point('pip==9.0.3', 'console_scripts', 'pip2.7')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 564, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2661, in load_entry_point
    raise ImportError("Entry point %r not found" % ((group, name),))
ImportError: Entry point ('console_scripts', 'pip2.7') not found

解決策

私の場合は以下で動作するようになりました。

# easy_install pip==9.0.3
# easy_install virtualenv==15.1.0

余談/Amazon Linux AMI のサポート期間終了

そろそろAmazon Linux 2に移行しなくちゃ。

Amazon Linux AMI のサポート期間終了に関する更新情報 | Amazon Web Services ブログ
https://aws.amazon.com/jp/blogs/news/update-on-amazon-linux-ami-end-of-life/

抜粋

  • Amazon Linux AMI (2018.03) の最新バージョンは 2020 年 6 月 30 日にセキュリティアップデートの提供が終了
  • Amazon Linux AMI は 2020 年 12 月 31 日まで延長され、引き続きセキュリティアップデートおよびパッケージの更新版を必要に応じて提供することになりました。
  • 2020 年 12 月 31 日を過ぎると Amazon Linux AMI には新たにメンテナンスサポート期間が設定されます (2023 年 6 月 30 日まで継続)。この新たなメンテナンスサポート期間中は、
    • Amazon Linux AMI には重要、重大なセキュリティアップデートだけが縮小パッケージセットとして提供されます。
    • ただし、新しい EC2 プラットフォームキャパシティーや AWS の新機能に対するサポートは保証されません。
0
0
0

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
0
0