How to fix CMake error: wxPython/Phoenix does not appear to be installed on the system

Problem

When trying to compile software using CMake, you see an error message such as:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'wx'
CMake Error at cmake/FindwxPython.cmake:56 (message):
  wxPython/Phoenix does not appear to be installed on the system
Call Stack (most recent call first):
  CMakeLists.txt:1004 (find_package)

Solution

CMake basically checks if you have the Python packag wx installed.

In order to install it, use

pip install --user --break-system-packages wxpython

If that doesnt work, check fif you have multiple Python versions installed