Search code examples
qtqt-creatorpyside6

"Environment variable PYSIDE_DESIGNER_PLUGINS is not set, bailing out."


I have installed open source qt creator (free version) and creating very simple desktop application. I am able to create simple window but when I am running I am getting following error:

I have tried to follow this page but could not understand to fix this issue

https://www.qt.io/blog/qt-for-python-6.1

Environment variable PYSIDE_DESIGNER_PLUGINS is not set, bailing out.
No instance of QPyDesignerCustomWidgetCollection was found.

Python File

# This Python file uses the following encoding: utf-8
import os
from pathlib import Path
import sys

from PySide6.QtWidgets import QApplication, QMainWindow
from PySide6.QtCore import QFile
from PySide6.QtUiTools import QUiLoader


    class test(QMainWindow):
        def __init__(self):
            super(test, self).__init__()
            self.load_ui()
    
        def load_ui(self):
            loader = QUiLoader()
            path = os.fspath(Path(__file__).resolve().parent / "form.ui")
            ui_file = QFile(path)
            ui_file.open(QFile.ReadOnly)
            loader.load(ui_file, self)
            ui_file.close()
    
    
    if __name__ == "__main__":
        app = QApplication([])
        widget = test()
        widget.show()
        sys.exit(app.exec_())

adding xml

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>test3</class>
 <widget class="QMainWindow" name="test3">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>1332</width>
    <height>702</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>test3</string>
  </property>
  <widget class="QWidget" name="centralwidget">
   <widget class="QCheckBox" name="checkBox">
    <property name="geometry">
     <rect>
      <x>300</x>
      <y>240</y>
      <width>70</width>
      <height>17</height>
     </rect>
    </property>
    <property name="text">
     <string>CheckBox</string>
    </property>
   </widget>
  </widget>
  <widget class="QMenuBar" name="menuBar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>1332</width>
     <height>21</height>
    </rect>
   </property>
   <widget class="QMenu" name="menuFile">
    <property name="title">
     <string>File</string>
    </property>
    <addaction name="actionOpen"/>
    <addaction name="actionsave"/>
   </widget>
   <widget class="QMenu" name="menuEdit">
    <property name="title">
     <string>Edit</string>
    </property>
   </widget>
   <widget class="QMenu" name="menuArchive_and_update_indicator">
    <property name="title">
     <string>Archive and update indicator</string>
    </property>
   </widget>
   <addaction name="menuFile"/>
   <addaction name="menuEdit"/>
   <addaction name="menuArchive_and_update_indicator"/>
  </widget>
  <action name="actionOpen">
   <property name="text">
    <string>Open</string>
   </property>
  </action>
  <action name="actionsave">
   <property name="text">
    <string>Save</string>
   </property>
  </action>
 </widget>
 <resources/>
 <connections/>
</ui>

Solution

  • You're seeing an informative message from a new and experimental feature in PySide6 called "Custom Widgets". To silence the message you can set the variable "PYSIDE_DESIGNER_PLUGINS" to "." for the current folder.

    https://www.qt.io/blog/qt-for-python-6.1 states:

    A new experimental plugin for Linux and Windows is shipped that provides > support for writing custom widgets in Python, which can then be selected > from Qt Designer to be used in layouts. Some extra magic is required to > enable this on macOS. We hope to have it ready in 6.1.1!

    More about this feature can be found here:

    https://doc-snapshots.qt.io/qtforpython-dev/tutorials/basictutorial/uifiles.html#custom-widgets-in-qt-designer