step_functions_mlworkflow_scikit_learn_data_processing_and_model_evaluation.ipynb cannot import name 'get_image_uri'
https://github.com/awslabs/amazon-sagemaker-examples/blob/master/step-functions-data-science-sdk/step_functions_mlworkflow_processing/step_functions_mlworkflow_scikit_learn_data_processing_and_model_evaluation.ipynb
ImportError: cannot import name 'get_image_uri'
@dhawalkp
It's possible that you're using SM SDK 2, where as the tutorial seems to have been written for SM 1.x. Updating your code: https://sagemaker.readthedocs.io/en/stable/v2.html#image-uri-functions-e-g-get-image-uri or downgrading your SM SDK version should prevent the issue. The author should add a stronger condition for the SDK version when importing.
Hi @aaronmarkham, @shashankprasanna is correct! This tutorial is written for SM 1.x SDK. For time being, please change the code in the first code cell to below to make it more restrictive -
!{sys.executable} -m pip install -qU awscli boto3 "sagemaker>=1.71.0,<2.0.0"
I will check-in the code meanwhile with this change
Hi, I changed the code into !pip install -qU awscli boto3 sagemaker>=1.71.0,<2.0.0,
but it still says ImportError: cannot import name 'get_image_uri'
I'm running the Object Detection using Managed Spot Training.
Try getting rid of the -qU so you can see what is happening. Also, try restarting your kernel after the installation/rollback is successful.
I have some rollback code over here: #1570
@ElaineYao I had the same issue and just stuck with pip install 'sagemaker<=1.71.0' and it's now moved past the error you're showing. HTH.
Hi @ElaineYao:
I encountered the exact error this week in my SageMaker Studio a different notebook and was able to fix it by executing the following to downgrade my SageMaker SDK version to match the legacy code:
import sys
!{sys.executable} -m pip install -qU awscli boto3 "sagemaker>=1.71.0,<2.0.0"
Closing as the notebook was pinned to a SDKv1 so it should work. There is however another issue out to upgrade these notebooks: https://github.com/aws/amazon-sagemaker-examples/issues/1568