Debug with LEAN CLI - connect ECONNREFUSED 127.0.0.1:5678
Closed this issue · 2 comments
Having issues as described in this forum post:
The Mia AI suggested I open an issue here.
I just signed up for a Researcher subscription and already am having issues.
Followed the instructions on setting up Local Platform here (https://www.quantconnect.com/docs/v2/local-platform/installation/install-on-macos), was able to successful RUN a backtest with the sample code provided in main.py connecting to the QuantConnect cloud platform.
HOWEVER, I would like to DEBUG, as outlined here (https://www.quantconnect.com/docs/v2/local-platform/backtesting/debugging), and after setting a breakpoint, when I press the 'Debug with Lean CLI' button I get an error popup with message: "connect ECONNREFUSED 127.0.0.1:5678" and an action to open the launch.json file.
I think this has something to do with Docker, but I only installed it based on the QuantConnect instructions and have no idea what I'm supposed to configure. I just want to set break points as I execute the code. Here is my launch.json file (with personal directories replaced with ):
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug with Lean CLI",
"type": "python",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/LeanCLI"
},
{
"localRoot": "",
"remoteRoot": "/Library"
}
]
}
]
}
I should specify I am running Visual Studio Code on Mac OS.
OK, I finally figured this out. In order to connect the VSCode debugger, one has to first:
Open a terminal in your organization workspace, run lean backtest "" --debug ptvsd
via the CLI, as explained in: https://www.lean.io/docs/v2/lean-cli/backtesting/debugging