Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No support for Python 3.10 #129

Open
peter-wimsey opened this issue May 31, 2022 · 7 comments
Open

No support for Python 3.10 #129

peter-wimsey opened this issue May 31, 2022 · 7 comments

Comments

@peter-wimsey
Copy link

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 <module>
    from sagemaker_training.cli.train import main
  File "/opt/venv/lib/python3.10/site-packages/sagemaker_training/cli/train.py", line 14, in <module>
    from sagemaker_training import trainer
  File "/opt/venv/lib/python3.10/site-packages/sagemaker_training/trainer.py", line 23, in <module>
    from sagemaker_training import (
  File "/opt/venv/lib/python3.10/site-packages/sagemaker_training/entry_point.py", line 24, in <module>
    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 <module>
    from sagemaker_training import logging_config, mapping, params
  File "/opt/venv/lib/python3.10/site-packages/sagemaker_training/mapping.py", line 155, in <module>
    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
<stdin>: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
<class 'collections.abc.Mapping'>

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 "<stdin>", line 1, in <module>
AttributeError: module 'collections' has no attribute 'Mapping'

https://github.com/aws/sagemaker-training-toolkit/blob/v4.1.2/src/sagemaker_training/mapping.py#L155

@satishpasumarthi
Copy link
Collaborator

satishpasumarthi commented May 31, 2022

Hi @peter-wimsey , we usually keep this package in sync with https://github.com/aws/deep-learning-containers/blob/master/available_images.md
When the py3.10 Deep Learning Container images are planned to release, we will update this package to make it compatible with python 3.10. I will keep this issue open to track it.

@dsradecki
Copy link

Will this get resolved? It's blocking us from using sagemaker-training-toolkit as we use python 3.10

@lorenzwalthert
Copy link

@dsradecki maybe try #148? This works for me with Python 3.10.

@lorenzwalthert
Copy link

lorenzwalthert commented Nov 30, 2022

Fixed with #156 I think.

@cmohamma
Copy link

cmohamma commented May 5, 2024

Has there been movement on this? I am blocked on this and may be the deciding factor for me to drop sagemaker altogether.

@schuberng
Copy link

Hi @satishpasumarthi, we are currently upgrading our Python proejct runtime from 3.8 to 3.10, as Python 3.8 is approaching the end of its life. However, we discovered that the current latest version sagemaker-training package is not compatible with Python 3.10. This incompatibility is blocking us from using the sagemaker-training-toolkit with the newer Python version.

Are there any plans to upgrade the sagemaker-training package to be compatible with Python 3.10?

@lorenzwalthert
Copy link

lorenzwalthert commented May 21, 2024

I use the package with Python 3.11 and it works. Not sure if poetry does not check these version restrictions in the metadata but the code runs after #156 was merged and released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants