aws / amazon-sagemaker-examples

Example 📓 Jupyter notebooks that demonstrate how to build, train, and deploy machine learning models using 🧠 Amazon SageMaker.
https://sagemaker-examples.readthedocs.io
Apache License 2.0
9.98k stars 6.73k forks source link

UnknownServiceError on HyperparameterTuningJobAnalytics #718

Open Heronalps opened 5 years ago

Heronalps commented 5 years ago

In the HPO_Analyze_TuningJob_Results.ipynb, the constructor of tuner returns UnknownServiceError. Based on the stack strace, it's related to the Session() constructor. Please investigate. Thank you!

tuner = sagemaker.analytics.HyperparameterTuningJobAnalytics(tuning_job_name)

UnknownServiceError                       Traceback (most recent call last)
<ipython-input-26-f5dcb168cae5> in <module>
----> 1 print (sagemaker.Session())

~/miniconda3/lib/python3.6/site-packages/sagemaker/session.py in __init__(self, boto_session, sagemaker_client, sagemaker_runtime_client)
     88             self.config = None
     89 
---> 90         self._initialize(boto_session, sagemaker_client, sagemaker_runtime_client)
     91 
     92     def _initialize(self, boto_session, sagemaker_client, sagemaker_runtime_client):

~/miniconda3/lib/python3.6/site-packages/sagemaker/session.py in _initialize(self, boto_session, sagemaker_client, sagemaker_runtime_client)
    109         else:
    110             config = botocore.config.Config(read_timeout=80)
--> 111             self.sagemaker_runtime_client = self.boto_session.client('runtime.sagemaker', config=config)
    112 
    113         prepend_user_agent(self.sagemaker_runtime_client)

~/miniconda3/lib/python3.6/site-packages/boto3/session.py in client(self, service_name, region_name, api_version, use_ssl, verify, endpoint_url, aws_access_key_id, aws_secret_access_key, aws_session_token, config)
    261             aws_access_key_id=aws_access_key_id,
    262             aws_secret_access_key=aws_secret_access_key,
--> 263             aws_session_token=aws_session_token, config=config)
    264 
    265     def resource(self, service_name, region_name=None, api_version=None,

~/miniconda3/lib/python3.6/site-packages/botocore/session.py in create_client(self, service_name, region_name, api_version, use_ssl, verify, endpoint_url, aws_access_key_id, aws_secret_access_key, aws_session_token, config)
    834         client = client_creator.create_client(
    835             service_name=service_name, region_name=region_name,
--> 836             is_secure=use_ssl, endpoint_url=endpoint_url, verify=verify,
    837             credentials=credentials, scoped_config=self.get_scoped_config(),
    838             client_config=config, api_version=api_version)

~/miniconda3/lib/python3.6/site-packages/botocore/client.py in create_client(self, service_name, region_name, is_secure, endpoint_url, verify, credentials, scoped_config, api_version, client_config)
     62         self._retry_config_translator = retry_config_translator
     63         self._response_parser_factory = response_parser_factory
---> 64         self._exceptions_factory = exceptions_factory
     65         # TODO: Migrate things away from scoped_config in favor of the
     66         # config_store.  The config store can pull things from both the scoped

~/miniconda3/lib/python3.6/site-packages/botocore/client.py in _load_service_model(self, service_name, api_version)
     94         )
     95         return service_client
---> 96 
     97     def create_client_class(self, service_name, api_version=None):
     98         service_model = self._load_service_model(service_name, api_version)

~/miniconda3/lib/python3.6/site-packages/botocore/loaders.py in _wrapper(self, *args, **kwargs)
    130         if key in self._cache:
    131             return self._cache[key]
--> 132         data = func(self, *args, **kwargs)
    133         self._cache[key] = data
    134         return data

~/miniconda3/lib/python3.6/site-packages/botocore/loaders.py in load_service_model(self, service_name, type_name, api_version)
    376             raise UnknownServiceError(
    377                 service_name=service_name,
--> 378                 known_service_names=', '.join(sorted(known_services)))
    379         if api_version is None:
    380             api_version = self.determine_latest_version(

UnknownServiceError: Unknown service: 'runtime.sagemaker'. Valid service names are: acm, acm-pca, alexaforbusiness, amplify, apigateway, apigatewaymanagementapi, apigatewayv2, application-autoscaling, appmesh, appstream, appsync, athena, autoscaling, autoscaling-plans, backup, batch, budgets, ce, chime, cloud9, clouddirectory, cloudformation, cloudfront, cloudhsm, cloudhsmv2, cloudsearch, cloudsearchdomain, cloudtrail, cloudwatch, codebuild, codecommit, codedeploy, codepipeline, codestar, cognito-identity, cognito-idp, cognito-sync, comprehend, comprehendmedical, config, connect, cur, datapipeline, datasync, dax, devicefarm, directconnect, discovery, dlm, dms, docdb, ds, dynamodb, dynamodbstreams, ec2, ecr, ecs, efs, eks, elasticache, elasticbeanstalk, elastictranscoder, elb, elbv2, emr, es, events, firehose, fms, fsx, gamelift, glacier, globalaccelerator, glue, greengrass, guardduty, health, iam, importexport, inspector, iot, iot-data, iot-jobs-data, iot1click-devices, iot1click-projects, iotanalytics, kafka, kinesis, kinesis-video-archived-media, kinesis-video-media, kinesisanalytics, kinesisanalyticsv2, kinesisvideo, kms, lambda, lex-models, lex-runtime, license-manager, lightsail, logs, machinelearning, macie, marketplace-entitlement, marketplacecommerceanalytics, mediaconnect, mediaconvert, medialive, mediapackage, mediastore, mediastore-data, mediatailor, meteringmarketplace, mgh, mobile, mq, mturk, neptune, opsworks, opsworkscm, organizations, pi, pinpoint, pinpoint-email, pinpoint-sms-voice, polly, pricing, quicksight, ram, rds, rds-data, redshift, rekognition, resource-groups, resourcegroupstaggingapi, robomaker, route53, route53domains, route53resolver, s3, s3control, sagemaker, sagemaker-runtime, sdb, secretsmanager, securityhub, serverlessrepo, servicecatalog, servicediscovery, ses, shield, signer, sms, sms-voice, snowball, sns, sqs, ssm, stepfunctions, storagegateway, sts, support, swf, textract, transcribe, transfer, translate, waf, waf-regional, workdocs, worklink, workmail, workspaces, xray
orchidmajumder commented 5 years ago

Hi @Heronalps , we responded to your question with some more information here - https://github.com/aws/sagemaker-python-sdk/issues/747. If you are using a SageMaker notebook instance, restarting the instance will also solve this problem. If you are using it in your local setup, then please re-install or update the installation of Boto3. Let us know if you still face the same issue.