balena deploy using open balena returning errors

Hello balena forum,

I’m using open balena and attempting to deploy a test project to my development fleet. i dont have a balena cloud account as i am trying to work out the configuration using only open balena and the cli.

my device’s are running in development mode and are also configure for local use.

when using the balena deploy command i am getting the following error:

The command ‘/bin/sh -c pip install -r requirements.txt’ returned a non-zero code: 1

The “pip install -r requirements.txt” is a command located in the docker.template file to install all of the necessary requirements to run the base python flask server.

if i comment out this line of code the deploy works correctly however the requirements are not loaded so the server doesn’t run correctly.

using balena the push command works and allows the server to run correctly on the pi device. However on reboot of the pi device the container is lost and needs to be re pushed.

i have attached the full debug logs bellow for reference

balena build -f fleetname --debug
[Debug] Parsing input…
[Debug] Loading project…
[Debug] Resolving project…
[Info] No “docker-compose.yml” file found at “/home/balena/balena-python-hello-world”
[Info] Creating default composition with source: “/home/balena/balena-python-hello-world”
[Debug] Creating project…
[Build] Building services…
[Build] main Preparing…
[Info] Building for aarch64/raspberrypi4-64
[Debug] Found build tasks:
[Debug] main: build [.]
[Debug] Resolving services with [raspberrypi4-64|aarch64]
[Debug] Found project types:
[Debug] main: Dockerfile.template
[Debug] Prepared tasks; building…
[Build] main Step 1/7 : FROM balenalib/raspberrypi4-64-python:3-stretch-run as build
[Build] main —> 5f41c7def93e
[Build] main Step 2/7 : WORKDIR /usr/src/app
[Build] main —> Using cache
[Build] main —> 3e623c97f729
[Build] main Step 3/7 : COPY requirements.txt requirements.txt
[Build] main —> Using cache
[Build] main —> 78706c5d7f6e
[Build] main Step 4/7 : RUN pip install -r requirements.txt
[Build] main —> Running in f9066322c357
[Build] main standard_init_linux.go:228: exec user process caused: exec format error
[Build] Built 1 service in 0:06
[Error] Build failed.
The command ‘/bin/sh -c pip install -r requirements.txt’ returned a non-zero code: 1

Error: The command ‘/bin/sh -c pip install -r requirements.txt’ returned a non-zero code: 1
at Stream. (/snapshot/versioned-source/node_modules/resin-docker-build/build/builder.js:181:23)
at Stream.write (/snapshot/versioned-source/node_modules/through/index.js:26:11)
at Stream.ondata (internal/streams/legacy.js:19:31)
at Stream.emit (events.js:314:20)
at Stream.EventEmitter.emit (domain.js:483:12)
at drain (/snapshot/versioned-source/node_modules/through/index.js:36:16)
at Stream. (/snapshot/versioned-source/node_modules/through/index.js:45:5)
at Parser.onToken (/snapshot/versioned-source/node_modules/JSONStream/index.js:132:18)
at Parser.write (/snapshot/versioned-source/node_modules/jsonparse/jsonparse.js:135:34)
at Stream. (/snapshot/versioned-source/node_modules/JSONStream/index.js:23:12)
at Stream.write (/snapshot/versioned-source/node_modules/through/index.js:26:11)
at IncomingMessage.ondata (_stream_readable.js:718:22)
at IncomingMessage.emit (events.js:314:20)
at IncomingMessage.EventEmitter.emit (domain.js:483:12)
at addChunk (_stream_readable.js:297:12)
at readableAddChunk (_stream_readable.js:272:9)
From previous event:
at /snapshot/versioned-source/node_modules/resin-docker-build/build/builder.js:73:20
at processImmediate (internal/timers.js:461:21)
From previous event:
at Builder.createBuildStream (/snapshot/versioned-source/node_modules/resin-docker-build/build/builder.js:72:97)
at /snapshot/versioned-source/node_modules/resin-multibuild/build/build.js:89:21
at processTicksAndRejections (internal/process/task_queues.js:97:5)

if anyone has any ideas why i could be getting this error code i would love to hear them as i hae tried everything i can thinks of.

Hello @ajzander
Thanks for providing the logs.
It seems like you are building the docker image locally on your development machine. I believe it’s a x86_64 machine and you are building for aarch64 target(Raspberry Pi4).
The error message [Build] main standard_init_linux.go:228: exec user process caused: exec format error usually indicates this.

Can you try running the command using the --emulated flag? You can read more here
So the command will be balena build -f fleetname --debug --emulated

Hope this helps.
Thanks,
Rahul