Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pyinstaller Illegal Instruction 4 (other computers)

Running into a problem with pyinstaller. I'm trying to ship out an exe/app file using PyInstaller. However, anyone who tries to open my file ends up getting an Illegal Instruction 4 error.

This only happens when I try to compile on my machine and send to others. Others who compile using the same process and spec file do not see this same issue. When I open my own files, the exe and app files open without error.

Any and all ideas appreciated!

System Details:

OSX 10.9.4 (All machines are on this)

My PyInstaller output:

(veControl)ahaq-mbp-10028:asimov-control ahaque$ pyinstaller asimov_gui.spec --onefile
23 WARNING: You are running 64-bit Python: created binaries will only work on Mac OS X 10.6+.
If you need 10.4-10.5 compatibility, run Python as a 32-bit binary with this command:

VERSIONER_PYTHON_PREFER_32_BIT=yes arch -i386 /Users/ahaque/asimov-control/veControl/bin/python

4029 INFO: UPX is not available.
4050 INFO: Processing hook hook-os
4152 INFO: Processing hook hook-time
4154 INFO: Processing hook hook-cPickle
4220 INFO: Processing hook hook-_sre
4330 INFO: Processing hook hook-cStringIO
4424 INFO: Processing hook hook-encodings
4437 INFO: Processing hook hook-codecs
4756 INFO: Extending PYTHONPATH with /users/ahaque/asimov-control
4756 INFO: checking Analysis
4806 INFO: checking PYZ
4825 INFO: checking PKG
4844 INFO: checking EXE
4845 INFO: checking BUNDLE
4845 INFO: building BUNDLE out00-BUNDLE.toc
(veControl)ahaq-mbp-10028:asimov-control ahaque$ 

Output from others' terminal:

Last login: Mon Aug 11 13:05:00 on ttys002
LOADER: executable is /Users/dachelis/Downloads/Asimov_GUI 2
LOADER: homepath is /Users/dachelis/Downloads
LOADER: _MEIPASS2 is NULL
LOADER: archivename is /Users/dachelis/Downloads/Asimov_GUI 2
LOADER: Extracting binaries
LOADER: Executing self as child
LOADER: set _MEIPASS2 to /var/folders/q6/nxdsj2_x6x3d32pcjqf2468wwtqnq6/T/_MEIlbLNev
LOADER: executable is /Users/dachelis/Downloads/Asimov_GUI 2
LOADER: homepath is /Users/dachelis/Downloads
LOADER: _MEIPASS2 is /var/folders/q6/nxdsj2_x6x3d32pcjqf2468wwtqnq6/T/_MEIlbLNev
LOADER: archivename is /Users/dachelis/Downloads/Asimov_GUI 2
LOADER: Already in the child - running user's code.
LOADER: Python library: /var/folders/q6/nxdsj2_x6x3d32pcjqf2468wwtqnq6/T/_MEIlbLNev/.Python
LOADER: Manipulating evironment
LOADER: PYTHONPATH=/var/folders/q6/nxdsj2_x6x3d32pcjqf2468wwtqnq6/T/_MEIlbLNev
LOADER: PYTHONHOME=/var/folders/q6/nxdsj2_x6x3d32pcjqf2468wwtqnq6/T/_MEIlbLNev
LOADER: Manipulating Python's sys.path
LOADER: importing modules from CArchive
LOADER: extracted struct
LOADER: extracted pyi_os_path
LOADER: extracted pyi_archive
LOADER: extracted pyi_importers
LOADER: Installing import hooks
LOADER: out00-PYZ.pyz
LOADER: Running scripts
Illegal instruction: 4
logout

[Process completed]
like image 703
Ahmed Haque Avatar asked Oct 21 '22 03:10

Ahmed Haque


2 Answers

This problem stems from an incompatibility of the version of python you are packaging. You are likely using a version that you compiled on your system via Homebrew or MacPorts. This likely resulted in a binary that is not fully compatible with other OS X machines because of compiler optimizations. An easy solution is to download ActivePython and be sure that you are using it to package your source code.

like image 77
Lucas Avatar answered Oct 22 '22 16:10

Lucas


I also met problem like this, finally I switch to use nuitka .

like image 42
feisan Avatar answered Oct 22 '22 18:10

feisan