How to Push PiJuice to BalenaOS

For beginners like myself, I would appreciate being pointed towards some documentation, or having laid out here in the forums, the steps for preparing PiJuice to be used on a device running balenaOS.

I am presuming that I need to use balena CLI to push the code from GitHub and this is done within the unzipped project directory that I get when I download the code from GitHub.
Something like: balena push <appName> , where appName is the name of my balena app.

  1. Am I on the right track?

Should I use the containerised version here: https://github.com/balena-io-playground/balena-pijuice or just the regular PiJuice version: https://github.com/PiSupply/PiJuice

  1. Which version should I use and what would make you choose one over the other?

  2. If I happen to be pushing other containers like the ones that come with screenly for instance, this is ok right?

That is in fact my use case. I have digital sign being managed by screenly and I need to attach the PiJuice to cover for power outages. I already have screenly running on top of BalenaOS but I’m expecting to have to start from scratch with a brand new ‘application’.
My next question will be about how I configure PiJuice to shutdown the Pi in the event of an extended loss of power but I guess that’s a question for another forum.

Many thanks,
ls

p.s. feel free to point me towards any relevant documentation.

Hi, the best place to get started with is this guide: https://www.balena.io/docs/learn/getting-started/raspberrypi3/nodejs/#adding-your-first-device.

I would suggest using https://github.com/balena-io-playground/balena-pijuice, because it contains dockerfile with necessary steps to install pijuice. You can push the code using balena push <appName> or git push balena master (as pointed in getting started docs). Then you can add more services in docker-compose.yml.

Feel free to contact us if you have more questions.

1 Like

Question - does GitHub - balenalabs-incubator/balena-pijuice: Project to use PiJuice with a Raspberry Pi pull through the latest version of pijuice from GitHub - PiSupply/PiJuice: Resources for PiJuice HAT for Raspberry Pi - use your Pi Anywhere when the project gets built on balena?
Let me know if my question doesn’t make sense.

thanks.

Hello @lstocky

As my colleague said the balena-pijuice contains everything that you need.

The balena-pijuice project is installing the pijuice-base packages on the container running on balena. Check here https://github.com/balenalabs-incubator/balena-pijuice/blob/3bc28254ab76d7196ad1314664fdfd6ad4fd59f4/pijuice/Dockerfile.template#L5

You can read more here about the different possibilities of PiJuice https://github.com/PiSupply/PiJuice/blob/master/Software/README.md

Then i understand that you don’t need to build the pijuice repo on the container. And i understand that the package would be updated. Do you see any issue?

1 Like

Thanks @mpous

I just tried building that now and this is the output (see below)

Short story is that it returns ‘Remote build failed’
Thanks

