Skip to content

Assertion failure on theme colour #14810

Closed

Description

@JinZida

The iPython could not run on my PyCharm with the following error prompt:

Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/plugins/python-ce/helpers/pydev/pydevconsole.py", line 570, in <module>
    pydevconsole.start_client(host, port)
  File "/Applications/PyCharm.app/Contents/plugins/python-ce/helpers/pydev/pydevconsole.py", line 484, in start_client
    interpreter = InterpreterInterface(threading.current_thread(), rpc_client=client)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/PyCharm.app/Contents/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_ipython_console.py", line 19, in __init__
    self.interpreter = get_pydev_ipython_frontend(rpc_client)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/PyCharm.app/Contents/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 472, in get_pydev_ipython_frontend
    _PyDevFrontEndContainer._instance = _PyDevIPythonFrontEnd(is_jupyter_debugger)
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/PyCharm.app/Contents/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 293, in __init__
    self.ipython = self._init_ipy_app(PyDevTerminalInteractiveShell).shell
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/PyCharm.app/Contents/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 300, in _init_ipy_app
    application.initialize(shell_cls)
  File "/Applications/PyCharm.app/Contents/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 258, in initialize
    self.init_shell(shell_cls)
  File "/Applications/PyCharm.app/Contents/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 263, in init_shell
    self.shell = shell_cls.instance()
                 ^^^^^^^^^^^^^^^^^^^^
  File "***/.venv/lib/python3.12/site-packages/traitlets/config/configurable.py", line 583, in instance
    inst = cls(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "/Applications/PyCharm.app/Contents/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 122, in __init__
    super(PyDevTerminalInteractiveShell, self).__init__(*args, **kwargs)
  File "***/.venv/lib/python3.12/site-packages/IPython/terminal/interactiveshell.py", line 977, in __init__
    super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
  File "***/.venv/lib/python3.12/site-packages/IPython/core/interactiveshell.py", line 627, in __init__
    self.init_syntax_highlighting()
  File "***/.venv/lib/python3.12/site-packages/IPython/core/interactiveshell.py", line 774, in init_syntax_highlighting
    pyformat = PyColorize.Parser(theme_name=self.colors).format
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "***/.venv/lib/python3.12/site-packages/IPython/utils/PyColorize.py", line 364, in __init__
    assert theme_name == theme_name.lower()
AssertionError
Couldn't connect to console process.
Process finished with exit code 1

This only happens with version 9.0.0. It works fine with previous versions like 8.31.0.

The reason it failed was the theme_name being NoColor which were not all lower cases. This assertion appears on multiple locations inside the package.

Activity

  1. jkibele commented on Mar 4, 2025

    @jkibele

    I also experienced this issue with pycharm and IPython 9.0.1, so it seems like the fix for #14808 did not fix this. I got around it by going back to 8.33.

  2. lancelote commented on Mar 4, 2025

    @lancelote
    Contributor

    PyCharm has NoColor hardcoded. After a796b95 IPython expects nocolor, hence the assertion error. I’ll fix it on PyCharm side. Should land in the 2025.1 release.

  3. OmriTreidel commented on Mar 4, 2025

    @OmriTreidel

    @lancelote It happens to me on python 3.12 pycharm professional 2024.3.1.1

  4. mikelane commented on Mar 4, 2025

    @mikelane

    Having this issue in 2024.3.4, so I tried upgrading to 2025.1 EAP. Still have the issue. So I tried to downgrade to 2024.2.5 and that still has the same issue. I need to be able to debug something. Can someone suggest a workaround please, this is irritating.

  5. rkechols commented on Mar 5, 2025

    @rkechols
  6. Carreau commented on Mar 5, 2025

    @Carreau
    Member

    If someone send a PR that change the assert to a if color in ...: color=color.lower() I'm happy to merge .

  7. SHi-ON commented on Mar 5, 2025

    @SHi-ON

    @mikelane there are workarounds posted here: https://youtrack.jetbrains.com/issue/PY-79553/IPython-debugger-console-does-not-work-with-iPython-9

    For PyCharm users:

    disable Settings | Build, Execution, Deployment | Console | Use IPython if available

  8. Carreau commented on Mar 6, 2025

    @Carreau
    Member

    If someone send a PR that change the assert to a if color in (old themes names): color=color.lower() I'm happy to merge and make a point release.

  9. Carreau commented on Mar 8, 2025

    @Carreau
    Member

    closed by #14824

  10. added this to the 9.0.2 milestone on Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions