You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python host constantly loosing Terminal connection on Mac OS Silicon M1 since Version 1.93.1 #246204
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:
Select large chunk of python code (including "import" statements)
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.
Reacted by Feng Mai, Doug Ludlow, Oscar Green, htc, Tolu Adepoju, Insighttful, serena_verdi and Rafaël Jafferali
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?
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.
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
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.
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.
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?
Reacted by Abner, Shoaib Hussain, Insighttful and Oscar Green
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.
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.
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)
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.
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.
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
Activity
stanw1 commentedon Apr 25, 2025
Any updates yet? Was it possible to reproduce the issue?
radders1981 commentedon Apr 29, 2025
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
anthonykim1 commentedon May 6, 2025
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?
stanw1 commentedon May 6, 2025
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.
anthonykim1 commentedon May 7, 2025
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
radders1981 commentedon May 19, 2025
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.
maifeng commentedon May 30, 2025
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.
stanw1 commentedon May 30, 2025
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?
Abner-01 commentedon Jun 3, 2025
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.
radders1981 commentedon Jun 3, 2025
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.
Jintram commentedon Jun 11, 2025
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:
And:
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.
maifeng commentedon Jun 30, 2025
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
33 remaining items
std4453 commentedon Dec 17, 2025
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.
std4453 commentedon Dec 17, 2025
Daniel Imms (@Tyriar) I updated to the latest version of insiders and I can verify that this problem was fixed.
Tyriar commentedon Dec 18, 2025
std4453 (@std4453) that's great, thanks for verifying!
stanw1 commentedon Dec 19, 2025
Thanks a lot for the fix!
Jintram commentedon Dec 19, 2025
Indeed, many thanks for fixing!
node-pty@1.1.0-beta43
lmBored commentedon Dec 30, 2025
Do we have an estimate for when this will be released in the stable channel?
Tyriar commentedon Dec 31, 2025
Khoi (@lmBored) I believe we're planning a release early January. Btw I would have responded earlier but couldn't tell there's an
Lin your name on mobile.lmBored commentedon Dec 31, 2025
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
Las the username with anIwas taken when I first make the account XD