gpt4 book ai didi

Airflow initdb : cannot import name 'Pendulum' from 'pendulum'

转载 作者:行者123 更新时间:2023-12-04 02:29:12 32 4
gpt4 key购买 nike

我在名为 engdados 的 Anaconda 环境之一中安装了 Airflow 。当我执行命令 Airflow initdb 时,我收到以下错误:airflow initdb: cannot import name 'Pendulum' from 'pendulum' .完整的回溯如下所示:

(engdados) guilherme@Athena-LNX:~$ airflow initdb
Traceback (most recent call last):
File "/home/guilherme/anaconda3/envs/engdados/bin/airflow", line 25, in <module>
from airflow.configuration import conf
File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/airflow/__init__.py", line 47, in <module>
settings.initialize()
File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/airflow/settings.py", line 403, in initialize
configure_adapters()
File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/airflow/settings.py", line 319, in configure_adapters
from pendulum import Pendulum
ImportError: cannot import name 'Pendulum' from 'pendulum' (/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/pendulum/__init__.py)
(engdados) guilherme@Athena-LNX:~$ service start mysql$
start: unrecognized service
(engdados) guilherme@Athena-LNX:~$ service mysql start$
Usage: /etc/init.d/mysql start|stop|restart|reload|force-reload|status|bootstrap
(engdados) guilherme@Athena-LNX:~$ airflow initdb
Traceback (most recent call last):
File "/home/guilherme/anaconda3/envs/engdados/bin/airflow", line 25, in <module>
from airflow.configuration import conf
File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/airflow/__init__.py", line 47, in <module>
settings.initialize()
File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/airflow/settings.py", line 403, in initialize
configure_adapters()
File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/airflow/settings.py", line 319, in configure_adapters
from pendulum import Pendulum
ImportError: cannot import name 'Pendulum' from 'pendulum' (/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/pendulum/__init__.py)
问题是:摆锤装好了!当我执行 conda list命令我可以在那里看到钟摆,如下所示:
 Name                    Version                   Build  Channel

pendulum 2.1.2 pypi_0 pypi
到目前为止我检查过的:
engdados环境激活了吗?是的
Pendulum 是否安装在 Anaconda 环境中?是的
Anaconda 显示的 Pendulum 版本与 conda list (1.4.4) 中显示的版本不同。为什么?
我不知道发生了什么。提前致谢。

最佳答案

在钟摆版本 2 中,类 pendulum.Pendulum替换为 pendulum.DateTime .
您的 Airflow 版本期望摆锤 1.x,但您的环境有 2.x。
您可以通过创建新环境并安装airflow 2.0(使用pendulum 2.x)来解决此问题。如果您必须使用 Airflow < 2.0,则需要将摆锤固定到 < 2.0(例如使用 pip 约束)。

关于 Airflow initdb : cannot import name 'Pendulum' from 'pendulum' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65363235/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com