Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. I want to create a portable PyQt5.2.1 package [Question]
Forum Updated to NodeBB v4.3 + New Features

I want to create a portable PyQt5.2.1 package [Question]

Scheduled Pinned Locked Moved QML and Qt Quick
20 Posts 3 Posters 14.2k Views 1 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.
  • M Offline
    M Offline
    madoodia
    wrote on last edited by
    #9

    very good thread, thanks
    i have some progress, but yet it does not work and give some error:
    first error, (This application failed to start because it could not find or load the Qt platform plugin “windows”.
    Reinstalling the application may fix this problem.), is fixed with this way:
    in code of launcher i got the path of this file (here Deployment folder) as dynamically and send it to QApplication.addLibraryPath(path)

    but a new error occured: (i had it before, if you remember i looked for QML_IMPORT_PATH env for that but i reach to this point)
    QQmlApplicationEngine failed to load component
    file:///C:/Users/Madoodia/Desktop/Deployment/test.qml:2 module "QtQuick.Controls" is not installed
    file:///C:/Users/Madoodia/Desktop/Deployment/test.qml:1 module "QtQuick" is not installed
    because i have this two line in test.qml file:
    import QtQuick 2.0
    import QtQuick.Controls 1.0

    what is this error?
    i put all folders of C:\Qt\Qt5.2.1\5.2.1\msvc2012_64\qml beside my app
    why give error?

    i should tell that when i run test.qml it runs, and window is appeared.
    (also, i have QtHidden yet)

    thanks for reply in advanced

    1 Reply Last reply
    0
    • JKSHJ Online
      JKSHJ Online
      JKSH
      Moderators
      wrote on last edited by
      #10

      Have you talked to people at the PyQt mailing list?

      I am only guessing here: Maybe it's because you are not launching an .exe file. You are loading a Python script file, so maybe Qt is searching in the folder where python.exe is.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • M Offline
        M Offline
        madoodia
        wrote on last edited by
        #11

        Yes, you are right, and i have post on riverbank's mailing list for pyqt, but anybody does not answer me.

        thanks for your guessing
        i put QtQuick and QtQuick.2 folder and platform folder beside python.exe and proram works.

        but i want to know that how can i tell program that this files is beside you.and first search your folder then if it is not here go to Python27 folder.???

        if help me about paths i really own to you

        1 Reply Last reply
        0
        • JKSHJ Online
          JKSHJ Online
          JKSH
          Moderators
          wrote on last edited by
          #12

          At the beginning of mainLauncher.py, what does os.getcwd() return? What happens if you call os.chdir() to go to the deployment folder, before you start calling Qt stuff?

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          0
          • M Offline
            M Offline
            madoodia
            wrote on last edited by
            #13

            os.getcwd() >>> C:\Users\Madoodia\Desktop\Deployment

            you mean this :
            path = os.getcwd()
            os.chdir(path)
            ?

            nothing
            i'm in deployment folder

            1 Reply Last reply
            0
            • JKSHJ Online
              JKSHJ Online
              JKSH
              Moderators
              wrote on last edited by
              #14

              [quote author="madoodia" date="1398588817"]os.getcwd() >>> C:\Users\Madoodia\Desktop\Deployment

              you mean this :
              path = os.getcwd()
              os.chdir(path)
              ?

              nothing
              i'm in deployment folder[/quote]Yes, that's what I meant. It didn't work though...

              Ok, try playing around with QQmlEngine::addImportPath() or QQmlEngine::addPluginPath() (see http://qt-project.org/doc/qt-5/qqmlengine.html) -- these are like QApplication::addLibraryPath().

              If you used a QQuickView, you can get the engine by calling QQuickView::engine()

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              1 Reply Last reply
              0
              • M Offline
                M Offline
                madoodia
                wrote on last edited by
                #15

                hey there
                yes
                i work with this and i got the good results.
                and i find the way.not Portable PyQt5 but i can find more thing that i will document all off that in these days.
                but a new problem occurs.
                my program works fine in my labtop.
                i switch to pyinstaller to make it executable and i had infinite problems.
                i solved all off them too.
                but there is a big problem that i could not solve it yet.
                i changed program to one exe file and it works in my labtop fine.
                but when i transform it to another clean pc or clean VM it does not work and give this error (again):
                This application failed to start because it could not find or load the Qt platform plugin “windows”.
                Reinstalling the application may fix this problem.
                :)
                this error want to kill me...
                any feedback welcome.
                thanks again

                1 Reply Last reply
                0
                • JKSHJ Online
                  JKSHJ Online
                  JKSH
                  Moderators
                  wrote on last edited by
                  #16

                  Load your .exe with Dependency Walker (http://www.dependencywalker.com/ ) and choose Profile -> Start Profiling.

                  That will show you where it's searching for DLLs.

                  [quote]i switch to pyinstaller to make it executable[/quote]The search paths for the .exe file might be different from the .py file

                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    madoodia
                    wrote on last edited by
                    #17

                    ok
                    i did that an find that all Loading is between two same commands,for example one line of LoadLibraryW ... some other lines...again LoadLibraryW

                    and this is result:
                    LoadLibraryW("C:\Users\vm1\AppData\Local\Temp_MEI26242\qt5_plugins\platforms\qwindows.dll") called from "QT5CORE.DLL" at address 0x00000000600C85EF.
                    Loaded "QWINDOWS.DLL" at address 0x000007FE3F840000. Successfully hooked module.
                    Loaded "WINMM.DLL" at address 0x000007FE44B80000. Successfully hooked module.
                    Loaded "OLEAUT32.DLL" at address 0x000007FE4D6A0000. Successfully hooked module.
                    Unloaded "QWINDOWS.DLL" at address 0x000007FE3F840000.
                    Unloaded "OLEAUT32.DLL" at address 0x000007FE4D6A0000.
                    Unloaded "WINMM.DLL" at address 0x000007FE44B80000.
                    LoadLibraryW("C:\Users\vm1\AppData\Local\Temp_MEI26242\qt5_plugins\platforms\qwindows.dll") returned NULL. Error: The specified module could not be found (126).
                    what do you find from this?
                    the bold snippet in dependecy graph has red color.
                    look likes load successfully but...

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      madoodia
                      wrote on last edited by
                      #18

                      and this is in my labtop that run exe file completely:

                      LoadLibraryW("C:\Users\Madoodia\AppData\Local\Temp_MEI245962\qt5_plugins\platforms\qwindows.dll") called from "QT5CORE.DLL" at address 0x000000006A5885EF.
                      Loaded "QWINDOWS.DLL" at address 0x000007FCC8CF0000. Successfully hooked module.
                      Loaded "WINMM.DLL" at address 0x000007FCE7060000. Successfully hooked module.
                      Loaded "OLEAUT32.DLL" at address 0x000007FCEB700000. Successfully hooked module.
                      Loaded "LIBEGL.DLL" at address 0x000007FCE2E30000. Successfully hooked module.
                      Loaded "WINMMBASE.DLL" at address 0x000007FCE5DB0000. Successfully hooked module.
                      DllMain(0x000007FCE5DB0000, DLL_PROCESS_ATTACH, 0x0000000000000000) in "WINMMBASE.DLL" called.
                      DllMain(0x000007FCE5DB0000, DLL_PROCESS_ATTACH, 0x0000000000000000) in "WINMMBASE.DLL" returned 1 (0x1).
                      DllMain(0x000007FCE7060000, DLL_PROCESS_ATTACH, 0x0000000000000000) in "WINMM.DLL" called.
                      DllMain(0x000007FCE7060000, DLL_PROCESS_ATTACH, 0x0000000000000000) in "WINMM.DLL" returned 1 (0x1).
                      DllMain(0x000007FCEB700000, DLL_PROCESS_ATTACH, 0x0000000000000000) in "OLEAUT32.DLL" called.
                      DllMain(0x000007FCEB700000, DLL_PROCESS_ATTACH, 0x0000000000000000) in "OLEAUT32.DLL" returned 1 (0x1).
                      DllMain(0x000007FCE2E30000, DLL_PROCESS_ATTACH, 0x0000000000000000) in "LIBEGL.DLL" called.
                      DllMain(0x000007FCE2E30000, DLL_PROCESS_ATTACH, 0x0000000000000000) in "LIBEGL.DLL" returned 1 (0x1).
                      DllMain(0x000007FCC8CF0000, DLL_PROCESS_ATTACH, 0x0000000000000000) in "QWINDOWS.DLL" called.
                      DllMain(0x000007FCC8CF0000, DLL_PROCESS_ATTACH, 0x0000000000000000) in "QWINDOWS.DLL" returned 1 (0x1).
                      LoadLibraryW("C:\Users\Madoodia\AppData\Local\Temp_MEI245962\qt5_plugins\platforms\qwindows.dll") returned 0x000007FCC8CF0000.

                      comprise inbetween codes

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        madoodia
                        wrote on last edited by
                        #19

                        There is 5 DLL that should be loaded:
                        QWINDOWS.DLL
                        WINMM.DLL
                        OLEAUT32.DLL
                        LIBEGL.DLL
                        WINMMBASE.DLL

                        i don't know how should i read the address of them:
                        Loaded “QWINDOWS.DLL” at address 0×000007FCC8CF0000 ...

                        you know?

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          madoodia
                          wrote on last edited by
                          #20

                          i find this 3 files in windows/system32
                          WINMM.DLL
                          OLEAUT32.DLL
                          WINMMBASE.DLL
                          that i think should be shipped with exe file.

                          and this to is shipped with file
                          QWINDOWS.DLL
                          LIBEGL.DLL

                          and i think it can't use it because it don't have permission to access to them.
                          :(

                          1 Reply Last reply
                          0

                          • Login

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