Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,23 @@ if [ "${systemName}" = "Raspberry Pi" ] || [ "${systemName}" = "Orange Pi" ] ||
installAptPackages "libatlas-base-dev libopenblas-dev libblas-dev"
installAptPackages "liblapack-dev patchelf gfortran"

# Fix for lxml build failures on aarch64 when installing PaddleOCR dependencies.
# lxml>=5/6 may be built from source if no wheel is available on the mirror.
# Ensure system headers exist so a source build can succeed, and preinstall a
# compatible binary lxml for Python 3.8 to avoid building from source.
installAptPackages "libxml2-dev libxslt1-dev zlib1g-dev pkg-config"

if [ "$oneStepPIP" = false ]; then
installPythonPackagesByName "Cython six requests wheel pyyaml"
# Prefer a prebuilt wheel for Python 3.8 to avoid source builds on aarch64 mirrors.
if [ "${pythonVersion}" = "3.8" ]; then
installPythonPackagesByName "lxml==4.9.4" "lxml XML/HTML parser (preinstalled to avoid source build)"
fi
else
# When doing one-step pip, still try to mitigate lxml builds for Py3.8
if [ "${pythonVersion}" = "3.8" ]; then
installPythonPackagesByName "lxml==4.9.4" "lxml XML/HTML parser (preinstalled to avoid source build)"
fi
fi

"$venvPythonCmdPath" -m pip show paddlepaddle >/dev/null 2>/dev/null
Expand All @@ -69,6 +84,17 @@ if [ "${systemName}" = "Raspberry Pi" ] || [ "${systemName}" = "Orange Pi" ] ||

elif [ "${systemName}" = "Jetson" ]; then

# Ensure system headers for lxml in case a source build is needed by PaddleOCR deps
write "Ensuring system headers for lxml are present..." $color_info
sudo apt-get update -y >/dev/null 2>/dev/null
installAptPackages "libxml2-dev libxslt1-dev zlib1g-dev pkg-config"
writeLine "Done" $color_success

# For Python 3.8 on Jetson, preinstall a binary lxml to avoid building from source on aarch64
if [ "${pythonVersion}" = "3.8" ]; then
installPythonPackagesByName "lxml==4.9.4" "lxml XML/HTML parser (preinstalled to avoid source build)"
fi

case "$pythonVersion" in
"3.6")
wheel_file="paddlepaddle_gpu-2.4.1-cp36-cp36m-linux_aarch64.whl"
Expand Down Expand Up @@ -159,6 +185,11 @@ if [ "$os" = "macos" ]; then
else
installPythonPackagesByName "opencv-python" "OpenCV, the Computer Vision library for Python"
fi

# Preinstall lxml to avoid source builds on macOS if PaddleOCR pulls it in
if [ "${pythonVersion}" = "3.8" ]; then
installPythonPackagesByName "lxml==4.9.4" "lxml XML/HTML parser (preinstalled to avoid source build)"
fi
fi

if [ "${moduleInstallErrors}" = "" ]; then
Expand Down