Prerequisites
Before building, ensure you have:Complete the development setup first, including:
Running from source
For development and testing, always run meikipop as a module:The project includes convenience scripts:
meikipop.run.bat(Windows) - Runs from sourcemeikipop.install.bat(Windows) - Installs dependencies
Building executables with PyInstaller
Meikipop uses PyInstaller to create standalone executables that bundle Python and all dependencies into a single file.Install PyInstaller
Understanding the spec files
Meikipop includes platform-specific PyInstaller spec files that configure the build process:meikipop.win.x64.spec- Windows 64-bitmeikipop.linux.x64.spec- Linux 64-bit
Windows spec file breakdown
Here’s themeikipop.win.x64.spec configuration:
OCR providers are included as data files because they’re discovered dynamically at runtime using
importlib. Without explicit inclusion, PyInstaller would miss them.Executable configuration
Build process
- Windows
- Linux
- macOS
# Create a distribution folder
mkdir meikipop-windows-x64
copy dist\meikipop.exe meikipop-windows-x64\
mkdir meikipop-windows-x64\data
copy data\jmdict_enhanced.pkl meikipop-windows-x64\data\
Distribution package structure
A complete distribution should include:Build optimization
Reducing executable size
The default build can be quite large (100+ MB). To optimize:sudo apt-get install upx or sudo pacman -S upxTroubleshooting builds
ImportError when running executable
ImportError when running executable
A module wasn’t included in the build. Check:
- Is it in
hiddenimportsin the spec file? - Are there any dynamically imported modules?
hiddenimports:FileNotFoundError: icon.ico
FileNotFoundError: icon.ico
Icons aren’t being bundled correctly. Verify the And ensure the icon files exist in
datas section includes:src/resources/.No OCR providers found!
No OCR providers found!
OCR provider modules weren’t included as data files. The spec must include:
- All
.pyfiles indataslist - Provider packages in
hiddenimportslist
RuntimeError: Failed to load dictionary
RuntimeError: Failed to load dictionary
The executable can’t find
jmdict_enhanced.pkl. Make sure:- The
data/folder exists next to the executable jmdict_enhanced.pklis insidedata/- The file has read permissions
Executable crashes on startup (Windows)
Executable crashes on startup (Windows)
Common causes:
- ONNX runtime version mismatch (pinned to 1.20.1 for Windows)
- Missing Visual C++ Redistributables
Linux: error while loading shared libraries
Linux: error while loading shared libraries
Advanced: Custom builds
Adding custom OCR providers
If you’ve created a custom OCR provider, include it in the build:datas=[
# Your custom provider
('src/ocr/providers/myprovider/provider.py', 'src/ocr/providers/myprovider'),
('src/ocr/providers/myprovider/__init__.py', 'src/ocr/providers/myprovider'),
],
Building with debug logging
For troubleshooting, enable console output:Creating distributable archives
Once you have a working build, create an archive for distribution:Next steps
After building:- Test on a clean system without Python installed
- Verify all OCR providers work
- Check the system tray and settings dialog
- Test with different hotkey configurations
- Distribute to users!