DyfanJones / RAthena

Connect R to Athena using Boto3 SDK (DBI Interface)
https://dyfanjones.github.io/RAthena/
Other
35 stars 6 forks source link

Error in py_call_impl #159

Closed CerebralMastication closed 2 years ago

CerebralMastication commented 2 years ago

Hey all, just trying to use RAthena for the first time and keep running into issues around Error in py_call_impl(callable, dots$args, dots$keywords): UnknownServiceError: Unknown service: 'glue'.

I'll dig in and do a bit of debugging but I wanted to go ahead and register this issue.

Reprex below:

library(DBI)
library(RAthena)
library(reticulate)

use_condaenv("RAthena")

con <- dbConnect(RAthena::athena(), s3_staging_dir = 's3://my_test_bucket_98b/athena-temp/')
#> Warning: Python '/Users/jal/Library/r-miniconda/envs/RAthena/bin/python' was
#> requested but '/Users/jal/Library/r-miniconda/envs/r-reticulate/bin/python' was
#> loaded instead (see reticulate::py_config() for more information)
#> Error in py_call_impl(callable, dots$args, dots$keywords): UnknownServiceError: Unknown service: 'glue'. Valid service names are: acm, apigateway, application-autoscaling, appstream, athena, autoscaling, batch, budgets, clouddirectory, cloudformation, cloudfront, cloudhsm, cloudsearch, cloudsearchdomain, cloudtrail, cloudwatch, codebuild, codecommit, codedeploy, codepipeline, codestar, cognito-identity, cognito-idp, cognito-sync, config, cur, datapipeline, dax, devicefarm, directconnect, discovery, dms, ds, dynamodb, dynamodbstreams, ec2, ecr, ecs, efs, elasticache, elasticbeanstalk, elastictranscoder, elb, elbv2, emr, es, events, firehose, gamelift, glacier, greengrass, health, iam, importexport, inspector, iot, iot-data, kinesis, kinesisanalytics, kms, lambda, lex-models, lex-runtime, lightsail, logs, machinelearning, marketplace-entitlement, marketplacecommerceanalytics, meteringmarketplace, mturk, opsworks, opsworkscm, organizations, pinpoint, polly, rds, redshift, rekognition, resourcegroupstaggingapi, route53, route53domains, s3, sdb, servicecatalog, ses, shield, sms, snowball, sns, sqs, ssm, stepfunctions, storagegateway, sts, support, swf, waf, waf-regional, workdocs, workspaces, xray
#> 
#> Detailed traceback:
#>   File "/Users/jal/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/boto3/session.py", line 263, in client
#>     aws_session_token=aws_session_token, config=config)
#>   File "/Users/jal/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/botocore/session.py", line 836, in create_client
#>     client_config=config, api_version=api_version)
#>   File "/Users/jal/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/botocore/client.py", line 64, in create_client
#>     service_model = self._load_service_model(service_name, api_version)
#>   File "/Users/jal/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/botocore/client.py", line 96, in _load_service_model
#>     api_version=api_version)
#>   File "/Users/jal/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/botocore/loaders.py", line 132, in _wrapper
#>     data = func(self, *args, **kwargs)
#>   File "/Users/jal/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/botocore/loaders.py", line 378, in load_service_model
#>     known_service_names=', '.join(sorted(known_services)))

Created on 2021-11-19 by the reprex package (v0.3.0)

CerebralMastication commented 2 years ago

It looks like this may be an issue with an outdated version of boto3... https://github.com/boto/boto3/issues/1242

this is odd to me because I just installed boto3

remotes::install_github("dyfanjones/rathena")
RAthena::install_boto(method="conda", envname = "RAthena")
CerebralMastication commented 2 years ago

oh.. the issue is that last bit in the error message:

Python '/Users/jal/Library/r-miniconda/envs/RAthena/bin/python' was requested but '/Users/jal/Library/r-miniconda/envs/r-reticulate/bin/python' was loaded instead (see reticulate::py_config() for more information) 

running reticulate::py_config()

tells me:

python:         /Users/jal/Library/r-miniconda/envs/r-reticulate/bin/python
libpython:      /Users/jal/Library/r-miniconda/envs/r-reticulate/lib/libpython3.6m.dylib
pythonhome:     /Users/jal/Library/r-miniconda/envs/r-reticulate:/Users/jal/Library/r-miniconda/envs/r-reticulate
version:        3.6.13 | packaged by conda-forge | (default, Sep 23 2021, 07:55:15)  [GCC Clang 11.1.0]
numpy:          /Users/jal/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/numpy
numpy_version:  1.19.5

so reticulate is not using the condaenv "RAthena" which I told it to use. So this is an issue with reticulate

I "solved" the problem by doing the boto3 install into the "r-reticulate" environment then using that:

RAthena::install_boto(method="conda", envname = "r-reticulate")

it appears I have both anaconda3 and miniconda installed and god knows what else. Some interplay between those is causing me environment issues.

Obligatory XKCD: