docker - ModuleNotFoundError:没有名为“urllib3.packages.six”的模块
问题描述
我无法运行气流图像。它构建成功,但是当我使用 docker-compose up 并调出图像时,它会引发以下错误并退出。
Unable to load the config, contains a configuration error.
Traceback (most recent call last):
File "/usr/lib64/python3.6/logging/config.py", line 390, in resolve
found = getattr(found, frag)
AttributeError: module 'airflow.utils.log' has no attribute 'file_task_handler'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/python3.6/logging/config.py", line 392, in resolve
self.importer(used)
File "/usr/local/lib/python3.6/site-packages/airflow/utils/log/file_task_handler.py", line 24, in <module>
import requests
File "/usr/lib/python3.6/site-packages/requests/__init__.py", line 43, in <module>
import urllib3
File "/usr/lib/python3.6/site-packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 11, in <module>
from .exceptions import (
File "/usr/lib/python3.6/site-packages/urllib3/exceptions.py", line 2, in <module>
from .packages.six.moves.http_client import (
ModuleNotFoundError: No module named 'urllib3.packages.six'
当然,我用谷歌搜索并没有发现任何修复它的东西。我已经尝试用我的 dockerfile 修复任何可能的错误,重新启动 docker,重建图像。
这是我的 dockerfile 的一部分。
RUN pip3 install pytz --cert root.pem \
&& pip3 install pyOpenSSL --cert root.pem \
&& pip3 install ndg-httpsclient --cert root.pem \
&& pip3 install pyasn1 --cert root.pem \
&& pip3 install teradatasql --cert root.pem \
&& pip3 install --trusted-host=files.pythonhosted.org --trusted-host=pypi.org apache-airflow[crypto,celery,postgres,hive,jdbc,kubernetes,mysql,mssql,ssh,ldap]==${AIRFLOW_VERSION} --cert root.pem \
&& pip3 install 'redis==3.2' --cert root.pem \
&& pip3 install Cython --cert root.pem \
&& pip3 install xmlrunner --cert root.pem \
&& pip3 install unittest-xml-reporting --cert root.pem \
&& pip3 install pyodbc --cert root.pem \
&& pip3 install flask-bcrypt --cert root.pem \
&& pip3 install python-ldap --cert root.pem \
&& pip3 install ldap3 --cert root.pem \
&& pip3 install emoji --cert root.pem \
&& pip3 install urllib3 --cert root.pem
解决方案
将这些行添加到我的 dockerfile 以解决问题
&& pip3 uninstall urllib3 -y --cert root.pem \
&& pip3 install --no-cache-dir -U urllib3 --cert root.pem
推荐阅读
- django - MULTPLE SETTINGS 文件有问题。Django/Python
- android - 长 SVG 资产文件错误:R 不是有效动词。路径的位置 2 发生故障:STRING_TOO_LARGE
- python - np.arange 返回
而不是价值 - javascript - SQL插入有两个错误
- python - 使用selenium python切换帧时如何获取完整的html代码
- oracle - oracle 参数 enable_shared_pool_durations 设置为 true 或 false
- css - 将几个块居中(标题、文本、徽标)
- django - Reactjs 嵌套路由器在刷新时不起作用
- angular - 获取 Firebase 分析事件数据
- android - 如何获取蓝牙的RSSI