Open AlphaScorpii-dev opened 2 years ago
I was having some trouble reproing this, but I finally did hit the freeze you mentioned here. Will investigate :)
If you need any more info about my environment, please let me know. It's perhaps not really common (using a miniforge install and all), so I don't know if this issue occurs often or not :/
Thank you 😄 The bug actually repros in non-conda environments too, it seems to be an issue with the way PTVS invokes IPython interactive mode. I don't believe we changed anything in this code though, and you mentioned you had the same problem in VS2019, so it sounds like this has been broken for some time. I'm looking into it
Adding some investigation notes here:
When committing a command in the interactive window, the file that gets executed is C:\Users\<userName>\AppData\Local\Microsoft\VisualStudio\<expHive>\Extensions\Microsoft Corporation\Python\17.0.0\ptvsd_repl_launcher.py
. The argument that specifies IPython interactive mode is --execution-mode=ptvsd.repl.ipython.IPythonBackend
Setting the _PTVS_DEBUG_REPL
environment variable to anything before launching this file will run in a separate window, so you can see more detailed debug output.
Some polymorphism is done based on the backend type (which is what the execution-mode argument specifies). For IPython mode, backend.execution_loop()
ends up calling execution_loop()
from the following file: C:\Users\<userName>\AppData\Local\Microsoft\VisualStudio\<expHive>\Extensions\Microsoft Corporation\Python\17.0.0\ptvsd\repl\jupyter_client.py
There's some threading errors in this file that seem to be caused by newer versions of python and/or jupyter. I spoke with Steve Dower about them and he mentioned that this file probably needs to be re-written to use normal async calls from the main thread instead of spinning up so many other threads.
Also, internal docs for how to debug the repl window are at https://microsoft.sharepoint.com/teams/python/_layouts/15/Doc.aspx?sourcedoc={30d33826-9f98-4d3e-890e-b7d198bbbcbe}&action=edit&wd=target%28Python%20VS%2FDev%20Docs.one%7Cd7206ce2-cf40-437b-8ce9-1e55f4bc2f44%2FDebug%20Python%20Interactive%20%28REPL%5C%29%20Window%7Ce793aeb1-1342-4fee-8f48-7bccf82cdbbc%2F%29&wdorigin=703
Same happens to me, whatever environment and python instance I choose, the execution with "IPython" always freeze. Also, the prompt window doesn't really look like Python interactive (as here https://github.com/microsoft/PTVS/issues/7219#issuecomment-1319437617). Does this feature work at all?
@AdamYoblick thanks for the prior investigation! Is there a chance we are having it addressed? I am selecting the workflow, and VS + Python appears to be applicable, if we can get this working.
Describe the bug When I run an interactive window using IPython, it always ends up freezing. The default interactive window works fine on the other hand.
Steps to Reproduce
Expected behavior The IPython kernel should be able to run in the interactive window.
Additional context and screenshots I have no error displayed at all, just a hung interpreter.
Configuration information (If you are providing a diagnostics file (see below), skip this section) Microsoft Visual Studio Professional 2022 Version 17.3.0 VisualStudio.17.Release/17.3.0+32804.467 Python - Profiling support 17.0.22179.3 Python with Pylance 17.0.22179.3
** Python environment Tried with Python 3.8, 3.9, 3.10, always same issue. ipykernel == 6.15.1 ipython == 8.4.0