PyInstaller (recommended)
pyinstaller --onefile --hidden-import=pandas --hidden-import=numpy \
--add-data "config.json;." --collect-all geopandas \
--debug mspm-source.py
Check for sys._MEIPASS in script
import sys, os if getattr(sys, 'frozen', False): base_path = sys._MEIPASS else: base_path = os.path.dirname(__file__)
config_path = os.path.join(base_path, 'config.json')failed to execute script mspm-source
If the traceback shows ModuleNotFoundError, rebuild the .exe using PyInstaller with the --hidden-import flag: Check for sys
pyinstaller --onefile --hidden-import=missing_module_name mspm-source.py
Common missing modules include pandas, numpy, cryptography, or requests. Alternatively, use --collect-all for packages with data files:
pyinstaller --onefile --collect-all=pandas mspm-source.py
Ensure you’re building on the same architecture as the target machine. Check Python bitness: If the traceback shows ModuleNotFoundError , rebuild the
python -c "import struct; print(struct.calcsize('P') * 8)"
If you need a 32-bit executable, use a 32-bit Python interpreter to run PyInstaller.