lean-cli icon indicating copy to clipboard operation
lean-cli copied to clipboard

pycharm debug on apple m1 hardware - error loading attach_linux_amd64.so

Open markns opened this issue 3 years ago • 1 comments

Hi, I'm trying to get debug working with pycharm on an Apple silicon machine, but running into some issues...

PyCharm Debug with Lean CLI output:

import pydevd_pycharm
pydevd_pycharm.settrace('localhost', port=6000, stdoutToServer=True, stderrToServer=True)
Waiting for process connection…
Connected to pydev debugger (build 201.8538.36)
Warning: wrong debugger version. Use pycharm-debugger.egg from PyCharm installation folder
Or execute: 'pip install pydevd-pycharm~=%221.5787.24'
Error loading: /opt/miniforge3/lib/python3.6/site-packages/pydevd_attach_to_process/attach_linux_amd64.so
SUCCESS: Connected to docker container
Waiting for process connection…

Lean backtest output:

> lean backtest starter_system --debug pycharm
...
...
20220613 18:25:47.442 TRACE:: DebuggerHelper.Initialize(): Attempting to connect to Pycharm PyDev debugger server...
Could not connect to localhost: 6000
Traceback (most recent call last):
  File "/opt/miniforge3/lib/python3.6/site-packages/_pydevd_bundle/pydevd_comm.py", line 456, in start_client
    s.connect((host, port))
ConnectionRefusedError: [Errno 111] Connection refused
pydev debugger: warning: trying to add breakpoint to file that does not exist: /LeanCLI/starter_system/main.py (will have no effect)
Error loading: /opt/miniforge3/lib/python3.6/site-packages/pydevd_attach_to_process/attach_linux_amd64.so
SUCCESS: Connected to docker container
20220613 18:25:47.967 TRACE:: DebuggerHelper.Initialize(): started

Pretty sure the message Error loading ... attach_linux_amd64.so is coming from inside the lean docker container, but I'm not yet familiar enough with dev on an m1 machine that I know if it's ok for it to be loading a .so file for a different arch.

Wondering if anyone has got this working?

markns avatar Jun 13 '22 18:06 markns

Hey @markns!

Or execute: 'pip install pydevd-pycharm~=%221.5787.24'

The version that Lean is using is quite old, I believe from 7/2020, see https://github.com/QuantConnect/Lean/blob/master/Dockerfile#L12 . Do you mind updating it to the latest version in a custom image and giving it another try? Current version is at 222.2889.11 . With the lean config command I believe you should be able to set/list/remove the image configuration

Martin-Molinero avatar Jun 16 '22 17:06 Martin-Molinero