Skip to content

Python 3.14 sort is broken due to import #479

Closed

Description

@dlroy88osu

ImportError: cannot import name 'Str' from 'ast' (C:\Users\SOMEUSER\AppData\Local\Programs\Python\Python314\Lib\ast.py)

2025-10-12 16:02:59.162 [info] [Error - 4:02:59 PM] Server initialization failed.
2025-10-12 16:02:59.162 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2025-10-12 16:02:59.162 [info] [Error - 4:02:59 PM] The isort server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
2025-10-12 16:02:59.162 [info] [Error - 4:02:59 PM] isort client: couldn't create connection to server.
2025-10-12 16:02:59.162 [info] Message: Pending response rejected since connection got disposed
Code: -32097
2025-10-12 16:02:59.163 [info] [Error - 4:02:59 PM] Restarting server failed
2025-10-12 16:02:59.163 [info] Message: Pending response rejected since connection got disposed
Code: -32097

Activity

  1. added
    bugIssue identified by VS Code Team member as probable bug
    on Oct 12, 2025
  2. dancollins commented on Nov 9, 2025

    @dancollins

    Similar issue here:

    > python --version 
    Python 3.14.0
    

    And error logs:

    2025-11-10 10:08:29.335 [info] [Error - 10:08:29 AM] Restarting server failed
    2025-11-10 10:08:29.335 [info]   Message: Pending response rejected since connection got disposed
      Code: -32097 
    2025-11-10 10:08:30.299 [info] Traceback (most recent call last):
    
    2025-11-10 10:08:30.299 [info]   File "c:\Users\DanCollins\.windsurf\extensions\ms-python.isort-2023.11.0-dev-universal\bundled\tool\lsp_server.py", line 42, in <module>
        from pygls import server, uris, workspace
      File "c:\Users\DanCollins\.windsurf\extensions\ms-python.isort-2023.11.0-dev-universal\bundled\libs\pygls\server.py", line 27, in <module>
        from pygls.lsp import ConfigCallbackType, ShowDocumentCallbackType
      File "c:\Users\DanCollins\.windsurf\extensions\ms-python.isort-2023.11.0-dev-universal\bundled\libs\pygls\lsp\__init__.py", line 36, in <module>
        from typeguard import check_type
      File "c:\Users\DanCollins\.windsurf\extensions\ms-python.isort-2023.11.0-dev-universal\bundled\libs\typeguard\__init__.py", line 12, in <module>
        from ._decorators import typechecked as typechecked
      File "c:\Users\DanCollins\.windsurf\extensions\ms-python.isort-2023.11.0-dev-universal\bundled\libs\typeguard\_decorators.py", line 13, in <module>
        from ._transformer import TypeguardTransformer
      File "c:\Users\DanCollins\.windsurf\extensions\ms-python.isort-2023.11.0-dev-universal\bundled\libs\typeguard\_transformer.py", line 5, in <module>
        from ast import (
        ...<48 lines>...
        )
    
    2025-11-10 10:08:30.299 [info] ImportError: cannot import name 'Str' from 'ast' (c:\Users\DanCollins\.conda\envs\sbp\Lib\ast.py)
    
    2025-11-10 10:08:30.387 [info] [Error - 10:08:30 AM] Server initialization failed.
    2025-11-10 10:08:30.387 [info]   Message: Pending response rejected since connection got disposed
      Code: -32097 
    2025-11-10 10:08:30.387 [info] [Error - 10:08:30 AM] The isort server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
    2025-11-10 10:08:30.387 [info] [Error - 10:08:30 AM] isort client: couldn't create connection to server.
    2025-11-10 10:08:30.387 [info]   Message: Pending response rejected since connection got disposed
      Code: -32097 
    2025-11-10 10:08:30.387 [info] [Error - 10:08:30 AM] Restarting server failed
    2025-11-10 10:08:30.387 [info]   Message: Pending response rejected since connection got disposed
      Code: -32097
    

    I found ast.Str was deprecated back in Python 3.8, warnings added in Python 3.12 and then removed for Python. 3.14: python/cpython#119563. I also see the docs have a task to be updated: python/cpython#137063

  3. sameerdhoot commented on Nov 20, 2025

    @sameerdhoot

    I have similar issues. Python 3.14.0, OS: Windows 11, IDE: Cursor

  4. monokal commented on Dec 5, 2025

    @monokal

    Confirmed via the ms-python.isort extension for VSCode/Cursor too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue identified by VS Code Team member as probable bugtriage-neededIssue is not triaged.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions