【发布时间】:2020-05-07 00:32:20
【问题描述】:
这似乎与另一个问题 "Letsencrypt failed with ImportError: No module named interface," 模糊相似,因为它是“Amazon Linux AMI”上的类似错误消息,除了在这种情况下,它是一个不同的模块(“代理”而不是“接口”) ,而其他问题所指的某些内容甚至不存在。另一个问题是在 2017 年。
我有 certbot-auto 工作。但两天后,当我发现一直在干扰 DNS 质询的问题时(我手动输入了已经自动输入的部分名称),并再次尝试获取通配符证书,certbot 立即坏了。
当我输入命令时(改名以保护无辜者):
certbot-auto certonly --manual --preferred-challenges DNS -d 'foo.bar.net,*.foo.bar.net'
它产生了这个输出:
Upgrading certbot-auto 1.0.0 to 1.1.0…
Replacing certbot-auto…
Creating virtual environment…
Installing Python packages…
Installation succeeded.
Traceback (most recent call last):
File “/opt/eff.org/certbot/venv/bin/letsencrypt”, line 7, in
from certbot.main import main
File “/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/certbot/main.py”, line 2, in
from certbot._internal import main as internal_main
File “/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/certbot/_internal/main.py”, line 10, in
import josepy as jose
File “/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/josepy/init.py”, line 41, in
from josepy.interfaces import JSONDeSerializable
File “/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/josepy/interfaces.py”, line 7, in
from josepy import errors, util
File “/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/josepy/util.py”, line 7, in
import OpenSSL
File “/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/OpenSSL/init.py”, line 8, in
from OpenSSL import crypto, SSL
File “/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/OpenSSL/crypto.py”, line 12, in
from cryptography import x509
ImportError: No module named cryptography
然后我尝试了here, for "No module named cryptography" in Amazon Linux 2 给出的解决方案,但是当我在该解决方案中输入最终命令时,
/opt/eff.org/certbot/venv/local/bin/pip install cryptography interface
它抱怨
Requirement already satisfied: cryptography in /opt/eff.org/certbot/venv/lib/python2.7/dist-packages
Exception:
Traceback (most recent call last):
File “/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/pip/basecommand.py”, line 215, in main
status = self.run(options, args)
File “/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/pip/commands/install.py”, line 335, in run
wb.build(autobuilding=True)
File “/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/pip/wheel.py”, line 749, in build
self.requirement_set.prepare_files(self.finder)
File “/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/pip/req/req_set.py”, line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File “/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/pip/req/req_set.py”, line 666, in _prepare_file
check_dist_requires_python(dist)
File “/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/pip/utils/packaging.py”, line 48, in check_dist_requires_python
feed_parser.feed(metadata)
File “/usr/lib64/python2.7/email/feedparser.py”, line 177, in feed
self._input.push(data)
File “/usr/lib64/python2.7/email/feedparser.py”, line 99, in push
parts = data.splitlines(True)
AttributeError: ‘NoneType’ object has no attribute ‘splitlines’
然后,当我尝试原始命令时,
certbot-auto certonly --manual --preferred-challenges DNS -d 'foo.bar.net,*.foo.bar.net'
我明白了
Error: couldn't get currently installed version for /opt/eff.org/certbot/venv/bin/letsencrypt:
Traceback (most recent call last):
File "/opt/eff.org/certbot/venv/bin/letsencrypt", line 7, in <module>
from certbot.main import main
File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/certbot/main.py", line 2, in <module>
from certbot._internal import main as internal_main
File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/certbot/_internal/main.py", line 11, in <module>
import zope.component
File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/zope/component/__init__.py", line 23, in <module>
from zope.component.interfaces import IComponentArchitecture
File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/zope/component/interfaces.py", line 21, in <module>
import zope.deferredimport
File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/zope/deferredimport/__init__.py", line 1, in <module>
from zope.deferredimport.deferredmodule import initialize
File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/zope/deferredimport/deferredmodule.py", line 18, in <module>
import zope.proxy
ImportError: No module named proxy
我查看了“No module named interface”问题,但它要求在哪里做事
/root/.local/share/letsencrypt
我找不到像“/root/.local”、“/home/ec2-user/.local”或“/.local”这样的目录;如果我转到文件系统根目录并执行
find -name letsencrypt
我明白了
./var/lib/letsencrypt
./var/log/letsencrypt
./etc/letsencrypt
./opt/eff.org/certbot/venv/lib/python2.7/dist-packages/letsencrypt
./opt/eff.org/certbot/venv/bin/letsencrypt
./opt/trac-1.2.3-11/letsencrypt
有人能解释一下吗?
【问题讨论】:
-
尝试创建一个新的 virtualenv 然后
pip install certbot进入它。由于安装zope.proxy包时可能使用了旧(有缺陷的)setuptools 版本,包升级过程中可能存在一些问题,其中某些嵌套依赖项未正确解析和/或某些命名空间包未正确安装。跨度> -
“虚拟环境”?我们是在谈论我还不知道的另一个实例,还是实例中的某些东西?
-
Create a new
venv就像在./opt/eff.org/certbot/venv中一样,但将其放在不同的位置。 -
或者,见鬼,按照您链接的问题中接受的答案中的说明进行操作。
标签: python lets-encrypt certbot amazon-linux