sagemaker-python-sdk icon indicating copy to clipboard operation
sagemaker-python-sdk copied to clipboard

ModelBuilder import issues in a SageMaker Studio Notebook

Open plockxng opened this issue 1 month ago • 1 comments

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

  1. Start a SageMaker Studio Jupyter Notebook
  2. Install the latest SageMaker v3.1.0 from github directly: !pip install git+https://github.com/aws/[email protected]
  3. Import the module: from sagemaker.serve.model_builder import ModelBuilder

Screenshot

Image

plockxng avatar Dec 05 '25 18:12 plockxng

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.

athewsey avatar Dec 10 '25 10:12 athewsey