I’m trying to get the balena-cam project to build and deploy on the Raspberry Pi 4, but it fails. This is after a fresh git cone of the repo on Github. The errors start at Step 5/8 of the Dockerfile.
[balena-cam] Step 5/8 : RUN pip3 install aiohttp aiohttp_basicauth==0.1.3 aioice==0.6.10 aiortc==0.9.11 numpy==1.15.4 opencv-python==3.4.4.19 --index-url https://www.piwheels.org/simple
[balena-cam] ---> Running in 18d2479d3715
[balena-cam] DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
[balena-cam]
[balena-cam] Looking in indexes: https://www.piwheels.org/simple, https://www.piwheels.org/simple
[balena-cam] Collecting aiohttp
[balena-cam] Downloading https://www.piwheels.org/simple/aiohttp/aiohttp-3.6.3-cp35-cp35m-linux_armv7l.whl (1.1 MB)
[balena-cam] Collecting aiohttp_basicauth==0.1.3
[balena-cam] Downloading https://www.piwheels.org/simple/aiohttp-basicauth/aiohttp_basicauth-0.1.3-py3-none-any.whl (7.0 kB)
[balena-cam] Collecting aioice==0.6.10
[balena-cam] Downloading https://www.piwheels.org/simple/aioice/aioice-0.6.10-py3-none-any.whl (19 kB)
[balena-cam] Collecting aiortc==0.9.11
[balena-cam] Downloading https://www.piwheels.org/simple/aiortc/aiortc-0.9.11-cp35-cp35m-linux_armv7l.whl (112 kB)
[balena-cam] Collecting numpy==1.15.4
[balena-cam] Downloading https://www.piwheels.org/simple/numpy/numpy-1.15.4-cp35-cp35m-linux_armv7l.whl (6.4 MB)
[balena-cam] ERROR: Could not find a version that satisfies the requirement opencv-python==3.4.4.19
[balena-cam]
[balena-cam] ERROR: No matching distribution found for opencv-python==3.4.4.19
[balena-cam]
[balena-cam] Removing intermediate container 18d2479d3715
[balena-cam] The command '/bin/sh -c pip3 install aiohttp aiohttp_basicauth==0.1.3 aioice==0.6.10 aiortc==0.9.11 numpy==1.15.4 opencv-python==3.4.4.19 --index-url https://www.piwheels.org/simple' returned a non-zero code: 1
[Info] Uploading images
[Success] Successfully uploaded images
[Error] Some services failed to build:
[Error] Service: balena-cam
[Error] Error: The command '/bin/sh -c pip3 install aiohttp aiohttp_basicauth==0.1.3 aioice==0.6.10 aiortc==0.9.11 numpy==1.15.4 opencv-python==3.4.4.19 --index-url https://www.piwheels.org/simple' returned a non-zero code: 1
[Info] Built on arm05
[Error] Not deploying release.
Remote build failed
After checking pipy.org, there is a 3.4.4.19 release of opencv-python, so I’m not sure why it’s failing here. Perhaps there is also a compatibility issue with Python 3.5 being EOL.
Update: I got it to build and deploy by editing the two Dockerfiles (balena-cam/Dockerfile.template and balena-cam/Dockerfile.aarch64), with the following line.
Update2: added libgtk-3-dev to the apt-get install list of packages and now it’s complaining about numpy.
03.08.21 14:30:13 (-0400) Restarting service 'balena-cam sha256:227e6b747b02af8c150cea5f8a7ede8dbe1b1eb350d6c3850c2679f61d9003d6'
03.08.21 14:30:14 (-0400) balena-cam ImportError: No module named 'numpy.core._multiarray_umath'
03.08.21 14:30:14 (-0400) balena-cam Traceback (most recent call last):
03.08.21 14:30:14 (-0400) balena-cam File "/usr/src/app/server.py", line 1, in <module>
03.08.21 14:30:14 (-0400) balena-cam import asyncio, json, os, cv2, platform, sys
03.08.21 14:30:14 (-0400) balena-cam File "/usr/local/lib/python3.5/dist-packages/cv2/__init__.py", line 5, in <module>
03.08.21 14:30:14 (-0400) balena-cam from .cv2 import *
03.08.21 14:30:14 (-0400) balena-cam ImportError: numpy.core.multiarray failed to import
03.08.21 14:30:15 (-0400) Service exited 'balena-cam sha256:227e6b747b02af8c150cea5f8a7ede8dbe1b1eb350d6c3850c2679f61d9003d6'
I feel like I’m chasing down a rabbit hole, so it might be best to let the developers sort out these issues. Can anyone attempt to build & deploy balena-cam from scratch, then try to fix all the deps?
@yuvsaha123 & @dtischler, I was able to fix it on my side. You can see the changed Dockerfiles on my GitHub fork:
Also, I still ran into this issue with Chrome and Safari. The README.md has instructions for Chrome and Firefox, but not Safari. So for anyone reading this thread, the fix to get the camera video when using Safari is…
Enable Show Develop menu in the menu bar from the Safari: Preferences: Advanced tab.
@bstein2379, I was not able to reproduce your original error on a fresh clone of the current version of balenaCam for the Raspberry Pi 4 (or 3) and it deployed properly. If you are able, can you try again and see if you still get the same error? (Or perhaps I did something differently?)
[balena-cam] Step 5/8 : RUN pip3 install aiohttp aiohttp_basicauth==0.1.3 aioice==0.6.10 aiortc==0.9.11 numpy==1.15.4 opencv-python==3.4.4.19 --index-url https://www.piwheels.org/simple
[balena-cam] ---> Running in d9248d11ea2b
[balena-cam] DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
[balena-cam]
[balena-cam] Looking in indexes: https://www.piwheels.org/simple, https://www.piwheels.org/simple
[balena-cam] Collecting aiohttp
[balena-cam] Downloading https://www.piwheels.org/simple/aiohttp/aiohttp-3.6.3-cp35-cp35m-linux_armv7l.whl (1.1 MB)
[balena-cam] Collecting aiohttp_basicauth==0.1.3
[balena-cam] Downloading https://www.piwheels.org/simple/aiohttp-basicauth/aiohttp_basicauth-0.1.3-py3-none-any.whl (7.0 kB)
[balena-cam] Collecting aioice==0.6.10
[balena-cam] Downloading https://www.piwheels.org/simple/aioice/aioice-0.6.10-py3-none-any.whl (19 kB)
[balena-cam] Collecting aiortc==0.9.11
[balena-cam] Downloading https://www.piwheels.org/simple/aiortc/aiortc-0.9.11-cp35-cp35m-linux_armv7l.whl (112 kB)
[balena-cam] Collecting numpy==1.15.4
[balena-cam] Downloading https://www.piwheels.org/simple/numpy/numpy-1.15.4-cp35-cp35m-linux_armv7l.whl (6.4 MB)
[balena-cam] Collecting opencv-python==3.4.4.19
...
[balena-cam] Installing collected packages: pycparser, six, multidict, idna, cffi, yarl, typing-extensions, netifaces, idna-ssl, cryptography, chardet, attrs, pyopenssl, pylibsrtp, pyee, numpy, crcmod, aioice, aiohttp, opencv-python, aiortc, aiohttp-basicauth
[balena-cam] Successfully installed aiohttp-3.6.3 aiohttp-basicauth-0.1.3 aioice-0.6.10 aiortc-0.9.11 attrs-21.2.0 cffi-1.14.6 chardet-3.0.4 crcmod-1.7 cryptography-3.2.1 idna-3.2 idna-ssl-1.1.0 multidict-4.7.6 netifaces-0.11.0 numpy-1.15.4 opencv-python-3.4.4.19 pycparser-2.20 pyee-8.1.0 pylibsrtp-0.6.8 pyopenssl-20.0.1 six-1.16.0 typing-extensions-3.10.0.0 yarl-1.4.2
[balena-cam] Removing intermediate container d9248d11ea2b
Yep, indeed it’s deploying now with a fresh git clone. Maybe there was an intermittent issue about a week ago on the pip or piwheels side?
However, did you also try to deploy it to the Pi 3 or 4 and test the app with a browser? I’m seeing this error in the console…
11.08.21 14:19:24 (-0400) balena-cam /usr/local/lib/python3.5/dist-packages/aiortc/rtcdtlstransport.py:12: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python.
11.08.21 14:19:24 (-0400) balena-cam from cryptography.hazmat.backends import default_backend
11.08.21 14:19:24 (-0400) balena-cam Video device is not ready
11.08.21 14:19:24 (-0400) balena-cam Trying to load bcm2835-v4l2 driver...
balena-cam /usr/local/lib/python3.5/dist-packages/aiortc/rtcdtlstransport.py:12: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python.
balena-cam from cryptography.hazmat.backends import default_backend
balena-cam Video device is ready
balena-cam
balena-cam #############################################################
11.08.21 18:36:53 (+0000) Supervisor starting
11.08.21 18:10:41 (+0000) balena-cam /usr/local/lib/python3.5/dist-packages/aiortc/rtcdtlstransport.py:12: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python.
11.08.21 18:10:41 (+0000) balena-cam from cryptography.hazmat.backends import default_backend
11.08.21 18:10:42 (+0000) balena-cam Video device is ready
Ahh, after flashing the SD card again, it came up as a new device within the fleet and I forgot to add the custom configuration variables for the Raspberry Pi camera module
All good now and fully working E2E! Thanks guys. Feel free to take a look at my fork if you are interested in updating the repo in the future (when you have time).