airflow错误:AttributeError:模块'airflow.utils.log'没有属性'file_processor_handler'

时间:2019-01-24 06:00:27

标签: python airflow

我的本​​地气流瞬间启动并运行,但是现在当我运行气流Web服务器或任何其他气流命令时,出现以下错误(带有一些追溯):

  Unable to load the config, contains a configuration error.
  Traceback (most recent call last):
  File "/anaconda3/lib/python3.6/logging/config.py", line 382, in resolve
  found = getattr(found, frag)
  AttributeError: module 'airflow.utils.log' has no attribute 'file_processor_handler'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
  File "/anaconda3/lib/python3.6/logging/config.py", line 384, in resolve
self.importer(used)
   File "/anaconda3/lib/python3.6/site-packages/airflow/utils/log/file_processor_handler.py", line 25, in <module>
from airflow.utils.helpers import parse_template_string
   File "/anaconda3/lib/python3.6/site-packages/airflow/utils/helpers.py", line 25, in <module>
import psutil
 File "/anaconda3/lib/python3.6/site-packages/psutil/__init__.py", line 134, in <module>
 from . import _psosx as _psplatform
  File "/anaconda3/lib/python3.6/site-packages/psutil/_psosx.py", line 14, in <module>
from . import _psutil_osx as cext
  ImportError: dlopen(/anaconda3/lib/python3.6/site-packages/psutil/_psutil_osx.cpython-36m-darwin.so, 2): Symbol not found: _kIOMasterPortDefault
  Referenced from: /anaconda3/lib/python3.6/site-packages/psutil/_psutil_osx.cpython-36m-darwin.so
  Expected in: flat namespace
 in /anaconda3/lib/python3.6/site-packages/psutil/_psutil_osx.cpython-36m-darwin.so

  The above exception was the direct cause of the following exception:

   Traceback (most recent call last):
   File "/anaconda3/lib/python3.6/logging/config.py", line 558, in configure
   handler = self.configure_handler(handlers[name])
 ValueError: Cannot resolve 'airflow.utils.log.file_processor_handler.FileProcessorHandler': dlopen(/anaconda3/lib/python3.6/site-packages/psutil/_psutil_osx.cpython-36m-darwin.so, 2): Symbol not found: _kIOMasterPortDefault
  Referenced from: /anaconda3/lib/python3.6/site-packages/psutil/_psutil_osx.cpython-36m-darwin.so
  Expected in: flat namespace
 in /anaconda3/lib/python3.6/site-packages/psutil/_psutil_osx.cpython-36m-darwin.so

   During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
 File "/anaconda3/bin/airflow", line 21, in <module>
from airflow import configuration
  File "/anaconda3/lib/python3.6/site-packages/airflow/__init__.py", line 36, in <module>
from airflow import settings
 File "/anaconda3/lib/python3.6/site-packages/airflow/settings.py", line 259, in <module>
configure_logging()
 File "/anaconda3/lib/python3.6/site-packages/airflow/logging_config.py", line 72, in configure_logging
raise e
 File "/anaconda3/lib/python3.6/site-packages/airflow/logging_config.py", line 67, in configure_logging
dictConfig(logging_config)
 File "/anaconda3/lib/python3.6/logging/config.py", line 795, in dictConfig
dictConfigClass(config).configure()

我试图升级气流,但这没有帮助

3 个答案:

答案 0 :(得分:1)

我刚刚遇到了与您提到的相同的问题。

即使我只是导入pandas lib,我也将面对这个问题。

原因是我有一些dag文件,名称为email.py。与python内部库名称相同。冲突导致python停止工作。之后,我将email.py重命名为email_test.py。 问题解决了。

您可以参考类似的问题。这是相同的问题,也是相同的解决方案。 ImportError : cannot import DAG airflow

如果您喜欢我的回答,请投票。

答案 1 :(得分:0)

在此PR https://github.com/apache/airflow/pull/3585

中查看我的评论

基本上将psutil固定到4.4.2的问题将得到解决,因为在这种情况下,最新版本的psutil(5.6.1)在我的OSX上失败了

答案 2 :(得分:0)

我认为问题在于pustil的安装混合了旧文件和新文件。

错误消息的“无法解决'airflow.utils.log.file_processor_handler.FileProcessorHandler”部分只是Airflow所说的,当尝试FileProcessorHandler时,我们遇到了另一个错误。

您应该看到运行pyton -c "import psutil"的错误形式完全相同,这将完全消除方程中的气流。

我认为解决方法是完全卸载psutil(如果不涉及conda,我会说pip uninstall psutil),然后重新安装。我认为在这种情况下,我会尝试pip-uninstall并从中卸载它,但是要安装conda软件包。