Skip to content

Commit f3450c3

Browse files
xumiacentecqianj
authored andcommitted
[Build][202012] Fix the PyYang python package installation issue (sonic-net#15890) (sonic-net#15903)
* [Build] Fix the PyYang python package installation issue (sonic-net#15890) Why I did it Fix the armhf build failure. How to reproduce the issue: docker run -it debain:bullseye bash apt-get update && apt-get install -y python3-pip pip3 install PyYAML==5.4.1 Error message: Collecting PyYAML==5.4.1 Installing build dependencies ... done Getting requirements to build wheel ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3 /tmp/tmp6xabslgb_in_process.py get_requires_for_build_wheel /tmp/tmp_er01ztl .... raise AttributeError(attr) AttributeError: cython_sources ---------------------------------------- WARNING: Discarding https://files.pythonhosted.org/packages/a0/a4/d63f2d7597e1a4b55aa3b4d6c5b029991d3b824b5bd331af8d4ab1ed687d/PyYAML-5.4.1.tar.gz#sha256=607774cbba28732bfa802b54baa7484215f530991055bb562efbed5b2f20a45e (from https://pypi.org/simple/pyyaml/) (requires-python:>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*). Command errored out with exit status 1: /usr/bin/python3 /tmp/tmp6xabslgb_in_process.py get_requires_for_build_wheel /tmp/tmp_er01ztl Check the logs for full command output. ERROR: Could not find a version that satisfies the requirement PyYAML==5.4.1 ERROR: No matching distribution found for PyYAML==5.4.1 root@fa2fa92edcfd:/# But if adding the option --no-build-isolation, then it is good, see fix. install "PyYAML==5.4.1" --no-build-isolation The same error can be found in the multiple builds. Work item tracking Microsoft ADO (number only): 24567457 How I did it Add a build option --no-build-isolation. * Fix docker-platform-monitor python2 issue * Fix wheel dependency issue * Fix wheel dependency issue * Fix the pip2 PyYAML in host image
1 parent 1bdfb5e commit f3450c3

5 files changed

Lines changed: 25 additions & 5 deletions

File tree

build_debian.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,10 @@ sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'docke
439439
# Install scapy
440440
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'scapy==2.4.4'
441441

442+
# The option --no-build-isolation can be removed when upgrading PyYAML to 6.0.1
443+
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install 'PyYAML==5.4.1' --no-build-isolation
444+
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'PyYAML==5.4.1' --no-build-isolation
445+
442446
## Note: keep pip installed for maintainance purpose
443447

444448
# Install GCC, needed for building/installing some Python packages

dockers/docker-config-engine-buster/Dockerfile.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ RUN apt-get install -y \
2323
RUN pip3 install pyangbind==0.8.1
2424
RUN pip3 uninstall -y enum34
2525

26+
# Fix armhf build failure
27+
# The option --no-build-isolation can be removed when upgrading PyYAML to 6.0.1
28+
RUN pip3 install PyYAML==5.4.1 --no-build-isolation
29+
2630
{% if docker_config_engine_buster_debs.strip() %}
2731
# Copy locally-built Debian package dependencies
2832
{{ copy_files("debs/", docker_config_engine_buster_debs.split(' '), "/debs/") }}

dockers/docker-platform-monitor/Dockerfile.j2

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ RUN pip2 install enum34
4646
RUN pip2 install thrift==0.13.0
4747
RUN pip3 install thrift==0.13.0
4848
49+
# We install the libpci module in order to be able to do PCI transactions
50+
RUN pip2 install libpci
51+
RUN pip3 install libpci
52+
53+
# The option --no-build-isolation can be removed when upgrading PyYAML to 6.0.1
54+
# The the PyYAML for python3 has already installed in the base image docker-config-engine
55+
RUN pip2 install wheel==0.37.1
56+
RUN pip2 install PyYAML==5.4.1 --no-build-isolation
57+
4958
{% if docker_platform_monitor_debs.strip() -%}
5059
# Copy locally-built Debian package dependencies
5160
{{ copy_files("debs/", docker_platform_monitor_debs.split(' '), "/debs/") }}

dockers/docker-sonic-mgmt-framework/Dockerfile.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ RUN pip2 install --upgrade 'pip<21'
1515
RUN apt-get purge -y python-pip
1616
RUN pip2 install setuptools==40.8.0
1717
RUN pip2 install wheel==0.35.1
18+
RUN pip2 install PyYAML==5.4.1 --no-build-isolation
19+
1820
RUN pip2 install connexion==1.1.15 \
1921
setuptools==21.0.0 \
2022
grpcio-tools==1.20.0 \

sonic-slave-buster/Dockerfile.j2

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,13 +418,14 @@ RUN pip3 uninstall -y enum34
418418
RUN pip2 install j2cli==0.3.10
419419
420420
# For sonic-mgmt-framework
421-
RUN pip2 install "PyYAML==5.4.1"
422-
RUN pip3 install "PyYAML==5.4.1"
423-
RUN pip2 install "lxml==4.6.2"
424-
RUN pip3 install "lxml==4.6.2"
421+
# The option --no-build-isolation can be removed when upgrading PyYAML to 6.0.1
422+
RUN pip2 install "PyYAML==5.4.1" --no-build-isolation
423+
RUN pip3 install "PyYAML==5.4.1" --no-build-isolation
424+
RUN pip2 install "lxml==4.6.5"
425+
RUN pip3 install "lxml==4.6.5"
425426
426427
# For sonic-platform-common testing
427-
RUN pip3 install redis
428+
RUN pip3 install redis==3.5.3
428429
429430
# For vs image build
430431
RUN pip2 install pexpect==4.6.0

0 commit comments

Comments
 (0)