gpt4 book ai didi

python - 在 R 中,即使安装了 Boto3,也没有 Boto3 连接 Athena 时出错

转载 作者:行者123 更新时间:2023-12-04 04:13:18 33 4
gpt4 key购买 nike

我正在尝试从 R 连接到 Athena。在设置“RAthena”和连接之后,我收到了这个错误:

Error: Boto3 is not detected please install boto3 using either: `pip install boto3` in terminal or `install_boto()`.
Alternatively `reticulate::use_python` or `reticulate::use_condaenv` will have to be used if boto3 is in another environment.

因此,通过使用 pip install,我在 Python 2 和 Python 3 中安装了 boto3

Requirement already up-to-date: boto3 in ./Library/Python/2.7/lib/python/site-packages (1.12.39)
Requirement already satisfied: boto3 in ./Library/Python/3.7/lib/python/site-packages (1.12.39)

但在 R 中,我仍然有同样的错误。然后我尝试在 R 中使用 install_boto()。它告诉我做如下:

Installation complete. Please restart R.

然后我将永远停留在这个Restarting R session... 输出中,永远不会看到任何成功重启的提示。最后,R 仍然无法检测到 boto3

最佳答案

很遗憾听到您对 RAthena 包有疑问。你能告诉我你运行的是什么版本的包吗?

您是否尝试过通过 reticulate 设置您正在使用的 python?例如:

library(DBI)

# specifying python conda environment
reticulate::use_condaenv("RAthena")

# Or specifying python virtual enviroment
reticulate::use_virtualenv("RAthena")

con <- dbConnect(RAthena::athena())

你还可以检查是否安装了 numpy,我记得如果 numpy 是其中的一部分,reticulate 可以更好地绑定(bind)到 python 环境。

或者您可以使用 noctua . noctua 的工作原理与 RAthena 完全相同,但它使用 R 的 paws 包而不是使用 python 的 boto3

如果您仍在苦苦挣扎,我可以在 Github 上将其作为问题提出。我以为我已经通过将 numpy 添加到安装函数 install_boto 来解决这个问题,但是我很高兴重新打开这个问题。

关于python - 在 R 中,即使安装了 Boto3,也没有 Boto3 连接 Athena 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61256653/

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