aws / aws/sagemaker-training-toolkit
No support for Python 3.10
- Dominant language
- Python
- Stars
- 530
- Forks
- 140
- Avg merge
- 1h 12m
- Merged PRs (30d)
- 2
Description
The library cannot be used in Python 3.10
Here's the error when trying to run `train` in a SageMaker training image:
```
Traceback (most recent call last):
File "/opt/venv/bin/train", line 5, in
from sagemaker_training.cli.train import main
File "/opt/venv/lib/python3.10/site-packages/sagemaker_training/cli/train.py", line 14, in
from sagemaker_training import trainer
File "/opt/venv/lib/python3.10/site-packages/sagemaker_training/trainer.py", line 23, in
from sagemaker_training import (
File "/opt/venv/lib/python3.10/site-packages/sagemaker_training/entry_point.py", line 24, in
from sagemaker_training import _entry_point_type, environment, files, modules, runner
File "/opt/venv/lib/python3.10/site-packages/sagemaker_training/environment.py", line 32, in
from sagemaker_training import logging_config, mapping, params
File "/opt/venv/lib/python3.10/site-packages/sagemaker_training/mapping.py", line 155, in
class MappingMixin(collections.Mapping):
AttributeError: module 'collections' has no attribute 'Mapping'
```
The offending import gave a warning in Python 3.9
```
Python 3.9.12 (main, Apr 5 2022, 06:56:58)
>>> import collections
>>> collections.Mapping
:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
```
but is an error in Python 3.10
```
Python 3.10.4 (main, Apr 2 2022, 09:04:19)
>>> import collections
>>> collections.Mapping
Traceback (most recent call last):
File "", line 1, in
AttributeError: module 'collections' has no attribute 'Mapping'
```
https://github.com/aws/sagemaker-training-toolkit/blob/v4.1.2/src/sagemaker_training/mapping.py#L155
Contributor guide
Research direction
Start at src/sagemaker_training/mapping.py around line 155, then reproduce the `train` entry point in a Python 3.10 SageMaker training image. Done means the library imports and the training command starts without the reported collections.Mapping error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- cloud, machine-learning
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100