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

In R, Error for No Boto3 to connect Athena even though Boto3 Installed

我正在尝试从 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 可以更好地绑定到 python 环境。

或者您可以使用 noctuanoctua 的工作方式与 RAthena 完全相同,但它使用 R 的 paws 包而不是 python 的 boto3

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