Error when building with pip requirements.txt

Hi,
I am tring to control LED connected to RPi by using python image.
In the folder I have Dockerfile:

FROM balenalib/raspberrypi3-fedora-python:latest
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD [ "python", "./blink.py" ]

in the requirements.txt file i have one line:

RPi.GPIO

When i push i get this error:

[Info] Starting build for Test1, user banto_78
[Info] Dashboard link: https://dashboard.balena-cloud.com/apps/1486482/devices
[Info] Building on arm03
[Info] Pulling previous images for caching purposes…
[Success] Successfully pulled cache images
[main] Step 1/6 : FROM balenalib/raspberrypi3-fedora-python:latest
[main] β€”> 407d99f08514
[main] Step 2/6 : WORKDIR /usr/src/app
[main] Using cache
[main] β€”> 666da3417eb6
[main] Step 3/6 : COPY requirements.txt ./
[main] β€”> 12875a48d3cd
[main] Step 4/6 : RUN pip install --no-cache-dir -r requirements.txt
[main] β€”> Running in 7446600a92e4
[main] DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won’t be maintained after that date. A future version of pip will drop support for Python 2.7.
[main]
[main] Collecting RPi.GPIO (from -r requirements.txt (line 1))
[main] Downloading https://files.pythonhosted.org/packages/cb/88/d3817eb11fc77a8d9a63abeab8fe303266b1e3b85e2952238f0da43fed4e/RPi.GPIO-0.7.0.tar.gz
[main] Installing collected packages: RPi.GPIO
[main] Running setup.py install for RPi.GPIO: started
[main] Running setup.py install for RPi.GPIO: finished with status β€˜error’
[main] ERROR: Complete output from command /usr/bin/python2 -u -c β€˜import setuptools, tokenize;file=’"’"’/tmp/pip-install-usQurO/RPi.GPIO/setup.py’"’"’;f=getattr(tokenize, β€˜"’"β€˜open’"’"’, open)(file);code=f.read().replace(’"’"’\r\n’"’"’, β€˜"’"’\n’"’"’);f.close();exec(compile(code, file, β€˜"’"β€˜exec’"’"’))’ install --record /tmp/pip-record-8EW2gp/install-record.txt --single-version-externally-managed --compile:
[main]
[main] ERROR: running install
[main] running build
[main] running build_py
[main] creating build
[main] creating build/lib.linux-armv7l-2.7
[main] creating build/lib.linux-armv7l-2.7/RPi
[main] copying RPi/init.py -> build/lib.linux-armv7l-2.7/RPi
[main] creating build/lib.linux-armv7l-2.7/RPi/GPIO
[main] copying RPi/GPIO/init.py -> build/lib.linux-armv7l-2.7/RPi/GPIO
[main] running build_ext
[main] building β€˜RPi._GPIO’ extension
[main] creating build/temp.linux-armv7l-2.7
[main] creating build/temp.linux-armv7l-2.7/source
[main] gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -march=armv7-a -mfpu=vfpv3-d16 -mtune=generic-armv7-a -mabi=aapcs-linux -mfloat-abi=hard -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -march=armv7-a -mfpu=vfpv3-d16 -mtune=generic-armv7-a -mabi=aapcs-linux -mfloat-abi=hard -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c source/py_gpio.c -o build/temp.linux-armv7l-2.7/source/py_gpio.o
[main] unable to execute β€˜gcc’: No such file or directory
[main] error: command β€˜gcc’ failed with exit status 1
[main] ----------------------------------------
[main]
[main] ERROR: Command β€œ/usr/bin/python2 -u -c β€˜import setuptools, tokenize;file=’”’"’/tmp/pip-install-usQurO/RPi.GPIO/setup.py’"’"’;f=getattr(tokenize, β€˜"’"β€˜open’"’"’, open)(file);code=f.read().replace(’"’"’\r\n’"’"’, β€˜"’"’\n’"’"’);f.close();exec(compile(code, file, β€˜"’"β€˜exec’"’"’))’ install --record /tmp/pip-record-8EW2gp/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-usQurO/RPi.GPIO/
[main]
[main] WARNING: You are using pip version 19.1.1, however version 19.2.1 is available.
[main] You should consider upgrading via the β€˜pip install --upgrade pip’ command.
[main]
[main] Removing intermediate container 7446600a92e4
[Info] Uploading images
[main] The command β€˜/bin/sh -c pip install --no-cache-dir -r requirements.txt’ returned a non-zero code: 1
[Success] Successfully uploaded images
[Error] Some services failed to build:
[Error] Service: main
[Error] Error: The command β€˜/bin/sh -c pip install --no-cache-dir -r requirements.txt’ returned a non-zero code: 1
[Error] Not deploying release.
Remote build failed

Is pip already installed in the image?
Please suggest.

between: during build sometime i get:

An error occured: read ECONNRESET

Is there any interruption on build server?

Hi, sorry, we had an unexpected incident with our builders, that is being fixed up at the moment, you can see the status here: https://status.balena.io/incidents/n22xmfqlxk64

The builder issues are now resolved, could you retry the push again? Sorry for the inconvenience.

thanks it works. by the way I have changed the base image to:

 FROM balenalib/raspberrypi3-python:3.6-jessie-build

thanks.

Yeah, the base image change is not related to this issue today. Glad to hear that things work for you now, cheers!

1 Like