ModelBuilder import issues in a SageMaker Studio Notebook
Issue
Hello,
I'm trying to update from SageMaker v2 --> v3, and have had issues with importing the ModelBuilder module. I'm trying to follow this documentation: https://github.com/aws/sagemaker-python-sdk/blob/master/v3-examples/ml-ops-examples/v3-pipeline-train-create-registry.ipynb
The error received when importing the ModelBuilder module:
ModuleNotFoundError: No module named 'sagemaker.serve.spec'
Repro steps
- Start a SageMaker Studio Jupyter Notebook
- Install the latest SageMaker v3.1.0 from github directly:
!pip install git+https://github.com/aws/[email protected] - Import the module:
from sagemaker.serve.model_builder import ModelBuilder
Screenshot
Saw same issue when I tried to:
from sagemaker.mlops.workflow.pipeline import Pipeline
I had:
sagemaker-core 2.1.0
sagemaker-train 1.1.0
sagemaker-serve 1.1.0
sagemaker-mlops 1.1.0
...which seemed to be the most recent available versions of each one.
For now I seem to have it working by un+re-installing all the packages ignoring pip's cache:
%pip uninstall -y sagemaker sagemaker-core sagemaker-train sagemaker-serve sagemaker-mlops
%pip install --no-cache-dir sagemaker-core sagemaker-train sagemaker-serve sagemaker-mlops 'sagemaker>=3'
...But it'd be great to understand why exactly this occurs and what the minimal sensible commands are to install SMPySDK v3+ on SageMaker Studio.