Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

_python_version in coremltools/models/utils.py doesn't handle RCs and other possible versions

Open Beginner friendly
#2,874 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 5 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
86/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start in coremltools/models/utils.py at _python_version and reproduce with Python 3.15.0rc2. Run the listed tests, especially test/ml_program/experimental/test_perf_utils.py and converters/mil/frontend/torch/test/test_torch_ops.py. Done means prerelease versions no longer raise during version checks and the affected tests pass.

Written by the indexing model from the issue text.

Description

bug

🐞Describing the bug

When using with a python pre-release such as 3.15.0rc2 the _python_version function errors out because it's only expecting integers.

Stack Trace

ValueError: invalid literal for int() with base 10: '0rc2'

Check import: coremltools.converters.mil.frontend.milproto.test_load
Traceback (most recent call last):
  File "/usr/lib/rpm/redhat/import_all_modules.py", line 106, in import_modules
    importlib.import_module(module)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "/usr/lib64/python3.15/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1390, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1350, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1309, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 915, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 747, in exec_module
  File "<frozen importlib._bootstrap>", line 549, in _call_with_frames_removed
  File "/builddir/build/BUILD/python-coremltools-9.0-build/BUILDROOT/usr/lib/python3.15/site-packages/coremltools/converters/mil/frontend/milproto/test_load.py", line 34, in <module>
    from coremltools.converters.mil.frontend.torch.test.test_torch_ops import TestScriptedModels
  File "/builddir/build/BUILD/python-coremltools-9.0-build/BUILDROOT/usr/lib/python3.15/site-packages/coremltools/converters/mil/frontend/torch/test/test_torch_ops.py", line 7394, in <module>
    class TestSlice(TorchBaseTest):
    ...<70 lines>...
            )
  File "/builddir/build/BUILD/python-coremltools-9.0-build/BUILDROOT/usr/lib/python3.15/site-packages/coremltools/converters/mil/frontend/torch/test/test_torch_ops.py", line 7414, in TestSlice
    @pytest.mark.skipif(_python_version() < (3, 6), reason="requires python 3.6")
                        ~~~~~~~~~~~~~~~^^
  File "/builddir/build/BUILD/python-coremltools-9.0-build/BUILDROOT/usr/lib/python3.15/site-packages/coremltools/models/utils.py", line 979, in _python_version
    version = list(map(int, list(version.split("."))))
ValueError: invalid literal for int() with base 10: '0rc2'

To Reproduce

  • Please add a minimal code example that can reproduce the error when running it.

The following tests in coremltools use the _python_version, running them with a python RC release such as 3.15rc2 should be enough to reproduce this.

coremltools/test/ml_program/experimental/test_perf_utils.py
coremltools/test/ml_program/experimental/test_perf_utils.py
coremltools/converters/mil/frontend/torch/test/test_torch_conversion_api.py
coremltools/converters/mil/frontend/torch/test/test_torch_ops.py
coremltools/converters/mil/frontend/torch/test/test_torch_ops.py
  • If the model conversion succeeds, but there is a numerical mismatch in predictions, please include the code used for comparisons.

N/A

System environment (please complete the following information):

  • coremltools version: 9.0
  • OS (e.g. MacOS version or Linux type): Fedora 45 Beta
  • Any other relevant version information (e.g. PyTorch or TensorFlow version): Python 3.15.0rc2

Additional context

  • Add anything else about the problem here that you want to share.
Dominant language
Python
Stars
5.4k
Forks
852
Avg merge
8d 2h
Merged PRs (30d)
8

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apple/coremltools

All issues in apple/coremltools

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.