1

I'm using Pixi to set up a Python environment that a python project needs to run in.

So I first do pixi shell, which sets several environment variables defined in the pyproject.toml file and also runs a .bat script. After this I run python.exe ./script.py to run the application.

I'm using Visual Studio Code as IDE, so I'm running this in its Terminal view.

But when I try to use the debugger in Visual Studio Code, I run it from the IDE instead of launching python.exe from the terminal view. But for this Visual Studio Code creates a new Terminal session "Python Debug Console", for which pixi shell has not been run, and so it will not work correctly.

When launching the debugger from the Visual Studio Code IDE, it runs & 'python.exe' 'c:\...\ms-python.debugpy-2025.10.0-win32-x64\bundled\libs\debugpy\launcher' '49494' '--' 'c:\...\script.py in that session "Python Debug Console". Running this manually in the "pixi" shell also does not work, because then the Python debugger will not connect to the IDE because the IDE is not waiting for a connection from a Python debugger.


Is there a way to run a Python debugging session with the Visual Studio Code IDE, such that it is launched in a Pixi environment?

One solution would be if I could set up the IDE to wait for a connection from the debugger, and then manually run ms-python.debugpy-2025.10.0-win32-x64\bundled\libs\debugpy\launcher ... in the Pixi shell, but this does not seem possible.

Another way would be if it could be set to run pixi shell. But this seems also problematic, because pixi shell does not only set environment variables, but also launches a new cmd shell as subprocess. (So it is not a command that can be run before running the debugger, but the debugger needs to be run inside the shell spawned by pixi shell).

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.