1

I want to create a standalone application, which used PyQt5 QWebEngineView. Creating the application with PyInstaller gives the following error when the application is executed:

Couldn't mmap icu data file

The error only arises on MacOS and only if --onefile mode is used. On Windows I don't have that problem.

In this post is a solution given in Chinese, which I don't understand.

I create a basic program to show the error:

from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtWebEngineWidgets import *
import sys

class App(QMainWindow):
    abort = pyqtSignal()

    def __init__(self):
        super(App, self).__init__()
        webView = QWebEngineView()
        webView.load(QUrl("https://www.google.de/"))

        self.setCentralWidget(webView)

app = QApplication(sys.argv)
window = App()
window.show()
sys.exit(app.exec_())

The spec-file looks like this:

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


block_cipher = None


a = Analysis(
    ['test.py'],
    pathex=[],
    binaries=[],
    datas=[],
    hiddenimports=[],
    hookspath=[],
    hooksconfig={},
    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,
    a.binaries,
    a.zipfiles,
    a.datas,
    [],
    name='tesst',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    upx_exclude=[],
    runtime_tmpdir=None,
    console=True,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
)

I use:

  • PyInstaller: 5.0.1
  • Python: 3.9.9
  • Platform: macOS-10.16-x86_64-i386-64bit

I gladly provide further info, if needed

Mazze
  • 383
  • 3
  • 13

1 Answers1

1

I have the same problem on Windows with Qt 5.15.2x32 MSVC2019

Solution: copy all files from C:\Qt\Qt5.15.2\5.15.2\msvc2019\resources to folder with your exe-file (The path to the folder "resources" depends on the version of the Qt. You can find the path by filename from the list below).

List of files:

  • icudtl.dat
  • qtwebengine_devtools_resources.pak
  • qtwebengine_resources.pak
  • qtwebengine_resources_100p.pak
  • qtwebengine_resources_200p.pak

If you use windeployqt.exe, this tool is copying folder resources near to your exe, it is wrong, you should to move all files from resources to one level up (to folder with your exe-file)

Vladimir
  • 306
  • 3
  • 8
  • Copying the resource folder the folder, where the exe is, works. Unfortunately, including it in the spec-file as `a.datas += Tree('path/to/Resources', prefix='Resources')` does not. – Mazze May 16 '23 at 18:51