2

Can anyone throw some light on why I cannot get 'pyinstaller' to execute successfully?

The installation of pyinstaller seemed to be successful but every time I run it on the simplest of scripts, it fails on message:

IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/PyInstaller/bootloader/Linux-32bit-arm/run'

2

I think you need to build the bootloader for Raspbian: Building the Bootloader

The instructions for Debian/Ubuntu should work on Raspbian, too, but do not add the repository as stated, just install the packages.

1

Full Tutorial

After many hours of searching, I got this working. The answer is straightforward, but it is spread across multiple StackExchange answers and GitHub Issues. I put it all together in this tutorial, so I save some hours for the next poor soul.

Key Takeaways

  • pip ships PyInstaller with the incorrect architectures. You need to build it yourself for ARM (Raspberry Pi).

Step by Step

1. Build the bootloader

git clone https://github.com/pyinstaller/pyinstaller 
# Alternatively download the zip from https://github.com/pyinstaller/pyinstaller/releases
cd pyinstaller/bootloader
python ./waf distclean all # or python3
cd ../PyInstaller/bootloader/
ls

Here you should see Linux-32bit-arm and inside of it run and run_d

2. Check the bootloader

file Linux-32bit-arm/run

run: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=a01c65d74d7d8b483800154dcdd4a5d2aad95d5b, stripped

If you see the above, you are good so far. However, if you see something like ELF 32-bit LSB executable, Intel 80386, that is wrong.

3. Copy the bootloader

If you installed PyInstaller with pip inside a venv, then do this

# Replace ${CLONED_PYINSTALLER_PATH} with the path where you git cloned above
# Replace ${PATH_TO_YOUR_PROJECT} with the path to your project (where you have the venv)

cp -r ${CLONED_PYINSTALLER_PATH}/PyInstaller/bootloader/Linux-32bit-arm ${PATH_TO_YOUR_PROJECT}/venv/lib/python3.5/site-packages/PyInstaller/bootloader/

If you installed with apt-get, then do this

# !!! Replace python3.5 with your version
cp -r ${CLONED_PYINSTALLER_PATH}/PyInstaller/bootloader/Linux-32bit-arm /usr/local/lib/python3.5/dist-packages/PyInstaller/bootloader

Debugging

Issue

SystemError: objcopy Failure: objcopy: Unable to recognise the format of the input file `$FILE`

Check

`file dist/$FILE`

If it does not say ELF 32-bit LSB executable, ARM [...], but instead says Intel or x86, the PyInstaller tries to use the incorrect bootloader. If you executed all steps above, try renaming the Linux-32bit-arm to just Linux-32bit. That seems to have worked for this user


Issue

gcc not found

Solution

sudo apt-get install build-essential
0

Adding on to the point made by S.Spieker in his answer... I suspect that the path for the compilation of the bootloader is wrong for your platform.

Rename the directory, as mentioned in the forum, Pyinstaller missing Linux-32bit-arm/run:

cd /usr/local/lib/python2.7/dist-packages/PyInstaller/bootloader
sudo mv Linux-32bit Linux-32bit-arm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.