I am not able to run
from sagemaker.predictor import csv_serializer
Following is the import error I am getting.
ImportError: cannot import name ‘csv_serializer’ from ‘sagemaker.predictor’ (/home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages/sagemaker/predictor.py)
I tried running following command on notebook instance in sagemaker.
!{sys.executable} -m pip install sagemaker==1.72.0 -U
2
Answers
Did you try restarting the kernel after running the pip install command?
Note that
csv_serializer
was deprecated in v2 of the SDK, so updating your usage is the correct long-term solution. See v2 documentation for the new usage.Update the sagemaker to latest version
pip install --upgrade sagemaker
. And then try the following steps to get CSV Serializer.Import the following
Usage
Reference: https://docs.aws.amazon.com/sagemaker/latest/dg/ex1-model-deployment.html