Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. PyInstaller main.exe can't import PySide2.QtQuick
Forum Updated to NodeBB v4.3 + New Features

PyInstaller main.exe can't import PySide2.QtQuick

Scheduled Pinned Locked Moved Solved Qt for Python
5 Posts 2 Posters 1.0k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Curtwagner1984
    wrote on last edited by Curtwagner1984
    #1

    Hello,

    I've packaged my app using Pyinstaller, and I get an error that it can't import PySide2.QtQuick.

    C:\WorkDir\Development\Source\App\dist\main>main
    Traceback (most recent call last):
      File "main.py", line 9, in <module>
      File "C:\Users\USER\AppData\Local\Temp\embedded.4bpi2020.zip\shibokensupport\__feature__.py", line 142, in _import
    ImportError: could not import module 'PySide2.QtQuick'
    [28752] Failed to execute script 'main' due to unhandled exception!
    

    Does anyone has an idea why this is happening or how to resolve it?

    EDIT:
    The same happens when using the --onefile option

    Gojir4G 1 Reply Last reply
    0
    • C Curtwagner1984

      Hello,

      I've packaged my app using Pyinstaller, and I get an error that it can't import PySide2.QtQuick.

      C:\WorkDir\Development\Source\App\dist\main>main
      Traceback (most recent call last):
        File "main.py", line 9, in <module>
        File "C:\Users\USER\AppData\Local\Temp\embedded.4bpi2020.zip\shibokensupport\__feature__.py", line 142, in _import
      ImportError: could not import module 'PySide2.QtQuick'
      [28752] Failed to execute script 'main' due to unhandled exception!
      

      Does anyone has an idea why this is happening or how to resolve it?

      EDIT:
      The same happens when using the --onefile option

      Gojir4G Offline
      Gojir4G Offline
      Gojir4
      wrote on last edited by Gojir4
      #2

      @Curtwagner1984 You can try the hidden import option. --hidden-import=PySide2.QtQuick for CLI or hiddenimports=['PySide2.QtQuick'] in the spec file.

      1 Reply Last reply
      2
      • C Offline
        C Offline
        Curtwagner1984
        wrote on last edited by
        #3

        @Gojir4 Hi! It worked! Thank you so much!

        Could you please elaborate on what it actually does? As in why Pyinstaller doesn't see this import without doing this?

        Gojir4G 1 Reply Last reply
        0
        • C Curtwagner1984

          @Gojir4 Hi! It worked! Thank you so much!

          Could you please elaborate on what it actually does? As in why Pyinstaller doesn't see this import without doing this?

          Gojir4G Offline
          Gojir4G Offline
          Gojir4
          wrote on last edited by Gojir4
          #4

          @Curtwagner1984 Honestly I don't remember how I found this solution but I had to do the same for PySide2.Xml for one project I did few years ago.

          edit: doc of pyinstaller says: Name an import not visible in the code of the script(s) so I guess that's expected to have some cases where imports are not detected by pyinstaller at build time and that's why hidden-import option is provided.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Curtwagner1984
            wrote on last edited by
            #5

            @Gojir4 Thank you so much for helping me solve this issue!

            1 Reply Last reply
            1

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved