Hi all, I met a problem that I successfully pushed the Dockerfile to balena cloud, however, it shows the error in Logs window and the application cannot be applied. It seems like the pyaudio is not imported, however, I cannot find what the problem is.
My Docker file is shown as:
FROM balenalib/fincm3-debian-python:latest
#RUN install_packages git
RUN apt-get update
RUN apt-get install python -y
&& apt-get install python3-pip -y
RUN apt-get install build-essential -y
RUN apt-get install -y python3-dev -y
RUN apt-get install python3-setuptools -y
RUN apt-get install libportaudio0 libportaudio2 libportaudiocpp0 portaudio19-dev -y
RUN pip3 install wheel
RUN pip3 install pyaudio numpy matplotlib scipy
You seem to be installing pyaudio into the Python 3 installation, but then run your application with the interpreter provided by the default installation in the base image. Can you try CMD [“python3”,"/usr/src/app/Recorder.py"] instead?
hey @Xia,
can you confirm which module cannot be imported? it is not clear from the above screenshot
also, just to confirm, have you tried this on your machine and can confirm it works with similar python and library versions?
@rahul-thakoor I cannot import numpy. I tried this on my machine and it works. I am not sure why it works in Pythonon my laptop but not after I pushed and ran on Balena Fin
@rahul-thakoor I basically reinstalled numpy to the certain version of 1.18.4, and included in Dockerfile and pushed the image, but it still shows error for Importerror of numpy
Hello @Xia , I’ve tested with the following Dockerfile, importing pyaudio works fine.
Just replace amd64 with fincm3 if you’re using a Fin in the FROM line.
exec format error means you’re running some code that’s intended for a different architecture. What type of architecture does your local device have (where you are running build command)?
Also I noticed that you are using FROM balenalib/amd64-debian-python:latest which resolves to 2.7.16. I think you need python 3. See https://hub.docker.com/r/balenalib/amd64-debian-python under title Supported versions and respective Dockerfile links
@karaxuna its x64 Windows. I tried with pythons 3 but the error is still shows with Importerror of Numpy. I am wondering why the pyaudio is successful but Numpy shows error.