ImportError: cannot import name 'OP_NO_TICKET' from 'urllib3.util.ssl_'

ImportError: cannot import name 'OP_NO_TICKET' from 'urllib3.util.ssl_'

我在本地启动了 运行 气流,而 运行 docker 特别是: docker-compose run -rm web server initdb 我开始看到这个错误。今天下午之前我还没有看到这个问题,想知道是否有其他人遇到过这个问题。

无法从 'urllib3.util.ssl_'

导入名称 'OP_NO_TICKET'
2021-11-08 20:55:08,137] {{plugins_manager.py:236}} ERROR - cannot import name 'OP_NO_TICKET' from 'urllib3.util.ssl_' (/usr/local/lib/python3.8/site-packages/urllib3/util/ssl_.py)
Traceback (most recent call last):
 File "/usr/local/lib/python3.8/site-packages/airflow/plugins_manager.py", line 228, in load_plugins_from_plugin_directory
  loader.exec_module(mod)
 File "<frozen importlib._bootstrap_external>", line 843, in exec_module
 File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
 File "/usr/local/airflow/repo/plugins/mysql_plugin/hooks/vice_mysql_hook.py", line 4, in <module>
  from airflow.providers.amazon.aws.hooks.s3 import S3Hook
 File "/usr/local/lib/python3.8/site-packages/airflow/providers/amazon/aws/hooks/s3.py", line 33, in <module>
  from boto3.s3.transfer import S3Transfer, TransferConfig
 File "/usr/local/lib/python3.8/site-packages/boto3/__init__.py", line 16, in <module>
  from boto3.session import Session
 File "/usr/local/lib/python3.8/site-packages/boto3/session.py", line 17, in <module>
  import botocore.session
 File "/usr/local/lib/python3.8/site-packages/botocore/session.py", line 29, in <module>
  import botocore.credentials
 File "/usr/local/lib/python3.8/site-packages/botocore/credentials.py", line 34, in <module>
  from botocore.config import Config
 File "/usr/local/lib/python3.8/site-packages/botocore/config.py", line 16, in <module>
  from botocore.endpoint import DEFAULT_TIMEOUT, MAX_POOL_CONNECTIONS
 File "/usr/local/lib/python3.8/site-packages/botocore/endpoint.py", line 22, in <module>
  from botocore.awsrequest import create_request_object
 File "/usr/local/lib/python3.8/site-packages/botocore/awsrequest.py", line 24, in <module>
  import botocore.utils
 File "/usr/local/lib/python3.8/site-packages/botocore/utils.py", line 32, in <module>
  import botocore.httpsession
 File "/usr/local/lib/python3.8/site-packages/botocore/httpsession.py", line 10, in <module>
  from urllib3.util.ssl_ import (
ImportError: cannot import name 'OP_NO_TICKET' from 'urllib3.util.ssl_' (/usr/local/lib/python3.8/site-packages/urllib3/util/ssl_.py)

我在使用 GitLab-CI 的 CI/CD 中遇到了同样的问题。 awscli 版本 1.22.0 有这个问题。我暂时解决了我的 gitlab-ci 文件中更改的问题:

pip install awscli --upgrade --user

作者:

pip install awscli==1.21.12 --user

因为调用latest时,来的版本是1.22.0