Magnum Python 93'
Magnum Python 93'

Reputation: 37

Pyinstaller: Could not find QtWebEngineProcess.exe for PyQT5 Web Application

I am developing a web application which displays a folium map. The web app has 3 tabs and each tab has a QtWebEngineView widget added into them.

I am trying to create a standalone .exe file for my web application. So I have used Pyinstaller to convert my project into a single .exe file. I already had to make some changes in my spec file to solve a previous issue (fixed). This is how the spec file looks

# -*- mode: python ; coding: utf-8 -*-

block_cipher = None


a = Analysis(['main.py'],
             pathex=['D:\\Bus_Stop_Finder'],
             binaries=[],
             datas=[('input\\stops.txt', 'input'), 
             ('input\\Suggestions.xlsx', 'input'),
             (".\\venv\\Lib\\site-packages\\branca\\*.json","branca"),
             (".\\venv\\Lib\\site-packages\\branca\\templates","templates"),
             (".\\venv\\Lib\\site-packages\\folium\\templates","templates"),
             ],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          [],
          exclude_binaries=True,
          name='main',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          console=True )
          
            
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=False,
               upx=True,
               upx_exclude=[],
               name='main')

On running Pyinstaller mainspec, the dist folder and main.exe file is created but once I run the the main.exe file, I am getting this error:

Could not find QtWebEngineProcess.exe

I have tried reading through the Qt Documentation for deploying Qt WebEngine Applications and noticed that

The WebEngine process is executed for each QWebEngineView or WebEngineView instance

I am not sure, where I have to make a modification or correction. Can someone help me out with this?

Upvotes: 1

Views: 8076

Answers (4)

TwoPoint
TwoPoint

Reputation: 56

[Paths]

Prefix = PyQt5/Qt/

After debug

The path is correct but the file name after debug is created as 'Qt5'. It should be changed to 'Qt'

Change folder name 'Qt5' to 'Qt'

Upvotes: 0

PiedroCraft
PiedroCraft

Reputation: 11

[Paths]
Prefix = PyQt5/Qt/

You have to create a qt.conf file with the above details in it, and this file should be with your app. Example 1
Example 2

Upvotes: 1

Saam
Saam

Reputation: 75

I had a similar problem and finally fixed it. (Python 3.9.5 & PyQt5.15.4)

Your problem is not related to the spec file modifications.

The root of the problem is the structure of generated files. more precisely in dist directory.

The QtWebEngineProcess.exe that the app_name.exe is looking for, it exists in dist>{app_name}>PyQt5>Qt>bin path, but this app cannot access it. to create this access, the following tasks must be performed:

  1. Create text a file in dist>{app_name} directory and name it qt.conf

  2. Enter the following text in it

    [Paths]
    Prefix = PyQt5/Qt/
    

Now the main.exe runs without any problems :)

Upvotes: 4

pebbad
pebbad

Reputation: 11

I was having the same problem, tried Saam's fix but apparently, the last slash is added via hooks. I add a qt.conf file in my dist/appname dir

[Paths]
Prefix = PyQt5/Qt

Upvotes: 1

Related Questions