certbot 无法从 ‘urllib3.contrib’ 导入 ‘appengine’。

huangapple go评论83阅读模式
英文:

certbot cannot import name 'appengine' from 'urllib3.contrib'

问题

在我的Ubuntu 22.04.2 LTS上,使用Python 3.10.6,Certbot出现以下错误:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/requests_toolbelt/_compat.py", line 48, in <module>
    from requests.packages.urllib3.contrib import appengine as gaecontrib
ImportError: cannot import name 'appengine' from 'requests.packages.urllib3.contrib' (/usr/local/lib/python3.10/dist-packages/urllib3/contrib/__init__.py)

带有完整错误消息的情况下:

在处理上述异常时发生了另一个异常
Traceback (most recent call last):
  File "/usr/bin/certbot", line 33, in <module>
    sys.exit(load_entry_point('certbot==1.21.0', 'console_scripts', 'certbot')())
  File "/usr/bin/certbot", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/certbot/main.py", line 2, in <module>
    from certbot._internal import main as internal_main
  File "/usr/lib/python3/dist-packages/certbot/_internal/main.py", line 28, in <module>
    from certbot._internal import account
  File "/usr/lib/python3/dist-packages/certbot/_internal/account.py", line 19, in <module>
    from acme.client import ClientBase  # pylint: disable=unused-import
  File "/usr/lib/python3/dist-packages/acme/client.py", line 34, in <module>
    from requests_toolbelt.adapters.source import SourceAddressAdapter
  File "/usr/lib/python3/dist-packages/requests_toolbelt/__init__.py", line 12, in <module>
    from .adapters import SSLAdapter, SourceAddressAdapter
  File "/usr/lib/python3/dist-packages/requests_toolbelt/adapters/__init__.py", line 12, in <module>
    from .ssl import SSLAdapter
  File "/usr/lib/python3/dist-packages/requests_toolbelt/adapters/ssl.py", line 16, in <module>
    from .._compat import poolmanager
  File "/usr/lib/python3/dist-packages/requests_toolbelt/_compat.py", line 50, in <module>
    from urllib3.contrib import appengine as gaecontrib
ImportError: cannot import name 'appengine' from 'urllib3.contrib' (/usr/local/lib/python3.10/dist-packages/urllib3/contrib/__init__.py)

这是一堆错误,我不知道从哪里开始解决。希望能提供一点帮助!

英文:

On my Ubuntu 22.04.2 LTS with Python 3.10.6, Certbot gives the following error:

Traceback (most recent call last):
File &quot;/usr/lib/python3/dist-packages/requests_toolbelt/_compat.py&quot;, line 48, in &lt;module&gt;
from requests.packages.urllib3.contrib import appengine as gaecontrib
ImportError: cannot import name &#39;appengine&#39; from &#39;requests.packages.urllib3.contrib&#39; (/usr/local/lib/python3.10/dist-packages/urllib3/contrib/__init__.py)

with the complete error message:

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File &quot;/usr/bin/certbot&quot;, line 33, in &lt;module&gt;
sys.exit(load_entry_point(&#39;certbot==1.21.0&#39;, &#39;console_scripts&#39;, &#39;certbot&#39;)())
File &quot;/usr/bin/certbot&quot;, line 25, in importlib_load_entry_point
return next(matches).load()
File &quot;/usr/lib/python3.10/importlib/metadata/__init__.py&quot;, line 171, in load
module = import_module(match.group(&#39;module&#39;))
File &quot;/usr/lib/python3.10/importlib/__init__.py&quot;, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1050, in _gcd_import
File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1027, in _find_and_load
File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1006, in _find_and_load_unlocked
File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 688, in _load_unlocked
File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 883, in exec_module
File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 241, in _call_with_frames_removed
File &quot;/usr/lib/python3/dist-packages/certbot/main.py&quot;, line 2, in &lt;module&gt;
from certbot._internal import main as internal_main
File &quot;/usr/lib/python3/dist-packages/certbot/_internal/main.py&quot;, line 28, in &lt;module&gt;
from certbot._internal import account
File &quot;/usr/lib/python3/dist-packages/certbot/_internal/account.py&quot;, line 19, in &lt;module&gt;
from acme.client import ClientBase  # pylint: disable=unused-import
File &quot;/usr/lib/python3/dist-packages/acme/client.py&quot;, line 34, in &lt;module&gt;
from requests_toolbelt.adapters.source import SourceAddressAdapter
File &quot;/usr/lib/python3/dist-packages/requests_toolbelt/__init__.py&quot;, line 12, in &lt;module&gt;
from .adapters import SSLAdapter, SourceAddressAdapter
File &quot;/usr/lib/python3/dist-packages/requests_toolbelt/adapters/__init__.py&quot;, line 12, in &lt;module&gt;
from .ssl import SSLAdapter
File &quot;/usr/lib/python3/dist-packages/requests_toolbelt/adapters/ssl.py&quot;, line 16, in &lt;module&gt;
from .._compat import poolmanager
File &quot;/usr/lib/python3/dist-packages/requests_toolbelt/_compat.py&quot;, line 50, in &lt;module&gt;
from urllib3.contrib import appengine as gaecontrib
ImportError: cannot import name &#39;appengine&#39; from &#39;urllib3.contrib&#39; (/usr/local/lib/python3.10/dist-packages/urllib3/contrib/__init__.py)

It's kind of a lot errors and I don't know where to start to resolve it.
I little help would be appreciated!

答案1

得分: 1

urllib3被apt和pip都安装了。我通过以下命令删除了pip版本:

pip3 uninstall urllib3

现在certbot正常工作。

英文:

urllib3 was installed by both apt and pip. I removed the pip version by issuing:

pip3 uninstall urllib3

Now certbot work fine.

huangapple
  • 本文由 发表于 2023年6月26日 16:09:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/76554745.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定