Skip to content

Commit 625c66d

Browse files
xumiasonic-otn
authored andcommitted
[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.
1 parent 6d9d293 commit 625c66d

5 files changed

Lines changed: 16 additions & 3 deletions

File tree

build_debian.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,9 @@ sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'docke
546546
# Install scapy
547547
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'scapy==2.4.4'
548548

549+
# The option --no-build-isolation can be removed when upgrading PyYAML to 6.0.1
550+
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'PyYAML==5.4.1' --no-build-isolation
551+
549552
## Note: keep pip installed for maintainance purpose
550553

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

dockers/docker-config-engine-bullseye/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
# Install python-redis
2731
RUN pip3 install redis==4.5.4
2832

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
# Install python-redis
2731
RUN pip3 install redis==4.5.4
2832

sonic-slave-bullseye/Dockerfile.j2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,8 @@ RUN pip3 uninstall -y enum34
530530
RUN pip3 install j2cli==0.3.10
531531

532532
# For sonic-mgmt-framework
533-
RUN pip3 install "PyYAML==5.4.1"
533+
# The option --no-build-isolation can be removed when upgrading PyYAML to 6.0.1
534+
RUN pip3 install "PyYAML==5.4.1" --no-build-isolation
534535
{%- if CROSS_BUILD_ENVIRON != "y" %}
535536
RUN pip3 install "lxml==4.9.1"
536537
{%- endif %}

sonic-slave-buster/Dockerfile.j2

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,8 +541,9 @@ RUN pip3 install MarkupSafe==2.0.1
541541
RUN pip3 install Jinja2==3.0.3
542542
543543
# For sonic-mgmt-framework
544-
RUN pip2 install "PyYAML==5.4.1"
545-
RUN pip3 install "PyYAML==5.4.1"
544+
# The option --no-build-isolation can be removed when upgrading PyYAML to 6.0.1
545+
RUN pip2 install "PyYAML==5.4.1" --no-build-isolation
546+
RUN pip3 install "PyYAML==5.4.1" --no-build-isolation
546547
547548
{%- if CROSS_BUILD_ENVIRON != "y" %}
548549
RUN pip2 install "lxml==4.9.1"

0 commit comments

Comments
 (0)