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

pyside6-deploy cannot find site-packages when deploying simple python script without venv

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.8.0, 6.7.3
    • 6.7.1
    • PySide, Tooling
    • None
    • Ubuntu 22.04
      Python 3.10.12
    • Linux/X11
    • 046984a59 (dev), c1a95db69 (6.7)

    Description

      On Ubuntu 22.04 with python 3.10.12, and perhaps other versions, pyside6-deploy 6.7.1 cannot find site-packages when compiling simple scripts.

       

      wwitzke@wwitzke-XPS-15-9520:~/workspace/pdw-provisioning-packages-installer/packages/eloadgenerator $ pyside6-deploy eloadgenerator.py
      You are not using a virtual environment. pyside6-deploy needs to install a few Python packages for deployment to work seamlessly. 
       Proceed? [Y/n]y
      WARNING:root:[DEPLOY] Key icon does not exist
      Unable to find site-packages. Exiting ...
      

       

      In previous versions, pyside6-deploy has worked. I have tried this with three different computers, and it fails on all of them with 6.7.1.

      Looking into it further, I see that the code that generates this error is in ~/.local/lib/python3.10/site-packages/PySide6/scripts/deploy_lib/dependency_util.py:

       

      def get_qt_libs_dir(self):
          """
          Finds the path to the Qt libs directory inside PySide6 package installation
          """
          for possible_site_package in site.getsitepackages():
              if possible_site_package.endswith("site-packages"):
                  self.pyside_install_dir = Path(possible_site_package) / "PySide6"
      
              if not self.pyside_install_dir:
                  print("Unable to find site-packages. Exiting ...")
                  sys.exit(-1)
      
              if sys.platform == "win32":
                  return self.pyside_install_dir
      
              return self.pyside_install_dir / "Qt" / "lib"  # for linux and macOS
      

      However, when running site.getsitepackages() in python3, only the following results are given:

       wwitzke@wwitzke-XPS-15-9520:~ $ python3
      Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import site
      >>> site.getsitepackages()
      ['/usr/local/lib/python3.10/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.10/dist-packages']
      >>> 
      

      However, 

      wwitzke@wwitzke-XPS-15-9520:~/.local/lib/python3.10/site-packages $ ls -aFl
      total 48
      drwxrwxr-x 12 wwitzke wwitzke 4096 Jun 13 11:53 ./
      drwxrwxr-x  3 wwitzke wwitzke 4096 Jun 13 09:45 ../
      drwxrwxr-x  2 wwitzke wwitzke 4096 Jun 13 11:51 pyserial-3.5.dist-info/
      drwxrwxr-x 10 wwitzke wwitzke 4096 Jun 13 11:53 PySide6/
      drwxrwxr-x  2 wwitzke wwitzke 4096 Jun 13 11:53 PySide6-6.7.1.dist-info/
      drwxrwxr-x  2 wwitzke wwitzke 4096 Jun 13 11:53 PySide6_Addons-6.7.1.dist-info/
      drwxrwxr-x  2 wwitzke wwitzke 4096 Jun 13 11:53 PySide6_Essentials-6.7.1.dist-info/
      drwxrwxr-x  6 wwitzke wwitzke 4096 Jun 13 11:51 serial/
      drwxrwxr-x  3 wwitzke wwitzke 4096 Jun 13 11:53 shiboken6/
      drwxrwxr-x  2 wwitzke wwitzke 4096 Jun 13 11:53 shiboken6-6.7.1.dist-info/
       

      I could install them as root, but that puts them at /usr/local/lib/python3.10/dist-packages/, which specifically will not be found by the code snippit I have included, as it filters ONLY for site-packages, not dist-packages.

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            shpremna Shyamnath Premnadh
            wwitzke Wayne Witzke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes