Skip to content

Raise ImportError on Python 3.14 or later#3855

Merged
r4victor merged 1 commit intomasterfrom
pr_error_for_python_3_14
May 6, 2026
Merged

Raise ImportError on Python 3.14 or later#3855
r4victor merged 1 commit intomasterfrom
pr_error_for_python_3_14

Conversation

@r4victor
Copy link
Copy Markdown
Collaborator

@r4victor r4victor commented May 6, 2026

Fixes #3854

Currently dstack is guaranteed NOT to work on Python 3.14 due to Pydantic V1 dependency (#1844). But the installation is allowed and there are no explicit errors or warnings which leads to unexpected behavior. For example, I get segfaults on macOS:

dstack --help
[1]    67172 segmentation fault  dstack --help

The solution is to error when running/importing dstack:

dstack --help
Traceback (most recent call last):
  File "/Users/r4victor/Projects/dstack/dstack/venv314/bin/dstack", line 4, in <module>
    from dstack._internal.cli.main import main
  File "/Users/r4victor/Projects/dstack/dstack/src/dstack/__init__.py", line 4, in <module>
    raise ImportError("dstack does not support Python 3.14 or later. Please use Python 3.10–3.13.")
ImportError: dstack does not support Python 3.14 or later. Please use Python 3.10–3.13

ImportError is common in the case of Python version incompatibility so that dependent packages can handle the error if they want. CLI just prints ImportError traceback for simplicity – we could show pretty error but it would require having a separate entry point for dstack executable so that it does not import from dstack.

Specifying an upper cap like requires-python = ">=3.10, <3.14" is not an option since it would make pip backtrack to find the earliest version without the cap. uv just ignores the upper cap.

@r4victor r4victor requested review from jvstme and un-def May 6, 2026 07:09
@r4victor r4victor merged commit 72eeafb into master May 6, 2026
25 checks passed
@r4victor r4victor deleted the pr_error_for_python_3_14 branch May 6, 2026 08:48
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 this pull request may close these issues.

[Bug]: Volume Creation fails with python 3.14

3 participants