0

I am trying to debug a Python (3.10.5) program with PyCharm (22.1.2) and get the error message below. How can I resolve the issue? Should I (not) install distinct python packages in my interpreter to be compatible with PyCharm debugging?

If I set a break point, PyCharm does not stop at that break point while debugging.

UserWarning: incompatible copy of pydevd already imported:

Full error message:

C:\python_env\App\WinPython\python-3.10.5.amd64\lib\site-packages\debugpy\_vendored\force_pydevd.py:18: UserWarning: incompatible copy of pydevd already imported:
 C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_bundle\__init__.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_bundle\_pydev_calltip_util.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_bundle\_pydev_completer.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_bundle\_pydev_filesystem_encoding.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_bundle\_pydev_imports_tipper.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_bundle\_pydev_tipper_common.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_bundle\fix_getpass.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_code_executor.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_console_types.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_imports.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_ipython_code_executor.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_ipython_completer.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_ipython_console_011.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_ipython_rich_output.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_is_thread_alive.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_log.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_monkey.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_monkey_qt.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_override.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_stdin.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_imps\__init__.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_saved_modules.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\__init__.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_additional_thread_info.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_additional_thread_info_regular.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_breakpointhook.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_breakpoints.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_bytecode_utils.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_collect_try_except_info.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_comm.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_comm_constants.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_command_line_handling.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_console.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_console_integration.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_console_output.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_console_pytest.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_constants.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_custom_frames.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_cython_win32_310_64.cp310-win_amd64.pyd
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_cython_win32_310_64.cp310-win_amd64.pyd
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_cython_wrapper.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_dont_trace.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_dont_trace_files.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_exec2.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_extension_api.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_extension_utils.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_frame.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_frame_utils.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_import_class.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_io.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_kill_all_pydevd_threads.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_plugin_utils.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_process_net_command.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_resolver.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_save_locals.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_signature.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_tables.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_trace_api.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_trace_dispatch.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_traceproperty.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_user_type_renderers.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_user_type_renderers_utils.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_utils.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_vars.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_vm_type.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_xml.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_frame_eval\__init__.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_frame_eval\pydevd_frame_eval_cython_wrapper.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_frame_eval\pydevd_frame_eval_main.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_frame_eval\pydevd_frame_evaluator_common.cp310-win_amd64.pyd
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_frame_eval\pydevd_frame_evaluator_win32_310_64.cp310-win_amd64.pyd
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_frame_eval\pydevd_frame_tracing.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\_pydevd_frame_eval\pydevd_modify_bytecode.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\pydev_ipython\__init__.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\pydev_ipython\inputhook.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\pydev_ipython\matplotlibtools.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\pydevd.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\pydevd_concurrency_analyser\__init__.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\pydevd_concurrency_analyser\pydevd_concurrency_logger.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\pydevd_concurrency_analyser\pydevd_thread_wrappers.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\pydevd_file_utils.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\pydevd_plugins\__init__.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\pydevd_plugins\django_debug.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\pydevd_plugins\extensions\__init__.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\pydevd_plugins\extensions\types\__init__.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\pydevd_plugins\extensions\types\pydevd_helpers.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\pydevd_plugins\extensions\types\pydevd_plugin_numpy_types.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\pydevd_plugins\extensions\types\pydevd_plugins_django_form_str.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\pydevd_plugins\jinja2_debug.py
  C:\PyCharmPortable\App\PyCharm\plugins\python-ce\helpers\pydev\pydevd_tracing.py
  warnings.warn(msg + ':\n {}'.format('\n  '.join(_unvendored)))
============================= test session starts =============================
collecting ... collected 1 item

test_location.py::test_construction PASSED                               [100%]

============================= 1 passed in 12.41s ==============================

Process finished with exit code 0
Stefan
  • 10,010
  • 7
  • 61
  • 117

1 Answers1

0

I uninstalled the package debugpy

and removed the --cov option from my pyproject.toml file

[tool.pytest.ini_options]
# Also see
# https://docs.pytest.org/en/7.1.x/customize.html#pyproject-toml
# https://pytest-cov.readthedocs.io/en/latest/config.html
# If you want to see console output from tests, include -s flag
addopts = [
    # !! do not include --cov option here because it might destroy PyCharm debug feature !!
    '--junitxml=report.xml'
]

Also see related question Unable to debug in pycharm with pytest

Stefan
  • 10,010
  • 7
  • 61
  • 117