Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-2251

pyside6-designer Cannot Load Custom Widgets from Virtual Environment without $Env.VIRTUAL_ENV

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4: Low
    • 6.5.0, 6.4.3
    • 6.4.2
    • PySide
    • None
    • Windows 10
      Python 3.10.10
      PySide 6.4.2
    • Windows
    • 9e5596222 (dev), ec9b16d3b (6.4), 6361e496a (dev), 9ecdb21ad (6.4)

    Description

      If the user call pyside6-designer living in a virtual environment directly without activating the environment via scripts (e.g. activate.ps1), no custom widgets (& plugins) is loaded.

      However, if I manually set the VIRTUAL_ENV environment variable and then invoke pyside6-designer directly, it correctly loads the plugins.

       

      Though it is unusual to invoke Qt tools living in a virtual environment directly without activating the environment first, this defeats the possibilities to integrate the tool scripts into editor extension or other services. Also, checking if the current Python is in a virtual environment by checking the VIRTUAL_ENV environment variable is unreliable, which is mentioned in the official documentation: https://docs.python.org/3/library/venv.html#how-venvs-work. Namely, we should not use VIRTUAL_ENV at all in pyside-tools/pyside_tool.py and pyside-tools/deploy_lib/python_helper.py (https://github.com/search?q=repo%3Aqtproject%2Fpyside-pyside-setup%20VIRTUAL_ENV&type=code). Checking sys.prefix == sys.base_prefix might be an alternative here (https://stackoverflow.com/questions/1871549/determine-if-python-is-running-inside-virtualenv).

      Attachments

        For Gerrit Dashboard: PYSIDE-2251
        # Subject Branch Project Status CR V

        Activity

          People

            kleint Friedemann Kleint
            alan13wake Sean Wu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: