You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Distutils was removed from the standard library in python 3.12. Environments created under 3.12 no longer contain setuptools by default. Distutils itself is also deprecated.
There's a few usages of distutils in the sagemaker python sdk. They are easily replaced by shutil. I do see a comment in sagemaker.workflow._repack_model about not wanting to use shutil. But with the dirs_exist_ok=True parameter added in python 3.8, it wouldn't fail on existing directories. So all supported python versions now have an alternative.
# distutils.dir_util.copy_tree works way better than the half-baked
# shutil.copytree which bombs on previously existing target dirs...
# alas ... https://bugs.python.org/issue10948
# we'll go ahead and use the copy_tree function anyways because this
# repacking is some short-lived hackery, right??
fromdistutils.dir_utilimportcopy_tree
git grep -e distutils
.pylintrc:ignored-modules=distutils
src/sagemaker/local/image.py:from distutils.spawn import find_executable
src/sagemaker/local/utils.py:from distutils.dir_util import copy_tree
src/sagemaker/local/utils.py: """A wrapper around distutils.dir_util.copy_tree.src/sagemaker/workflow/_repack_model.py:# distutils.dir_util.copy_tree works way better than the half-bakedsrc/sagemaker/workflow/_repack_model.py:from distutils.dir_util import copy_treetests/data/_repack_model.py:# distutils.dir_util.copy_tree works way better than the half-bakedtests/data/_repack_model.py:from distutils.dir_util import copy_treetests/unit/test_chainer.py:from distutils.util import strtobool
I'll submit a PR to remove the deprecated calls in the source.
To reproduce
A clear, step-by-step set of instructions to reproduce the bug.
The provided code need to be complete and runnable, if additional data is needed, please include them in the issue.
# No setuptools installed by default
python3.12 -m venv
# or virtualenv venv --py 3.12. venv/bin/activate
# Install from current master
python -m pip install -e .[local]
python -c 'import sagemaker.local.image'
...
from distutils.spawn import find_executable
ModuleNotFoundError: No module named 'distutils'
Expected behavior
Imports do not fail.
Screenshots or logs
If applicable, add screenshots or logs to help explain your problem.
System information
A description of your system. Please provide:
SageMaker Python SDK version: master
Framework name (eg. PyTorch) or algorithm (eg. KMeans): n/a
Framework version: n/a
Python version: 3.12
CPU or GPU: cpu
Custom Docker image (Y/N): n
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Describe the bug
Distutils was removed from the standard library in python 3.12. Environments created under 3.12 no longer contain setuptools by default. Distutils itself is also deprecated.
There's a few usages of distutils in the sagemaker python sdk. They are easily replaced by shutil. I do see a comment in
sagemaker.workflow._repack_model
about not wanting to use shutil. But with thedirs_exist_ok=True
parameter added in python 3.8, it wouldn't fail on existing directories. So all supported python versions now have an alternative.sagemaker-python-sdk/src/sagemaker/workflow/_repack_model.py
Lines 30 to 35 in e163807
I'll submit a PR to remove the deprecated calls in the source.
To reproduce
A clear, step-by-step set of instructions to reproduce the bug.
The provided code need to be complete and runnable, if additional data is needed, please include them in the issue.
Expected behavior
Imports do not fail.
Screenshots or logs
If applicable, add screenshots or logs to help explain your problem.
System information
A description of your system. Please provide:
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: