PyInstaller generated app spawns multiple copies on macOS

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

PyInstaller generated app spawns multiple copies on macOS

Cliff Mitchell

I have a Python3/PyQT5 app, frozen using PyInstaller. On macOS my Python3 code runs fine from a CLI. The version frozen using PyInstaller also runs successfully but creates new copies of itself every couple of seconds in what looks like an infinite loop.


By way of background I have successfully frozen this app on Ubuntu 18.05 and Windows 10 without seeing this problem.


I am running Python 3.7.2 with PyInstaller 3.4 and PyQT5 5.12, on macOS Mojave 10.14.3.


Given the Python code runs perfectly from the CLI and from PyCharm, and the frozen package runs (but with multiple copies of itself) it looks like the problem is somewhere in the freezing process. I am not directly using multiprocessing but am using scikit-learn (sklearn) that does, I believe, use multiprocessing. I have tried calling freeze_support() at the top, and various other places but none fix the problem.


My .spec file for PyInstaller does have sklearn as a hidden import. I know that freeze_support() should be called before sklearn so I wonder if having sklearn as a hidden import in the .spec file is somehow causing the problem? Other than that I have hit a brick wall. Can anyone suggest how we can get to the bottom of this problem please?


My .spec file is here:


# -*- mode: python -*-
import sys
import os
block_cipher
= None

def get_assets():
    data_files
= []
   
for file_name in os.listdir('/Users/xxx/PycharmProjects/jbrd2/jbrd/assets'):
        data_files
.append((os.path.join('jbrd/assets', file_name), 'assets'))
    data_files
.append(('/Users/xxx/PycharmProjects/jbrd2/jbrd/jbrdclasses.py', '.'))
    data_files
.append(('/Users/xxx/PycharmProjects/jbrd2/jbrd/assets/config.ini', 'assets'))
    data_files
.append(('/Users/xxx/PycharmProjects/jbrd2/jbrd/python_mysql_connect2.py', '.'))
    data_files
.append(('/Users/xxx/PycharmProjects/jbrd2/jbrd/python_mysql_dbconfig.py', '.'))
   
return data_files

a
= Analysis(['jbrd/main.py'],
             pathex
=['/Users/xxx/PycharmProjects/jbrd2'],
             binaries
=[],
             datas
=get_assets(),
             hiddenimports
=['sklearn.naive_bayes','simpleeval', 'configparser', 'mysql.connector'],
             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,
          a
.binaries,
          a
.zipfiles,
          a
.datas,
         
[],
          name
='jbrd',
          debug
=False,
          bootloader_ignore_signals
=False,
          strip
=False,
          upx
=True,
          runtime_tmpdir
=None,
          console
=False,
          icon
='/jbrd.ico')

# Build a .app if on OS X
if sys.platform == 'darwin':
   app
= BUNDLE(exe,
                name
='jbrd.app',
                icon
=None,
                bundle_identifier
=None,
                info_plist
={
               
'NSHighResolutionCapable': 'True'
               
},
               
)



--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/d/optout.