Skip to content

undefined symbol: AttachDebuggerTracing #16756

@elmcrest

Description

@elmcrest

Environment data

  • VS Code version: 1.58.2
  • Extension version (available under the Extensions sidebar): v2021.7.1053846006
  • OS and version: MacOS BigSur 11.4 Darwin arm64 20.5.0 (Apple M1)
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.9.6 (default, Jul 22 2021, 10:57:07) [GCC 8.3.0] on linux
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A (docker container)
  • Relevant/affected Python packages and their versions: Flask==2.0.1
  • Relevant/affected Python-related VS Code extensions and their versions: remote-containers v0.187.1
  • Value of the python.languageServer setting: Pylance

Expected behaviour

Run Flask app instance with debugger as configured in launch.json

Actual behaviour

when trying to debug AttributeError gets thrown on start. running flask from terminal works as expected.

vscode@f74456ef7f05:/app$  cd /app ; /usr/bin/env /usr/local/bin/python /home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/lib/python/debugpy/launcher 41483 -- -m flask run --no-debugger --no-reload 
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/lib/python/debugpy/__main__.py", line 45, in <module>
    cli.main()
  File "/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 444, in main
    run()
  File "/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 311, in run_module
    start_debugging(argv_0)
  File "/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 257, in start_debugging
    debugpy.connect(options.address, access_token=options.adapter_access_token)
  File "/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/lib/python/debugpy/../debugpy/common/compat.py", line 208, in kwonly_f
    return f(*args, **kwargs)
  File "/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/lib/python/debugpy/../debugpy/__init__.py", line 135, in connect
    return api.connect(address, access_token=access_token)
  File "/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/lib/python/debugpy/../debugpy/server/api.py", line 143, in debug
    log.reraise_exception("{0}() failed:", func.__name__, level="info")
  File "/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/lib/python/debugpy/../debugpy/server/api.py", line 141, in debug
    return func(address, settrace_kwargs, **kwargs)
  File "/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/lib/python/debugpy/../debugpy/server/api.py", line 276, in connect
    _settrace(host=host, port=port, client_access_token=access_token, **settrace_kwargs)
  File "/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/lib/python/debugpy/../debugpy/server/api.py", line 47, in _settrace
    return pydevd.settrace(*args, **kwargs)
  File "/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 2696, in settrace
    _locked_settrace(
  File "/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 2819, in _locked_settrace
    py_db.enable_tracing(py_db.trace_dispatch, apply_to_all_threads=True)
  File "/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 1039, in enable_tracing
    pydevd_tracing.SetTrace(thread_trace_func)
  File "/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd_tracing.py", line 83, in SetTrace
    if set_trace_to_threads(tracing_func, thread_idents=[thread.get_ident()], create_dummy_thread=False) == 0:
  File "/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd_tracing.py", line 349, in set_trace_to_threads
    result = lib.AttachDebuggerTracing(
  File "/usr/local/lib/python3.9/ctypes/__init__.py", line 387, in __getattr__
    func = self.__getitem__(name)
  File "/usr/local/lib/python3.9/ctypes/__init__.py", line 392, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/local/bin/python: undefined symbol: AttachDebuggerTracing

Steps to reproduce:

  1. Install Docker for Apple M1 (Docker Desktop 3.5.2.18)
  2. Install VSCode and remote-containers extension (might be related to Apple M1)
  3. setup remote-container for Flask (I'm using python:buster-slim, with compiled psycopg2 and docker-compose)
  4. create launch.json as suggested (using the template)
  5. try to start the app an get the exception

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

User belongs to experiment group 'pythonaacf'
User belongs to experiment group 'pythonJediLSP'
User belongs to experiment group 'pythonDiscoveryModuleWithoutWatcher'
User belongs to experiment group 'pythonTensorboardExperiment'
User belongs to experiment group 'pythonSurveyNotification'
User belongs to experiment group 'PythonPyTorchProfiler'
User belongs to experiment group 'pythonDeprecatePythonPath'
Python interpreter path: /usr/local/bin/python
Error 2021-07-22 14:32:18: Failed to check if file needs to be fixed [EntryNotFound (FileSystemError): Unable to read file 'vscode-remote://dev-container+2f55736572732f72616573656e65726d2f70726f6a656374732f666c6167676572/home/vscode/.config/Code/User/settings.json' (Error: Unable to resolve non-existing file 'vscode-remote://dev-container+2f55736572732f72616573656e65726d2f70726f6a656374732f666c6167676572/home/vscode/.config/Code/User/settings.json')
	at _handleError (/home/vscode/.vscode-server/bin/c3f126316369cd610563c75b1b1725e0679adfb3/out/vs/server/remoteExtensionHostProcess.js:84:167834)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async y.readText (/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/out/client/extension.js:9:341417)
	at async p.doesFileNeedToBeFixed (/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/out/client/extension.js:59:589732)
	at async /home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/out/client/extension.js:59:588859
	at async Promise.all (index 0)
	at async p.getFilesToBeFixed (/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/out/client/extension.js:59:588805)
	at async p.updateTestSettings (/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/out/client/extension.js:59:588432)] {
  code: 'FileNotFound'
}
Starting Pylance language server.
Error 2021-07-22 14:32:19: Failed to start language server, Class name = r, completed in 1ms, has a falsy return value, Arg 1: <Uri:/app/main.py>, Arg 2: {"sysPrefix":"/usr/local","envType":"Unknown","envName":"","envPath":"","path":"/usr/local/bin/python","architecture":3,"sysVersion":"3.9.6 (default, Jul 22 2021, 10:57:07) \n[GCC 8.3.0]","version":{"raw":"3.9.6","major":3,"minor":9,"patch":6,"build":[],"prerelease":["final","0"]},"displayName":"Python 3.9.6 64-bit"}, Return Value: undefined [Error: ms-python.vscode-pylance not installed
	at d.getCurrentLanguageServerDirectory (/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/out/client/extension.js:59:240352)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async r.start (/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/out/client/extension.js:59:246720)]
Error 2021-07-22 14:32:19: [Error: ms-python.vscode-pylance not installed
	at d.getCurrentLanguageServerDirectory (/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/out/client/extension.js:59:240352)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async r.start (/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/out/client/extension.js:59:246720)]
We encountered an issue starting the language server. Reverting to Jedi language engine. Check the Python output panel for details.
Error 2021-07-22 14:32:19: Failed to activate language server, Class name = a, completed in 3ms, has a falsy return value, Arg 1: <Uri:/app/main.py>, Arg 2: {"sysPrefix":"/usr/local","envType":"Unknown","envName":"","envPath":"","path":"/usr/local/bin/python","architecture":3,"sysVersion":"3.9.6 (default, Jul 22 2021, 10:57:07) \n[GCC 8.3.0]","version":{"raw":"3.9.6","major":3,"minor":9,"patch":6,"build":[],"prerelease":["final","0"]},"displayName":"Python 3.9.6 64-bit"}, Return Value: undefined [Error: ms-python.vscode-pylance not installed
	at d.getCurrentLanguageServerDirectory (/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/out/client/extension.js:59:240352)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async r.start (/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/out/client/extension.js:59:246720)]
> /usr/local/bin/python -c "import sys;print(sys.prefix)"
cwd: /app
> /usr/local/bin/python -c "import sys;print(sys.prefix)"
cwd: /app
> /usr/local/bin/python -c "import sys;print(sys.executable)"
cwd: /app
> /usr/local/bin/python -c "import sys;print(sys.executable)"
cwd: /app
> /usr/local/bin/python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: /app
> /usr/local/bin/python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: /app
> /usr/local/bin/python site --user-site
cwd: /app
> /usr/local/bin/python site --user-site
cwd: /app
> /usr/local/py-utils/bin/pylint "--init-hook='import sys; sys.path.append("/home/vscode/.local/lib")" --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text /app/main.py
cwd: /app
> /usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/completion.py
> /usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/completion.py
##########Linting Output - pylint##########
> conda --version
Error 2021-07-22 14:32:32: stderr jediProxy Error (stderr) /home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/completion.py:590: DeprecationWarning: Providing the line is now done in the functions themselves like `Script(...).complete(line, column)`
  script = jedi.Script(
/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/completion.py:590: DeprecationWarning: Providing the column is now done in the functions themselves like `Script(...).complete(line, column)`
  script = jedi.Script(

Error 2021-07-22 14:32:32: stderr jediProxy Error (stderr) /home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/completion.py:590: DeprecationWarning: Deprecated since version 0.17.0. Use the project API instead, which means Script(project=Project(dir, sys_path=sys_path)) instead.
  script = jedi.Script(
/home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/completion.py:624: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).infer instead.
  script.goto_definitions(), request["id"]

Error 2021-07-22 15:26:59: stderr jediProxy Error (stderr) /home/vscode/.vscode-server/extensions/ms-python.python-2021.7.1053846006/pythonFiles/completion.py:584: DeprecationWarning: Use the code keyword argument instead.
  jedi.Script(

> /usr/local/py-utils/bin/black --diff --quiet /app/main.py.8747c68945c62991c1af24b71a018c56.tmp
cwd: /app
> /usr/local/py-utils/bin/pylint "--init-hook='import sys; sys.path.append("/home/vscode/.local/lib")" --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text /app/main.py
cwd: /app
##########Linting Output - pylint##########

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue identified by VS Code Team member as probable bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions