How to set up PyCharm for debugging?

Hello everyone,

I set up my development environment under Ubuntu Linux 18.04 using the documentation:

Now I want to debug into the code with PyCharm. How do I create the run configuration in PyCharm correctly? (using the virtualenv etc.)

Thank you for your help :slight_smile:

1 Like

For anyone trying to get debugging working in PyCharm. Here is my working run configuration for Home Assistant. I followed the guide and then configured PyCharm like this:


Is there any howto, to get this running on Windows with pycharm?

1 Like

I can’t debug :frowning:

I get this error

Traceback (most recent call last):
  File "/home/miguel/.local/share/JetBrains/Toolbox/apps/PyCharm-C/ch-0/231.8109.197/plugins/python-ce/helpers/pydev/", line 1496, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/home/miguel/.local/share/JetBrains/Toolbox/apps/PyCharm-C/ch-0/231.8109.197/plugins/python-ce/helpers/pydev/_pydev_imps/", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/home/miguel/PycharmProjects/core/homeassistant/", line 10, in <module>
    from .const import REQUIRED_PYTHON_VER, RESTART_EXIT_CODE, __version__
ImportError: attempted relative import with no known parent package

Use venv/bin/hass for your script path, -c config for your params, and your working dir should just be the root of the project.

Make sure you’ve also already followed the development setup docs. In particular that you’ve run script/setup.

1 Like

Perfect! Thanks you!

1 Like