Skip to content

Initialize Python Interpreter failed #1424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Arebusf21 opened this issue Mar 9, 2025 · 7 comments
Open

Initialize Python Interpreter failed #1424

Arebusf21 opened this issue Mar 9, 2025 · 7 comments
Labels
bug Something isn't working CodeLLDB lldb or vscode-lldb issue debugging

Comments

@Arebusf21
Copy link

Arebusf21 commented Mar 9, 2025

I have a clean install of Swift using the latest Winget Package Manager on Windows 10.
My build of VSCode is 1.98.0
Windows 10 build 19045.
I have installed the latest Swift and CodeLLDB extensions, (CodeLLDB installed by default) from VSCode.
Swift: 2.0.2, CodeLLDB: 1.11.4
I have created a default project using all the defaults, simply prints Hello, world to the terminal.
When I try and run the project, an external terminal window opens up but no output is produced.
I believe this is a similar issue to #309.
If I comment out the lldb.library line in settings.json, I see my output in the Terminal window.

Output Window:

Launching adapter
liblldb: C:\Users\Arebu\AppData\Local\Programs\Swift\Toolchains\6.0.2+Asserts\usr\bin\liblldb.dll
environment: {}
settings: { evaluateForHovers: true, commandCompletions: true }
[ERROR codelldb] Initialize Python interpreter: Error: Fail
Error Message:
error: module importing failed: Traceback (most recent call last):
File "", line 1, in
File "c:\Users/Arebu/.vscode/extensions/vadimcn.vscode-lldb-1.11.4/adapter/scripts\codelldb_init_.py", line 1, in
from .api import evaluate, wrap, unwrap, get_config, create_webview, display_html, debugger_message
File "c:\Users/Arebu/.vscode/extensions/vadimcn.vscode-lldb-1.11.4/adapter/scripts\codelldb\api.py", line 6, in
from . import interface
File "c:\Users/Arebu/.vscode/extensions/vadimcn.vscode-lldb-1.11.4/adapter/scripts\codelldb\interface.py", line 326, in
current_exec_context: lldb.SBExecutionContext | None = None
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

[ERROR codelldb::debug_session] Internal debugger error: Not supported in noDebug mode.
==== LLDB swift-healthcheck log. ===
This file contains the configuration of LLDB's embedded Swift compiler to help diagnosing module import and search path issues. The swift-healthcheck command is meant to be run after an error has occurred.
lldb version 17.0.6
Swift version 6.0.2 (swift-6.0.2-RELEASE)
Debug adapter exit code=0 (0x0), signal=null.

@matthewbastien
Copy link
Member

Debugging requires specifically Python 3.9 to be installed on your system. Once you install that you should hopefully be good to go. Let me know if that doesn't work.

It would be nice for us to at least document this or provide a better error message on Windows.

@Arebusf21
Copy link
Author

Arebusf21 commented Mar 11, 2025

Hi:
Python 3.9 was found during the install of Swift. I have verified that it was installed.
I have attached the Swift install log for you to see.

If I go into Swift Settings and check the "Use Debug Adapter from Toolchain" option under "User/Debugger", I get to see the output from my app in the Debug Console. I still see an external terminal window pop-up briefly though.
It works with and without the debugger running.

I do not get a settings.json file anymore when i create a new project, strange.

Swift_install_log.txt

@matthewbastien
Copy link
Member

Well I'm glad to hear that swift.debugger.useDebugAdapterFromToolchain works. We're actually going to be making that the default for Swift 6.0+ very soon. So, if that works for you then I think that's the best approach to go with. CodeLLDB uses its own pre-built version of LLDB and we'd rather use the version that's bundled with the Swift toolchain going forward.

@Arebusf21
Copy link
Author

Do you have any ideas on how I can prevent the external pop-up terminal window?

@matthewbastien
Copy link
Member

matthewbastien commented Mar 11, 2025

Do you have any ideas on how I can prevent the external pop-up terminal window?

Unfortunately, I'm not sure if there's a way to do that or what's actually causing the terminal to show up in the first place. I can't speak to how CodeLLDB does things, but when using swift.debugger.useDebugAdapterFromToolchain the Swift extension simply tells VS Code to use lldb-dap as the debug adapter. So, it's either something that VS Code is doing when launching the debug adapter or something that LLDB is doing.

@Arebusf21
Copy link
Author

Si can I remove the CodeLLDB extension from VSCode profile?

@matthewbastien
Copy link
Member

You won't be able to remove it just yet as we have a hard dependency on it, but the next update of the Swift extension will remove that hard dependency.

@award999 award999 moved this from Unscreened to Backlog in Swift Extension for Visual Studio Code Mar 21, 2025
@award999 award999 added CodeLLDB lldb or vscode-lldb issue debugging lldb-dap and removed lldb-dap labels Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CodeLLDB lldb or vscode-lldb issue debugging
Development

No branches or pull requests

3 participants