Skip to content

cannot import name 'get_base_python_image_uri' from 'sagemaker.image_uris' (/home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages/sagemaker/image_uris.py) #3815

@KraftZzz

Description

@KraftZzz

I run this code in jupyternotebook:

!pip3 show sagemaker
from sagemaker.remote_function import remote

Name: sagemaker
Version: 2.150.0
Summary: Open source library for training and deploying models on Amazon SageMaker.
Home-page: https://github.com/aws/sagemaker-python-sdk/
Author: Amazon Web Services
Author-email:
License: Apache License 2.0
Location: /home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages
Requires: attrs, boto3, cloudpickle, google-pasta, importlib-metadata, jsonschema, numpy, packaging, pandas, pathos, platformdirs, protobuf, protobuf3-to-dict, PyYAML, schema, smdebug-rulesconfig, tblib
Required-by:

ImportError Traceback (most recent call last)
Cell In[6], line 2
1 get_ipython().system('pip3 show sagemaker')
----> 2 from sagemaker.remote_function import remote

File ~/anaconda3/envs/python3/lib/python3.10/site-packages/sagemaker/remote_function/init.py:16
13 """Defines classes and helper methods used in remote function executions."""
14 from future import absolute_import
---> 16 from sagemaker.remote_function.client import remote, RemoteExecutor # noqa: F401

File ~/anaconda3/envs/python3/lib/python3.10/site-packages/sagemaker/remote_function/client.py:38
36 from sagemaker.session import Session
37 from sagemaker.s3 import s3_path_join
---> 38 from sagemaker.remote_function.job import _JobSettings, _Job, _RunInfo
39 from sagemaker.remote_function import logging_config
40 from sagemaker.utils import name_from_base, base_from_name

File ~/anaconda3/envs/python3/lib/python3.10/site-packages/sagemaker/remote_function/job.py:44
42 from sagemaker.experiments._run_context import _RunContext
43 from sagemaker.experiments.run import Run
---> 44 from sagemaker.image_uris import get_base_python_image_uri
45 from sagemaker.session import get_execution_role, _logs_for_job, Session
46 from sagemaker.utils import name_from_base, _tmpdir, resolve_value_from_config

ImportError: cannot import name 'get_base_python_image_uri' from 'sagemaker.image_uris' (/home/ec2-user/anaconda3/envs/python3/lib/python3.10/site-packages/sagemaker/image_uris.py)

I refer this blog: https://aws.amazon.com/cn/blogs/machine-learning/run-your-local-machine-learning-code-as-amazon-sagemaker-training-jobs-with-minimal-code-changes/, but is not work fine.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions