Important: Please read the Qt Code of Conduct -

making a Qt Designer plugin with python -- plugins not visible in Designer

  • I am trying to create a custom widget plugin for Qt Desinger using PyQt5.
    I am using python 3.7, PyQt5 (5.13.0), PyQt5-sip (4.19.18)
    macos 10.14.5
    Qt Designer (5.13) from QtCreator installed for mac (free version).

    before making my plugin, I simply want to setup the designer sample plugins so make sure i understand the process.

    To test, I downloaded and from
    I modified the app like this:

    import sys
    from PyQt5.QtCore import QLibraryInfo, QProcess, QProcessEnvironment
    # Tell Qt Designer where it can find the directory containing the plugins and
    # Python where it can find the widgets.
    env = QProcessEnvironment.systemEnvironment()
    env.insert('PYQTDESIGNERPATH', '[path to the files]/designer_plugins')
    env.insert('PYTHONPATH', '[path to the widgets]/designer_widgets')
    # Start Designer.
    designer = QProcess()
    designer_bin = QLibraryInfo.location(QLibraryInfo.BinariesPath)
    if sys.platform == 'darwin':
        designer_bin = '/Users/[user]/Qt/5.13.0/clang_64/bin/'
        designer_bin += '/designer'

    When I run, designer opens as expected, but i do not see the plugins at all.
    I've read that pyqt5.dylib is necessary, but it doesn't exist on my computer anywhere.

    • is this the cause?
    • if yes, where can I get it or how can I make it?
    • once I have it, where do I put it?

    I am familiar with Qt Designer and PyQt, but not an expert. Please explain like you're talking to a pretty clueless person. thanks.

    EDIT: I have installed SIP and PyQt5 from the source. This added the libpyqt5.dylib file to Qt/5.13.0/clang_64/plugins/designer/
    but, I got this error:
    ERROR:root:PyCapsule_GetPointer called with incorrect name

    EDIT2: the only way I could get rid of that error was to uninstall PyQt5-sip and reinstall it via pip. (same version though, 4.19.18). But, still no plugins.

    When I check 'about plugins' in the designer menu, I do see this:

    I assume that if things were correct, the analogclock widget would be seen there as well as in the left-side area of the main window where all the widgets are.

    EDIT 3: after setting QT_DEBUG_PLUGINS to 1, I can see this in the terminal output:

    Found metadata in lib /Users/.../Qt/5.13.0/clang_64/plugins/designer/libpyqt5.dylib, metadata=
        "IID": "org.qt-project.Qt.QDesignerCustomWidgetCollectionInterface",
        "archreq": 0,
        "className": "PyCustomWidgets",
        "debug": false,
        "version": 331008
    loaded library "/Users/.../Qt/5.13.0/clang_64/plugins/designer/libpyqt5.dylib"

    This seems good and explains (I think) why I can see libpyqt5.dylib in the screenshot above. But does not explain why the widgets themselves are missing. Any ideas? How can I do more debugging?

    Now I notice that near the end of the debugger it says:

    ModuleNotFoundError: No module named 'PyQt5'

    this disappears when i don't set the environment variables
    (i.e., if I run designer from the terminal without user$ export PYQTDESIGNERPATH='the path')

    anyone out there in Qt land??

  • @anp405, my first guess would be that by setting PYTHONPATH you are losing the location of PyQt5 package. This depends on your Python and environment setup, but if there is some PYTHONPATH existing, you are overriding it completely instead of complementing. You can verify this by opening a new command line session, setting PYTHONPATH to wherever your code sets it, then running Python interpreter and trying to import PyQt5.

    Another guess would be that your child process uses different Python environment (e.g. built-in system Python 2), which does not have PyQt5 installed in its site-packages.