Relative Content

Tag Archive for pythonamazon-sagemakeramazon-sagemaker-studio

Sagemaker Python SDK throws an error with new Studio Jupyter Notebook

Now that we have SageMaker Studio Classic and SageMaker Studio, I am trying to migrate from Classic to the new one having two separate domains. I am also using a custom image, which am trying to adjust to the new guidelines of creating custom SageMaker Studio image. Within that custom image I am using Sagemaker Python SDK. And it seems when I try to run sagemaker.get_execution_role(sagemaker_session=sagemaker_session), it ultimately tries to call the get_caller_identity_arn and it fails with error like ParamValidationError: Parameter validation failed: Invalid type for parameter UserProfileName, value: None, type: <class 'NoneType'>, valid types: <class 'str'>. Which is correct since in new Studio when I launch a space and try to call in terminal cat /opt/ml/metadata/resource-metadata.json I do not receive in the JSON object the UserProfileName which seems to be causing the exception since Sagemaker Python SDK package relies on it. Has anyone faced such issue? Is it a configuration of the domain that uses the new Studio experience that I am missing? Or is there another way to inject this UserProfileName in the resource-metadata.json so that the Sagemaker Python SDK package could properly pick it up?