Skip to content

Python host constantly loosing Terminal connection on Mac OS Silicon M1 since Version 1.93.1 #246204

Closed

Description

@stanw1

Does this issue occur when all extensions are disabled?: Yes but the Python extensions which are required: Pylance, Python, Python Debugger

  • VS Code Version: 1.93.1 to 1.99.1
  • OS Version: Mac OS 15.1, Apple Silicon version, zsh terminal

Steps to Reproduce:

  1. Select large chunk of python code (including "import" statements)
  2. Use Shift + Enter to execute

=> the code starts to execute, but as soon as there are more time costly functions (after several seconds) the connection the the terminal is lost (Pty host lights up in yellow at the bottom of the screen).

The Issue started some time ago, and the only solution for me was to downgrade (to 1.92.2). It happened again now after the update to 1.99.1. I googled and chatGPTied and tried multiple fixes, but none works so far.

Activity

  1. stanw1 commented on Apr 25, 2025

    @stanw1
    Author

    Any updates yet? Was it possible to reproduce the issue?

  2. radders1981 commented on Apr 29, 2025

    @radders1981

    I am facing the same issue. Is there any update?

    Same issue listed here: https://stackoverflow.com/questions/79507886/macos-pty-host-disconnected-vs-code

  3. anthonykim1 commented on May 6, 2025

    @anthonykim1
    Contributor

    Hi folks, are people able to repro outside of VS Code terminal?
    I wonder what happens if you try to run the same thing in external terminal with Python.
    Also which version of Python are people using?

  4. stanw1 commented on May 6, 2025

    @stanw1
    Author

    Hi folks, are people able to repro outside of VS Code terminal? I wonder what happens if you try to run the same thing in external terminal with Python. Also which version of Python are people using?

    I am using conda and tried it both with a python 3.10 and 3.12 environment. As I said downgrading Vscode solves the issue without any changes to the python conda environment or to the osx terminal, so in my view it must be an issue with the current vscode or the python/pylance plugin versions.

  5. anthonykim1 commented on May 7, 2025

    @anthonykim1
    Contributor

    stanw1
    Does behavior change depending on Python extension version or just VS Code version.

    It seems like vscode issue.

    it would help to know which change caused it. We maintain a node.js based CLI tool vscode-bisect that automatically downloads and runs previous VS Code insiders and asks for each build if the issue reproduces. It takes up to 8 steps to find exactly the build that caused the regression.

    Steps:

    install node.js (if not yet done)
    npx --yes @vscode/vscode-bisect@latest
    follow the instructions until you found the offending build (its fine to leave the commit empty)
    report back the commit range in this issue

  6. radders1981 commented on May 19, 2025

    @radders1981

    I tried to run this, but the tool will only allow testing between versions 1.96 and 1.99. All builds demonstrated the error above.

    I downloaded the various insiders builds manually.

    1.92 - indentation errors reported (SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xe2 in position 14: invalid continuation byte). This error is reported at exactly the same line in the code that versions 1.96-1.99 failed, albeit the failure was reported differently - 1.96-1.99 would just freeze and show the Pty disconnect. In 1.92 the code would fail to run with the error mentioned here.
    1.93 - same issue as 1.96-1.99.
    I tried on 1.88 - the same scenario as 1.92.
    I couldn't find any older versions of vscode insiders that would download and open to test further.

    If it helps, I am running python from pyenv - 3.12.7.

    For what it's worth, I tried using python 3.13.0 - all the above problems were resolved in the latest, non insiders build. There is a new oddity that sometimes you need to press enter inside the terminal to get the code to run, other times it's not needed.

  7. maifeng commented on May 30, 2025

    @maifeng

    I have the same issue on M1 Max. An older version (1.85.2) of VSCode does not have this issue.
    I only run into this issue when running code locally. Remote SSH development works fine.

  8. stanw1 commented on May 30, 2025

    @stanw1
    Author

    I don‘t quite understand, why this issue does not seem to get much priority. MacOs is probably the second largest user base of VScode and python probably among the top scripting/programming languages. How come this issue now persists for like a year, release after release?

  9. Abner-01 commented on Jun 3, 2025

    @Abner-01

    I have the same issue on M3 Max. The "solution" I found is first to run the imports, and then run the actual code. It is strange. I have the 1.100.2 Universal version.

  10. radders1981 commented on Jun 3, 2025

    @radders1981

    I have the same issue on M3 Max. The "solution" I found is first to run the imports, and then run the actual code. It is strange. I have the 1.100.2 Universal version.

    This works for me intermittently. I can run short snippets like the inserts, but whenever a longer snippet is run (say 50 lines) then it reverts back to freezing again.

  11. Jintram commented on Jun 11, 2025

    @Jintram

    I have the same issue.

    Here a movie of the issue:

    vscode_bug_example.mov

    Description of the movie:
    Everything seems to work fine, until I select the last chunk of code and use SHIFT+ENTER. Then the system freezes, the "pty host" button starts flashing, and after clicking it it says "Restarting the terminal because the connection to the shell process was lost".
    This isn't specific to this code, and typically happens if I select larger pieces of code, and is especially frequent when I use matplotlib or seaborn to create more complex plots (e.g. 20 lines of code related to 1 figure).
    It doesn't seem to be related to the size of the code chunk selected, but more to what happens in the code. For example, when I have a chunk of code that generates a figure, and causes this behavior, when I put the code in a function, and send the function definition to the terminal using SHIFT+ENTER, there isn't an issue, and I can even call that function, without this issue occuring.

    My system is:
    Apple M4 Max, 36 GB memory
    MacOS Sequoia 15.5 (24F74)

    My VS Code version:
    Experienced the issue both in:

    Version: 1.95.2 (Universal)
    Commit: e8653663e8840adaf45af01eab5c627a5af81807
    Date: 2024-11-07T11:07:22.054Z (7 mos ago)
    

    And:

    Version: 1.100.3 (Universal)
    Commit: 258e40fedc6cb8edf399a463ce3a9d32e7e1f6f3
    Date: 2025-06-02T13:30:54.273Z (1 wk ago)
    

    Extensions:
    Pylance, Python, Python Debugger
    (I have more installed, but disabled those, and still got this behavior.)

    I experienced this before, but then it disappeared for a while (I initially thought this was related to switching to ipython), and reappeared a few days ago. I am not aware of any changes to my system that has caused the re-appearance. It both occurs using ipython and python in the terminal.

    Many thanks for any potential efforts to solve this, it's a very frustrating issue.

  12. maifeng commented on Jun 30, 2025

    @maifeng

    A workaround I found is to use tmux as the integrated terminal (rather than the default zsh). Assuming tmux is installed, add to settings.json

    "terminal.integrated.defaultProfile.osx": "tmux",

    Screen.Recording.2025-06-30.at.1.54.47.PM.mov
  13. 33 remaining items

  14. added
    insiders-releasedPatch has been released in VS Code Insiders
    and removed
    unreleasedPatch has not yet been released in VS Code Insiders
    on Dec 16, 2025
  15. std4453 commented on Dec 17, 2025

    @std4453

    Daniel Imms (@Tyriar) thanks for the fix, is there a date of it landing on the Insiders channel? I could help test this and verify that it's fixed.

  16. std4453 commented on Dec 17, 2025

    @std4453

    Daniel Imms (@Tyriar) I updated to the latest version of insiders and I can verify that this problem was fixed.

  17. Tyriar commented on Dec 18, 2025

    @Tyriar
    Contributor

    std4453 (@std4453) that's great, thanks for verifying!

  18. stanw1 commented on Dec 19, 2025

    @stanw1
    Author

    Thanks a lot for the fix!

  19. Jintram commented on Dec 19, 2025

    @Jintram

    Indeed, many thanks for fixing!

  20. added a commit that references this issue on Dec 19, 2025
  21. lmBored commented on Dec 30, 2025

    @lmBored

    Do we have an estimate for when this will be released in the stable channel?

  22. Tyriar commented on Dec 31, 2025

    @Tyriar
    Contributor

    Khoi (@lmBored) I believe we're planning a release early January. Btw I would have responded earlier but couldn't tell there's an L in your name on mobile.

  23. lmBored commented on Dec 31, 2025

    @lmBored

    Daniel Imms (@Tyriar) Thanks a lot - now I know when to expect to update vscode, replying in 1 day is pretty quick already imo! And I use an L as the username with an I was taken when I first make the account XD

  24. locked and limited conversation to collaborators on Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

author-verification-requestedIssues potentially verifiable by issue authorbugIssue identified by VS Code Team member as probable bugfreeze-slow-crash-leakVS Code crashing, performance, freeze and memory leak issuesinsiders-releasedPatch has been released in VS Code InsidersmacosIssues with VS Code on MAC/OS Xterminal-processProblems launching processes, managing ptys, exiting, process leaks, etc.verifiedVerification succeeded

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions