<Contents>


i have conda environment "llama-0.4" configured in my terminal, and i can run "output_parsers_demo.py" there without any problem, since all necessary modules like "langchain" are installed there. i would like to debug this script in vs code. what approach would you recommend for that?


Use VS Code’s debugger with the same Python interpreter as your working conda env.

Recommended steps:

  1. In VS Code, run Python: Select Interpreter

  2. Choose the interpreter from your conda env llama-0.4

  3. Open output_parsers_demo.py

  4. Set breakpoints

  5. Press F5 to debug

Best practice: add a launch.json like this:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug output_parsers_demo.py",
      "type": "debugpy",
      "request": "launch",
      "program": "${workspaceFolder}/output_parsers_demo.py",
      "console": "integratedTerminal",
      "cwd": "${workspaceFolder}",
      "justMyCode": false,
      "envFile": "${workspaceFolder}/.env"
    }
  ]
}

Why this works:

Quick check: in VS Code’s integrated terminal, run:

which python
python -V
python -c "import langchain; print('ok')"