I have made a Python tool(using PyQt) to work with scanned pdfs which uses tesserocr and imagemagick wand . Both Tessorocr and imagemagick executables I installed at my system and tool is working fine at my system. But now I want to make this tool as single executable to share with people. So that they do not need to install Imagemagick and Tesserocr separately.
I have been searching this problem since days now, but could not get the concrete answer .
Couple of hints I did try . create SPEC file with dependent binaries updating environment variable for imagemagick os.environ['MAGICK_HOME'] = './'
But still not able to make single exe.
Binaries path :
Imagemagcik - C:\Program Files\ImageMagick-7.0.10-Q16
TessorOCR - C:\Program Files\Tesseract-OCR
My spec file look like :
a = Analysis(['form.py'],
pathex=['C:\\Users\\usrname\\nlp_repo\\src'],
binaries=[('C:\\Program Files\\ImageMagick-7.0.10-Q16\\magick.exe', 'wand') ,
('C:\\Program Files\\Tesseract-OCR\\tesseract.exe', 'tesserocr')],
datas = [ ('C:/Users/usrname/nlp_repo/src/download.png') ],
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='form',
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='form')
Pyinstaller error- format_binaries_and_datas for src_root_path_or_glob, trg_root_dir in binaries_or_datas: ValueError: too many values to unpack.
I am not sure if any more settings I should include in my Form.SPEC file and how many exe’s should be pass for imagemagcik and tesserocr binaries to make workable executable.
Any steps guide would be helpful. thank you in advance
I have resolved this issue. To have Python tool running on local system I did following steps
a = Analysis(['form.py'],
pathex=['C:\\Users\\usrname\\nlp_repo\\src'],
binaries=[],
datas = [ ('C:\\Users\\usrname\\nlp_repo\\src\\download.png', '.') ],
hiddenimports=['PyTessBaseAPI'],
hookspath=[],
runtime_hooks=[],
excludes=[],
.....
binaries can be bundle as standalone(by setting binaries in spec files) and then target system user can install it separately and then can easily use Python tool generated using Pyinstaller.
Jsh