Search code examples
pythonrboto3amazon-athenapyathena

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


I am trying to connect to Athena from R. After setup 'RAthena' and connection, I got this error:

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.

So by using pip install, I installed boto3 in both Python 2 and Python 3.

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)

But in R, I am still having the same error. Then I tried using install_boto() in R. It tells me to do as follow:

Installation complete. Please restart R.

Then I would stay in this Restarting R session... output forever and never see any note for successful restart. And at the end, R still can't detect boto3.


Solution

  • really sorry to hear you are having issue with the RAthena package. Can you let me know what version of the package you are running.

    Have you tried setting which python you are using through reticulate? For example:

    library(DBI)
    
    # specifying python conda environment
    reticulate::use_condaenv("RAthena")
    
    # Or specifying python virtual enviroment
    reticulate::use_virtualenv("RAthena")
    
    con <- dbConnect(RAthena::athena())
    

    Can you also check if numpy is installed, I remember reticulate can bind to python environments better if numpy is apart of it.

    Alternatively you can use noctua. noctua works exactly the same as RAthena but instead of using python's boto3 it uses R's paws package.

    If you are still struggling I can raise this as an issue on Github. I thought I had resolved this issue by adding numpy to the installation function install_boto, however I am happy to re-open this issue.