Debug local docker - cannot import name 'pydevd_defaults'

Hello gentlemen! I'm trying to set up the debugging of a django application, inside a set of dockers running on my local machine. I've done this before, in other IDE's, and on Pycharm, I'm having an unusual headache. I've tried reinstalling pycharm and my interpreter, regenerating the dockers, reconfiguring my interpreter more than once (remembering that the RUN command works with the same settings). Running out of possibilities, I decided to ask you.

d70b3f7f6635:python -u /opt/.pycharm_helpers/pydev/pydevd.py --multiprocess --qt-support=auto --port 59337 --file /app/manage.py runserver 0.0.0.0:8000
Connected to pydev debugger (build 211.7442.45)
/usr/local/lib/python3.6/site-packages/debugpy/_vendored/force_pydevd.py:20: UserWarning: incompatible copy of pydevd already imported:
/opt/.pycharm_helpers/pydev/_pydev_bundle/__init__.py
/opt/.pycharm_helpers/pydev/_pydev_bundle/_pydev_calltip_util.py
/opt/.pycharm_helpers/pydev/_pydev_bundle/_pydev_completer.py
/opt/.pycharm_helpers/pydev/_pydev_bundle/_pydev_filesystem_encoding.py
/opt/.pycharm_helpers/pydev/_pydev_bundle/_pydev_imports_tipper.py
/opt/.pycharm_helpers/pydev/_pydev_bundle/_pydev_tipper_common.py
/opt/.pycharm_helpers/pydev/_pydev_bundle/fix_getpass.py
/opt/.pycharm_helpers/pydev/_pydev_bundle/pydev_code_executor.py
/opt/.pycharm_helpers/pydev/_pydev_bundle/pydev_console_types.py
/opt/.pycharm_helpers/pydev/_pydev_bundle/pydev_imports.py
/opt/.pycharm_helpers/pydev/_pydev_bundle/pydev_ipython_code_executor.py
/opt/.pycharm_helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py
/opt/.pycharm_helpers/pydev/_pydev_bundle/pydev_is_thread_alive.py
/opt/.pycharm_helpers/pydev/_pydev_bundle/pydev_log.py
/opt/.pycharm_helpers/pydev/_pydev_bundle/pydev_monkey.py
/opt/.pycharm_helpers/pydev/_pydev_bundle/pydev_override.py
/opt/.pycharm_helpers/pydev/_pydev_bundle/pydev_stdin.py
/opt/.pycharm_helpers/pydev/_pydev_imps/__init__.py
/opt/.pycharm_helpers/pydev/_pydev_imps/_pydev_execfile.py
/opt/.pycharm_helpers/pydev/_pydev_imps/_pydev_saved_modules.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/__init__.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_additional_thread_info.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_additional_thread_info_regular.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_breakpointhook.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_breakpoints.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_bytecode_utils.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_collect_try_except_info.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_comm.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_comm_constants.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_command_line_handling.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_console.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_console_integration.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_console_pytest.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_constants.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_custom_frames.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_dont_trace.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_dont_trace_files.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_exec2.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_extension_api.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_extension_utils.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_frame.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_frame_utils.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_import_class.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_io.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_kill_all_pydevd_threads.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_plugin_utils.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_process_net_command.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_resolver.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_save_locals.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_signature.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_trace_api.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_trace_dispatch.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_trace_dispatch_regular.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_traceproperty.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_utils.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_vars.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_vm_type.py
/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_xml.py
/opt/.pycharm_helpers/pydev/_pydevd_frame_eval/__init__.py
/opt/.pycharm_helpers/pydev/_pydevd_frame_eval/pydevd_frame_eval_main.py
/opt/.pycharm_helpers/pydev/pydev_ipython/__init__.py
/opt/.pycharm_helpers/pydev/pydevd.py
/opt/.pycharm_helpers/pydev/pydevd_concurrency_analyser/__init__.py
/opt/.pycharm_helpers/pydev/pydevd_concurrency_analyser/pydevd_concurrency_logger.py
/opt/.pycharm_helpers/pydev/pydevd_concurrency_analyser/pydevd_thread_wrappers.py
/opt/.pycharm_helpers/pydev/pydevd_file_utils.py
/opt/.pycharm_helpers/pydev/pydevd_plugins/__init__.py
/opt/.pycharm_helpers/pydev/pydevd_plugins/django_debug.py
/opt/.pycharm_helpers/pydev/pydevd_plugins/extensions/__init__.py
/opt/.pycharm_helpers/pydev/pydevd_plugins/extensions/types/__init__.py
/opt/.pycharm_helpers/pydev/pydevd_plugins/extensions/types/pydevd_helpers.py
/opt/.pycharm_helpers/pydev/pydevd_plugins/extensions/types/pydevd_plugin_numpy_types.py
/opt/.pycharm_helpers/pydev/pydevd_plugins/extensions/types/pydevd_plugins_django_form_str.py
/opt/.pycharm_helpers/pydev/pydevd_plugins/jinja2_debug.py
/opt/.pycharm_helpers/pydev/pydevd_tracing.py
warnings.warn(msg + ':\n {}'.format('\n '.join(_unvendored)))
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/local/lib/python3.6/site-packages/debugpy/server/__init__.py", line 9, in <module>
import debugpy._vendored.force_pydevd # noqa
File "/usr/local/lib/python3.6/site-packages/debugpy/_vendored/force_pydevd.py", line 72, in <module>
from _pydevd_bundle import pydevd_defaults
ImportError: cannot import name 'pydevd_defaults'
python-BaseException
0
4 comments

Hi, did you install this package by any chance https://github.com/microsoft/debugpy/

Is it possible to uninstall it and try again? 

0

Andrey Resler any updates on this? My team has recently installed debugpy. Is this a hard incompatibility between pycharm and this package? Thanks for any reponse.

0

We've had no luck in reproducing the issue yet.
Would it be possible to provide some steps and code for reproducing it?

0

Hi guys, I had the same problem. But luckily for me, support was able to reproduce the bug. See here:
https://youtrack.jetbrains.com/issue/PY-59020/Import-conflict-when-using-debugpy-package

0

Please sign in to leave a comment.