Lloyds-Mac-mini-3:balena-pijuice-Feb2021 lstock$ balena push screenly-ups-Jan2021
[Info]     Starting build for screenly-ups-jan2021, user lancasterghall
[Info]     Dashboard link: https://dashboard.balena-cloud.com/apps/1904035/devices
[Info]     Building on arm05
[Info]     Pulling previous images for caching purposes...
[Success]  Successfully pulled cache images
[sample]   Step 1/4 : FROM balenalib/raspberrypi3-python:3-stretch-run
[pijuice]  Step 1/8 : FROM balenalib/raspberrypi3-python:3-stretch-build
[sample]    ---> c406f76dd283
[sample]   Step 2/4 : WORKDIR /usr/src/app
[sample]    ---> Running in 1155a4d67301
[sample]   Removing intermediate container 1155a4d67301
[sample]    ---> 46c37c6aa32f
[sample]   Step 3/4 : COPY . ./
[sample]    ---> ab077452ba23
[sample]   Step 4/4 : CMD ["python","-u","src/main.py"]
[sample]    ---> Running in daa1452bff3f
[sample]   Removing intermediate container daa1452bff3f
[sample]    ---> aaa45a7931e9
[sample]   Successfully built aaa45a7931e9
[pijuice]   ---> fc6c6f0d37b6
[pijuice]  Step 2/8 : RUN install_packages pijuice-base jq curl
[pijuice]   ---> Running in cfbac78d5aba
[pijuice]  Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): 
[pijuice]  Architecture: ARM v7 
[pijuice]  OS: Debian Stretch 
[pijuice]  Variant: build variant 
[pijuice]  Default variable(s): UDEV=off 
[pijuice]  The following software stack is preinstalled: 
[pijuice]  Python v3.6.14, Pip v21.2.3, Setuptools v57.4.0 
[pijuice]  Extra features: 
[pijuice]  - Easy way to install packages with `install_packages <package-name>` command 
[pijuice]  - Run anywhere with cross-build feature  (for ARM only) 
[pijuice]  - Keep the container idling with `balena-idle` command 
[pijuice]  - Show base image details with `balena-info` command
[pijuice]  Reading package lists...
[pijuice]  Building dependency tree...
[pijuice]  Reading state information...
[pijuice]  The following additional packages will be installed:
[pijuice]    libcurl3 libcurl4-openssl-dev libjq1 libonig4 python3-smbus python3-urwid
[pijuice]  Suggested packages:
[pijuice]    libcurl4-doc libcurl3-dbg libidn11-dev libkrb5-dev libldap2-dev librtmp-dev
[pijuice]    libssh2-1-dev libssl1.0-dev | libssl-dev
[pijuice]  The following NEW packages will be installed:
[pijuice]    jq libjq1 libonig4 pijuice-base python3-smbus python3-urwid
[pijuice]  The following packages will be upgraded:
[pijuice]    curl libcurl3 libcurl4-openssl-dev
[pijuice]  3 upgraded, 6 newly installed, 0 to remove and 49 not upgraded.
[pijuice]  Need to get 1447 kB of archives.
[pijuice]  After this operation, 2163 kB of additional disk space will be used.
[pijuice]  Get:1 http://deb.debian.org/debian stretch/main armhf libjq1 armhf 1.5+dfsg-1.3 [122 kB]
[pijuice]  Get:2 http://deb.debian.org/debian stretch/main armhf jq armhf 1.5+dfsg-1.3 [59.2 kB]
[pijuice]  Get:3 http://security.debian.org/debian-security stretch/updates/main armhf libcurl4-openssl-dev armhf 7.52.1-5+deb9u16 [359 kB]
[pijuice]  Get:4 http://deb.debian.org/debian stretch/main armhf python3-smbus armhf 3.1.2-3 [9716 B]
[pijuice]  Get:5 http://security.debian.org/debian-security stretch/updates/main armhf curl armhf 7.52.1-5+deb9u16 [225 kB]
[pijuice]  Get:6 http://security.debian.org/debian-security stretch/updates/main armhf libcurl3 armhf 7.52.1-5+deb9u16 [270 kB]
[pijuice]  Get:7 http://deb.debian.org/debian stretch/main armhf python3-urwid armhf 1.3.1-2+b1 [169 kB]
[pijuice]  Get:8 http://archive.raspberrypi.org/debian stretch/main armhf pijuice-base all 1.7 [104 kB]
[pijuice]  Get:9 http://security.debian.org/debian-security stretch/updates/main armhf libonig4 armhf 6.1.3-2+deb9u2 [129 kB]
[pijuice]  debconf: delaying package configuration, since apt-utils is not installed
[pijuice]  
[pijuice]  Fetched 1447 kB in 0s (3422 kB/s)
[pijuice]  (Reading database ... 
(Reading database ... 60%ase ... 5%
(Reading database ... 70%ase ... 65%
[pijuice]  (Reading database ... 75%
[pijuice]  (Reading database ... 80%
[pijuice]  (Reading database ... 85%
[pijuice]  (Reading database ... 90%
[pijuice]  (Reading database ... 95%
(Reading database ... 18895 files and directories currently installed.)
[pijuice]  Preparing to unpack .../0-libcurl4-openssl-dev_7.52.1-5+deb9u16_armhf.deb ...
[pijuice]  Unpacking libcurl4-openssl-dev:armhf (7.52.1-5+deb9u16) over (7.52.1-5+deb9u15) ...
[pijuice]  Preparing to unpack .../1-curl_7.52.1-5+deb9u16_armhf.deb ...
[pijuice]  Unpacking curl (7.52.1-5+deb9u16) over (7.52.1-5+deb9u15) ...
[pijuice]  Preparing to unpack .../2-libcurl3_7.52.1-5+deb9u16_armhf.deb ...
[pijuice]  Unpacking libcurl3:armhf (7.52.1-5+deb9u16) over (7.52.1-5+deb9u15) ...
[pijuice]  Selecting previously unselected package libonig4:armhf.
[pijuice]  Preparing to unpack .../3-libonig4_6.1.3-2+deb9u2_armhf.deb ...
[pijuice]  Unpacking libonig4:armhf (6.1.3-2+deb9u2) ...
[pijuice]  Selecting previously unselected package libjq1:armhf.
[pijuice]  Preparing to unpack .../4-libjq1_1.5+dfsg-1.3_armhf.deb ...
[pijuice]  Unpacking libjq1:armhf (1.5+dfsg-1.3) ...
[pijuice]  Selecting previously unselected package jq.
[pijuice]  Preparing to unpack .../5-jq_1.5+dfsg-1.3_armhf.deb ...
[pijuice]  Unpacking jq (1.5+dfsg-1.3) ...
[pijuice]  Selecting previously unselected package python3-smbus:armhf.
[pijuice]  Preparing to unpack .../6-python3-smbus_3.1.2-3_armhf.deb ...
[pijuice]  Unpacking python3-smbus:armhf (3.1.2-3) ...
[pijuice]  Selecting previously unselected package python3-urwid.
[pijuice]  Preparing to unpack .../7-python3-urwid_1.3.1-2+b1_armhf.deb ...
[pijuice]  Unpacking python3-urwid (1.3.1-2+b1) ...
[pijuice]  Selecting previously unselected package pijuice-base.
[pijuice]  Preparing to unpack .../8-pijuice-base_1.7_all.deb ...
[pijuice]  Unpacking pijuice-base (1.7) ...
[pijuice]  Setting up libcurl3:armhf (7.52.1-5+deb9u16) ...
[pijuice]  Setting up libonig4:armhf (6.1.3-2+deb9u2) ...
[pijuice]  Setting up python3-smbus:armhf (3.1.2-3) ...
[pijuice]  Setting up libjq1:armhf (1.5+dfsg-1.3) ...
[pijuice]  Processing triggers for libc-bin (2.24-11+deb9u4) ...
[pijuice]  Setting up python3-urwid (1.3.1-2+b1) ...
[pijuice]  Setting up libcurl4-openssl-dev:armhf (7.52.1-5+deb9u16) ...
[pijuice]  Setting up jq (1.5+dfsg-1.3) ...
[pijuice]  Setting up curl (7.52.1-5+deb9u16) ...
[pijuice]  Setting up pijuice-base (1.7) ...
[pijuice]  Creating user pijuice
[pijuice]  Adding user pijuice to group i2c
[pijuice]  Adding user pijuice to group pijuice
[pijuice]  settings file created
[pijuice]  Setting ownership and permissions
[pijuice]  pijuice.service is not active running, attempting to enable
[pijuice]  /var/lib/dpkg/info/pijuice-base.postinst: line 86: systemctl: command not found
[pijuice]  /var/lib/dpkg/info/pijuice-base.postinst: line 87: systemctl: command not found
[pijuice]  /var/lib/dpkg/info/pijuice-base.postinst: line 88: systemctl: command not found
[pijuice]  Removing intermediate container cfbac78d5aba
[pijuice]   ---> c701f6ec67fa
[pijuice]  Step 3/8 : WORKDIR /usr/src/app
[pijuice]   ---> Running in 87bdc1b067dd
[pijuice]  Removing intermediate container 87bdc1b067dd
[pijuice]   ---> 35772c1378b7
[pijuice]  Step 4/8 : COPY requirements.txt requirements.txt
[pijuice]   ---> 16d6f618ad7a
[pijuice]  Step 5/8 : RUN pip install -r requirements.txt
[pijuice]   ---> Running in daf93ae4350f
[pijuice]  Collecting balena-sdk==7.1.0
[pijuice]    Downloading balena-sdk-7.1.0.zip (48 kB)
[pijuice]  Collecting twilio==6.24.1
[pijuice]    Downloading twilio-6.24.1-py2.py3-none-any.whl (953 kB)
[pijuice]  Collecting PyJWT>=1.5.0
[pijuice]    Downloading PyJWT-2.3.0-py3-none-any.whl (16 kB)
[pijuice]  Collecting requests>=2.19.1
[pijuice]    Downloading requests-2.27.1-py2.py3-none-any.whl (63 kB)
[pijuice]  Collecting pyotp>=2.2.5
[pijuice]    Downloading pyotp-2.6.0-py2.py3-none-any.whl (11 kB)
[pijuice]  Collecting pyOpenSSL==18.0.0
[pijuice]    Downloading pyOpenSSL-18.0.0-py2.py3-none-any.whl (53 kB)
[pijuice]  Collecting Twisted>=18.7.0
[pijuice]    Downloading Twisted-21.7.0-py3-none-any.whl (3.1 MB)
[pijuice]  Collecting service-identity
[pijuice]    Downloading service_identity-21.1.0-py2.py3-none-any.whl (12 kB)
[pijuice]  Collecting pytz
[pijuice]    Downloading pytz-2021.3-py2.py3-none-any.whl (503 kB)
[pijuice]  Collecting six
[pijuice]    Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
[pijuice]  Collecting pysocks
[pijuice]    Downloading PySocks-1.7.1-py3-none-any.whl (16 kB)
[pijuice]  Collecting cryptography>=2.2.1
[pijuice]    Downloading cryptography-36.0.1.tar.gz (572 kB)
[pijuice]    Installing build dependencies: started
[pijuice]    Installing build dependencies: finished with status 'done'
[pijuice]    Getting requirements to build wheel: started
[pijuice]    Getting requirements to build wheel: finished with status 'done'
[pijuice]      Preparing wheel metadata: started
[pijuice]      Preparing wheel metadata: finished with status 'done'
[pijuice]  Collecting cffi>=1.12
[pijuice]    Using cached cffi-1.15.0.tar.gz (484 kB)
[pijuice]  Collecting pycparser
[pijuice]    Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
[pijuice]  Collecting certifi>=2017.4.17
[pijuice]    Downloading certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
[pijuice]  Collecting idna<4,>=2.5
[pijuice]    Downloading idna-3.3-py3-none-any.whl (61 kB)
[pijuice]  Collecting charset-normalizer~=2.0.0
[pijuice]    Downloading charset_normalizer-2.0.11-py3-none-any.whl (39 kB)
[pijuice]  Collecting urllib3<1.27,>=1.21.1
[pijuice]    Downloading urllib3-1.26.8-py2.py3-none-any.whl (138 kB)
[pijuice]  Collecting typing-extensions>=3.6.5
[pijuice]    Using cached typing_extensions-4.0.1-py3-none-any.whl (22 kB)
[pijuice]  Collecting Automat>=0.8.0
[pijuice]    Downloading Automat-20.2.0-py2.py3-none-any.whl (31 kB)
[pijuice]  Collecting constantly>=15.1
[pijuice]    Downloading constantly-15.1.0-py2.py3-none-any.whl (7.9 kB)
[pijuice]  Collecting incremental>=21.3.0
[pijuice]    Downloading incremental-21.3.0-py2.py3-none-any.whl (15 kB)
[pijuice]  Collecting attrs>=19.2.0
[pijuice]    Downloading attrs-21.4.0-py2.py3-none-any.whl (60 kB)
[pijuice]  Collecting hyperlink>=17.1.1
[pijuice]    Downloading hyperlink-21.0.0-py2.py3-none-any.whl (74 kB)
[pijuice]  Collecting zope.interface>=4.4.2
[pijuice]    Downloading zope.interface-5.4.0.tar.gz (249 kB)
[pijuice]  Requirement already satisfied: setuptools in /usr/local/lib/python3.6/site-packages (from zope.interface>=4.4.2->Twisted>=18.7.0->balena-sdk==7.1.0->-r requirements.txt (line 1)) (57.4.0)
[pijuice]  Collecting pyasn1
[pijuice]    Downloading pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
[pijuice]  Collecting pyasn1-modules
[pijuice]    Downloading pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
[pijuice]  Using legacy 'setup.py install' for balena-sdk, since package 'wheel' is not installed.
[pijuice]  Using legacy 'setup.py install' for cffi, since package 'wheel' is not installed.
[pijuice]  Using legacy 'setup.py install' for zope.interface, since package 'wheel' is not installed.
[pijuice]  Building wheels for collected packages: cryptography
[pijuice]    Building wheel for cryptography (PEP 517): started
[pijuice]    Building wheel for cryptography (PEP 517): finished with status 'error'
[pijuice]    ERROR: Command errored out with exit status 1:
[pijuice]     command: /usr/local/bin/python3.6 /usr/local/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpuko6l_p5
[pijuice]         cwd: /tmp/pip-install-ghvsrm06/cryptography_453c991c6b7e49429dc5d64d9a5b3fa1
[pijuice]    Complete output (168 lines):
[pijuice]    running bdist_wheel
[pijuice]    running build
[pijuice]    running build_py
[pijuice]    creating build
[pijuice]    creating build/lib.linux-armv7l-3.6
[pijuice]    creating build/lib.linux-armv7l-3.6/cryptography
[pijuice]    copying src/cryptography/__init__.py -> build/lib.linux-armv7l-3.6/cryptography
[pijuice]    copying src/cryptography/utils.py -> build/lib.linux-armv7l-3.6/cryptography
[pijuice]    copying src/cryptography/__about__.py -> build/lib.linux-armv7l-3.6/cryptography
[pijuice]    copying src/cryptography/exceptions.py -> build/lib.linux-armv7l-3.6/cryptography
[pijuice]    copying src/cryptography/fernet.py -> build/lib.linux-armv7l-3.6/cryptography
[pijuice]    creating build/lib.linux-armv7l-3.6/cryptography/hazmat
[pijuice]    copying src/cryptography/hazmat/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat
[pijuice]    copying src/cryptography/hazmat/_oid.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat
[pijuice]    creating build/lib.linux-armv7l-3.6/cryptography/x509
[pijuice]    copying src/cryptography/x509/certificate_transparency.py -> build/lib.linux-armv7l-3.6/cryptography/x509
[pijuice]    copying src/cryptography/x509/extensions.py -> build/lib.linux-armv7l-3.6/cryptography/x509
[pijuice]    copying src/cryptography/x509/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/x509
[pijuice]    copying src/cryptography/x509/name.py -> build/lib.linux-armv7l-3.6/cryptography/x509
[pijuice]    copying src/cryptography/x509/general_name.py -> build/lib.linux-armv7l-3.6/cryptography/x509
[pijuice]    copying src/cryptography/x509/oid.py -> build/lib.linux-armv7l-3.6/cryptography/x509
[pijuice]    copying src/cryptography/x509/ocsp.py -> build/lib.linux-armv7l-3.6/cryptography/x509
[pijuice]    copying src/cryptography/x509/base.py -> build/lib.linux-armv7l-3.6/cryptography/x509
[pijuice]    creating build/lib.linux-armv7l-3.6/cryptography/hazmat/bindings
[pijuice]    copying src/cryptography/hazmat/bindings/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/bindings
[pijuice]    creating build/lib.linux-armv7l-3.6/cryptography/hazmat/backends
[pijuice]    copying src/cryptography/hazmat/backends/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends
[pijuice]    copying src/cryptography/hazmat/backends/interfaces.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends
[pijuice]    creating build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
[pijuice]    copying src/cryptography/hazmat/primitives/_serialization.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
[pijuice]    copying src/cryptography/hazmat/primitives/constant_time.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
[pijuice]    copying src/cryptography/hazmat/primitives/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
[pijuice]    copying src/cryptography/hazmat/primitives/keywrap.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
[pijuice]    copying src/cryptography/hazmat/primitives/_cipheralgorithm.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
[pijuice]    copying src/cryptography/hazmat/primitives/cmac.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
[pijuice]    copying src/cryptography/hazmat/primitives/padding.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
[pijuice]    copying src/cryptography/hazmat/primitives/hmac.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
[pijuice]    copying src/cryptography/hazmat/primitives/_asymmetric.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
[pijuice]    copying src/cryptography/hazmat/primitives/hashes.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
[pijuice]    copying src/cryptography/hazmat/primitives/poly1305.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives
[pijuice]    creating build/lib.linux-armv7l-3.6/cryptography/hazmat/bindings/openssl
[pijuice]    copying src/cryptography/hazmat/bindings/openssl/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/bindings/openssl
[pijuice]    copying src/cryptography/hazmat/bindings/openssl/binding.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/bindings/openssl
[pijuice]    copying src/cryptography/hazmat/bindings/openssl/_conditional.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/bindings/openssl
[pijuice]    creating build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    copying src/cryptography/hazmat/backends/openssl/ciphers.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    copying src/cryptography/hazmat/backends/openssl/x25519.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    copying src/cryptography/hazmat/backends/openssl/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    copying src/cryptography/hazmat/backends/openssl/x509.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    copying src/cryptography/hazmat/backends/openssl/ec.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    copying src/cryptography/hazmat/backends/openssl/rsa.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    copying src/cryptography/hazmat/backends/openssl/backend.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    copying src/cryptography/hazmat/backends/openssl/cmac.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    copying src/cryptography/hazmat/backends/openssl/x448.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    copying src/cryptography/hazmat/backends/openssl/aead.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    copying src/cryptography/hazmat/backends/openssl/dh.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    copying src/cryptography/hazmat/backends/openssl/hmac.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    copying src/cryptography/hazmat/backends/openssl/utils.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    copying src/cryptography/hazmat/backends/openssl/hashes.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    copying src/cryptography/hazmat/backends/openssl/ed448.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    copying src/cryptography/hazmat/backends/openssl/poly1305.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    copying src/cryptography/hazmat/backends/openssl/decode_asn1.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    copying src/cryptography/hazmat/backends/openssl/ed25519.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    copying src/cryptography/hazmat/backends/openssl/dsa.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    copying src/cryptography/hazmat/backends/openssl/encode_asn1.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/backends/openssl
[pijuice]    creating build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/twofactor
[pijuice]    copying src/cryptography/hazmat/primitives/twofactor/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/twofactor
[pijuice]    copying src/cryptography/hazmat/primitives/twofactor/totp.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/twofactor
[pijuice]    copying src/cryptography/hazmat/primitives/twofactor/hotp.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/twofactor
[pijuice]    creating build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/kdf
[pijuice]    copying src/cryptography/hazmat/primitives/kdf/pbkdf2.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/kdf
[pijuice]    copying src/cryptography/hazmat/primitives/kdf/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/kdf
[pijuice]    copying src/cryptography/hazmat/primitives/kdf/concatkdf.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/kdf
[pijuice]    copying src/cryptography/hazmat/primitives/kdf/x963kdf.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/kdf
[pijuice]    copying src/cryptography/hazmat/primitives/kdf/scrypt.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/kdf
[pijuice]    copying src/cryptography/hazmat/primitives/kdf/kbkdf.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/kdf
[pijuice]    copying src/cryptography/hazmat/primitives/kdf/hkdf.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/kdf
[pijuice]    creating build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/serialization
[pijuice]    copying src/cryptography/hazmat/primitives/serialization/ssh.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/serialization
[pijuice]    copying src/cryptography/hazmat/primitives/serialization/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/serialization
[pijuice]    copying src/cryptography/hazmat/primitives/serialization/pkcs7.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/serialization
[pijuice]    copying src/cryptography/hazmat/primitives/serialization/pkcs12.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/serialization
[pijuice]    copying src/cryptography/hazmat/primitives/serialization/base.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/serialization
[pijuice]    creating build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/ciphers
[pijuice]    copying src/cryptography/hazmat/primitives/ciphers/algorithms.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/ciphers
[pijuice]    copying src/cryptography/hazmat/primitives/ciphers/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/ciphers
[pijuice]    copying src/cryptography/hazmat/primitives/ciphers/modes.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/ciphers
[pijuice]    copying src/cryptography/hazmat/primitives/ciphers/aead.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/ciphers
[pijuice]    copying src/cryptography/hazmat/primitives/ciphers/base.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/ciphers
[pijuice]    creating build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
[pijuice]    copying src/cryptography/hazmat/primitives/asymmetric/x25519.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
[pijuice]    copying src/cryptography/hazmat/primitives/asymmetric/__init__.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
[pijuice]    copying src/cryptography/hazmat/primitives/asymmetric/ec.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
[pijuice]    copying src/cryptography/hazmat/primitives/asymmetric/rsa.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
[pijuice]    copying src/cryptography/hazmat/primitives/asymmetric/x448.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
[pijuice]    copying src/cryptography/hazmat/primitives/asymmetric/padding.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
[pijuice]    copying src/cryptography/hazmat/primitives/asymmetric/dh.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
[pijuice]    copying src/cryptography/hazmat/primitives/asymmetric/utils.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
[pijuice]    copying src/cryptography/hazmat/primitives/asymmetric/ed448.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
[pijuice]    copying src/cryptography/hazmat/primitives/asymmetric/ed25519.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
[pijuice]    copying src/cryptography/hazmat/primitives/asymmetric/dsa.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
[pijuice]    copying src/cryptography/hazmat/primitives/asymmetric/types.py -> build/lib.linux-armv7l-3.6/cryptography/hazmat/primitives/asymmetric
[pijuice]    running egg_info
[pijuice]    writing src/cryptography.egg-info/PKG-INFO
[pijuice]    writing dependency_links to src/cryptography.egg-info/dependency_links.txt
[pijuice]    writing requirements to src/cryptography.egg-info/requires.txt
[pijuice]    writing top-level names to src/cryptography.egg-info/top_level.txt
[pijuice]    reading manifest file 'src/cryptography.egg-info/SOURCES.txt'
[pijuice]    reading manifest template 'MANIFEST.in'
[pijuice]    no previously-included directories found matching 'docs/_build'
[pijuice]    warning: no previously-included files found matching 'vectors'
[pijuice]    warning: no previously-included files matching '*' found under directory 'vectors'
[pijuice]    warning: no previously-included files matching '*' found under directory '.github'
[pijuice]    warning: no previously-included files found matching 'release.py'
[pijuice]    warning: no previously-included files found matching '.coveragerc'
[pijuice]    warning: no previously-included files found matching 'codecov.yml'
[pijuice]    warning: no previously-included files found matching '.readthedocs.yml'
[pijuice]    warning: no previously-included files found matching 'dev-requirements.txt'
[pijuice]    warning: no previously-included files found matching 'tox.ini'
[pijuice]    warning: no previously-included files found matching 'mypy.ini'
[pijuice]    warning: no previously-included files matching '*' found under directory '.zuul.d'
[pijuice]    warning: no previously-included files matching '*' found under directory '.zuul.playbooks'
[pijuice]    adding license file 'LICENSE'
[pijuice]    adding license file 'LICENSE.APACHE'
[pijuice]    adding license file 'LICENSE.BSD'
[pijuice]    adding license file 'LICENSE.PSF'
[pijuice]    writing manifest file 'src/cryptography.egg-info/SOURCES.txt'
[pijuice]    copying src/cryptography/py.typed -> build/lib.linux-armv7l-3.6/cryptography
[pijuice]    creating build/lib.linux-armv7l-3.6/cryptography/hazmat/bindings/_rust
[pijuice]    copying src/cryptography/hazmat/bindings/_rust/__init__.pyi -> build/lib.linux-armv7l-3.6/cryptography/hazmat/bindings/_rust
[pijuice]    copying src/cryptography/hazmat/bindings/_rust/asn1.pyi -> build/lib.linux-armv7l-3.6/cryptography/hazmat/bindings/_rust
[pijuice]    copying src/cryptography/hazmat/bindings/_rust/ocsp.pyi -> build/lib.linux-armv7l-3.6/cryptography/hazmat/bindings/_rust
[pijuice]    copying src/cryptography/hazmat/bindings/_rust/x509.pyi -> build/lib.linux-armv7l-3.6/cryptography/hazmat/bindings/_rust
[pijuice]    running build_ext
[pijuice]    running build_rust
[pijuice]        =============================DEBUG ASSISTANCE=============================
[pijuice]        If you are seeing a compilation error please try the following steps to
[pijuice]        successfully install cryptography:
[pijuice]        1) Upgrade to the latest pip and try again. This will fix errors for most
[pijuice]           users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
[pijuice]        2) Read https://cryptography.io/en/latest/installation/ for specific
[pijuice]           instructions for your platform.
[pijuice]        3) Check our frequently asked questions for more information:
[pijuice]           https://cryptography.io/en/latest/faq/
[pijuice]        4) Ensure you have a recent Rust toolchain installed:
[pijuice]           https://cryptography.io/en/latest/installation/#rust
[pijuice]        Python: 3.6.14
[pijuice]        platform: Linux-5.4.0-72-generic-armv7l-with-debian-9.13
[pijuice]        pip: n/a
[pijuice]        setuptools: 59.6.0
[pijuice]        setuptools_rust: 1.1.2
[pijuice]        =============================DEBUG ASSISTANCE=============================
[pijuice]    error: can't find Rust compiler
[pijuice]    If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
[pijuice]    To update pip, run:
[pijuice]        pip install --upgrade pip
[pijuice]    and then retry package installation.
[pijuice]    If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
[pijuice]    This package requires Rust >=1.41.0.
[pijuice]    ----------------------------------------
[pijuice]  
[pijuice]    ERROR: Failed building wheel for cryptography
[pijuice]  
[pijuice]  Failed to build cryptography
[pijuice]  ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
[pijuice]  
[pijuice]  WARNING: You are using pip version 21.2.3; however, version 21.3.1 is available.
[pijuice]  You should consider upgrading via the '/usr/local/bin/python3.6 -m pip install --upgrade pip' command.
[pijuice]  
[pijuice]  Removing intermediate container daf93ae4350f
[pijuice]  The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
[Info]     Uploading images
[Success]  Successfully uploaded images
[Error]    Some services failed to build:
[Error]      Service: pijuice
[Error]        Error: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
[Info]     Built on arm05
[Error]    Not deploying release.
Remote build failed

Looks like there is this error

[pijuice]  Failed to build cryptography
[pijuice]  ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly

Could you please change this from the Dockerfile?

is your project open source? i don’t have a pijuice but i would like to see your docker-compose or Dockerfile.template to double check.

At this stage, all I was trying to do there was push balena-pijuice to my fleet. No other changes.

So the docker-compose.yml file is exactly

version: '2'
services:
  pijuice:
    build: ./pijuice
    privileged: true
    labels: 
      io.balena.features.balena-api: '1'
  sample:
    build: ./sample

Am I completely off-course here? :thinking:

@hardy could you please help here? :pray:

Hi,

I did not know about the project GitHub - balenalabs-incubator/balena-pijuice: Project to use PiJuice with a Raspberry Pi. It seems quite old though and has not received any updates for quite some time.

I have a PiJuice myself which I use for a project measuring the temperature at a remote location. See GitHub - hferentschik/balena-strand: Balena App using a PiJuice and 1-wire DS18B20 to measure and record water temperature.. The difference lies in the Dockerfile and the base OS version (Dockerfille).
In general, everything you need is in the pijuice-gui package.

Depending on your Raspberry Pi version you might have to change the base image in the Dockerfile (I probably should make this a template). Give it a try.

–Hardy

1 Like

@istocky Did you manage to figure this out?

1 Like

Hi - I could be barking completely up the wrong tree, but in case it helps anyone else who;s having the same issue as me, I was getting some issues whilst migrating a Zero2 Pi/PiJuice project to Balena, and ended up getting the same Failed building wheel for cryptography error you had above - and I think I resolved it by moving from stretch to buster:

In my Dockerfile:

FROM balenalib/%%BALENA_MACHINE_NAME%%-python:3-stretch-build

FROM balenalib/%%BALENA_MACHINE_NAME%%-python:3-buster-build

See here for more info if it helps.

2 Likes

That’s good that you could solve the issue moving from stretch to buster. Thanks for sharing @leighghunt :slight_smile:

I didn’t if I’m honest.

I ended up moving to a different signage provider - that deploys their applications slightly differently and negated the need for me to continue wading in the weeds of balena. As much as I love the platform and it served me a purpose, I was always way over my head with it. It was me not the platform which was at fault.

The new signage platform does all the middleware stuff for me (that I was doing via balena).

Hope others can benefit from @leighghunt 's response.