From f3450c3bf13efd18c6081ef8ef0fcc30445f520c Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Sun, 23 Jul 2023 10:00:15 +0800 Subject: [PATCH] [Build][202012] Fix the PyYang python package installation issue (#15890) (#15903) * [Build] Fix the PyYang python package installation issue (#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 --- build_debian.sh | 4 ++++ dockers/docker-config-engine-buster/Dockerfile.j2 | 4 ++++ dockers/docker-platform-monitor/Dockerfile.j2 | 9 +++++++++ dockers/docker-sonic-mgmt-framework/Dockerfile.j2 | 2 ++ sonic-slave-buster/Dockerfile.j2 | 11 ++++++----- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index 85e5f10a0ca2..52f135dd50b1 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -439,6 +439,10 @@ sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'docke # Install scapy sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'scapy==2.4.4' +# The option --no-build-isolation can be removed when upgrading PyYAML to 6.0.1 +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install 'PyYAML==5.4.1' --no-build-isolation +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'PyYAML==5.4.1' --no-build-isolation + ## Note: keep pip installed for maintainance purpose # Install GCC, needed for building/installing some Python packages diff --git a/dockers/docker-config-engine-buster/Dockerfile.j2 b/dockers/docker-config-engine-buster/Dockerfile.j2 index 3022546a068c..6a638f58c008 100644 --- a/dockers/docker-config-engine-buster/Dockerfile.j2 +++ b/dockers/docker-config-engine-buster/Dockerfile.j2 @@ -23,6 +23,10 @@ RUN apt-get install -y \ RUN pip3 install pyangbind==0.8.1 RUN pip3 uninstall -y enum34 +# Fix armhf build failure +# The option --no-build-isolation can be removed when upgrading PyYAML to 6.0.1 +RUN pip3 install PyYAML==5.4.1 --no-build-isolation + {% if docker_config_engine_buster_debs.strip() %} # Copy locally-built Debian package dependencies {{ copy_files("debs/", docker_config_engine_buster_debs.split(' '), "/debs/") }} diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index 482b5ccd9b25..936426273f98 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -46,6 +46,15 @@ RUN pip2 install enum34 RUN pip2 install thrift==0.13.0 RUN pip3 install thrift==0.13.0 +# We install the libpci module in order to be able to do PCI transactions +RUN pip2 install libpci +RUN pip3 install libpci + +# The option --no-build-isolation can be removed when upgrading PyYAML to 6.0.1 +# The the PyYAML for python3 has already installed in the base image docker-config-engine +RUN pip2 install wheel==0.37.1 +RUN pip2 install PyYAML==5.4.1 --no-build-isolation + {% if docker_platform_monitor_debs.strip() -%} # Copy locally-built Debian package dependencies {{ copy_files("debs/", docker_platform_monitor_debs.split(' '), "/debs/") }} diff --git a/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 b/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 index 5ee8cae84466..475d8739e588 100644 --- a/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 @@ -15,6 +15,8 @@ RUN pip2 install --upgrade 'pip<21' RUN apt-get purge -y python-pip RUN pip2 install setuptools==40.8.0 RUN pip2 install wheel==0.35.1 +RUN pip2 install PyYAML==5.4.1 --no-build-isolation + RUN pip2 install connexion==1.1.15 \ setuptools==21.0.0 \ grpcio-tools==1.20.0 \ diff --git a/sonic-slave-buster/Dockerfile.j2 b/sonic-slave-buster/Dockerfile.j2 index 2efb61f733b2..0c9f50152879 100644 --- a/sonic-slave-buster/Dockerfile.j2 +++ b/sonic-slave-buster/Dockerfile.j2 @@ -418,13 +418,14 @@ RUN pip3 uninstall -y enum34 RUN pip2 install j2cli==0.3.10 # For sonic-mgmt-framework -RUN pip2 install "PyYAML==5.4.1" -RUN pip3 install "PyYAML==5.4.1" -RUN pip2 install "lxml==4.6.2" -RUN pip3 install "lxml==4.6.2" +# The option --no-build-isolation can be removed when upgrading PyYAML to 6.0.1 +RUN pip2 install "PyYAML==5.4.1" --no-build-isolation +RUN pip3 install "PyYAML==5.4.1" --no-build-isolation +RUN pip2 install "lxml==4.6.5" +RUN pip3 install "lxml==4.6.5" # For sonic-platform-common testing -RUN pip3 install redis +RUN pip3 install redis==3.5.3 # For vs image build RUN pip2 install pexpect==4.6.0