diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index c155b18..5e10477 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -11,7 +11,10 @@ on: workflow_dispatch: # Allows you to run this workflow manually from the Actions tab - +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + env: BUILDKIT_PROGRESS: "plain" # Full logs for CI build. REGISTRY_URL: "docker.io" # docker.io or other target registry URL: where to push images to. @@ -77,7 +80,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: source ./tool.sh && build_image py-chem latest docker_core/Dockerfile --build-arg "ARG_PROFILE_PYTHON=datascience,mkl,chem" && push_image + - run: source ./tool.sh && build_image py-chem latest docker_core/Dockerfile --build-arg "ARG_PROFILE_PYTHON=datascience,mkl,chem,torch" && push_image qpod_py-std: name: 'py-std' diff --git a/docker_core/Dockerfile b/docker_core/Dockerfile index 418afeb..9294764 100644 --- a/docker_core/Dockerfile +++ b/docker_core/Dockerfile @@ -65,6 +65,10 @@ RUN set -eux \ && ( which java && echo "py4j % Install py4j if Java exists" >> /opt/utils/install_list_PY_datascience.pip || echo "Skip py4j install" ) \ ) || echo "Skip Python datascience packages install" ) \ # ----------------------------- + && export CUDA_VER=$(echo ${CUDA_VERSION:-"999"} | cut -c1-4 | sed 's/\.//' ) \ + && export IDX=$( [ -x "$(command -v nvcc)" ] && echo "cu${CUDA_VER:-117}" || echo "cpu" ) \ + && echo "Detected CUDA version=${CUDA_VER} and IDX=${IDX}" \ + # ----------------------------- && echo "Handle tensorflow installation 1.x/2.x, cpu/gpu: https://www.tensorflow.org/install/source#gpu" \ && ( $(grep -q "tf" <<< "${ARG_PROFILE_PYTHON}") && ( \ V=$($(grep -q "tf1" <<< "${ARG_PROFILE_PYTHON}") && echo "1" || echo "2" ) \ @@ -74,29 +78,25 @@ RUN set -eux \ # ----------------------------- && echo "Handle pytorch installation 1.x only, cpu/gpu: https://pytorch.org/get-started/locally/" \ && ( $(grep -q "torch" <<< "${ARG_PROFILE_PYTHON}") && ( \ - CUDA_VER=$(echo "${CUDA_VERSION:0:4}" | sed 's/\.//' ) \ - && echo "If CUDA version < 11.7, install pytorch 1.x, else install pytorch 2.x; if cuda doesn't exist, install pytorch 2.x" \ + echo "If CUDA version < 11.7, install pytorch 1.x, else install pytorch 2.x; if cuda doesn't exist, install pytorch 2.x" \ && export CUDA_VER_TORCH="117" && V=$([[ "${CUDA_VER:-999}" -lt "${CUDA_VER_TORCH}" ]] && echo "torch<2" || echo "torch") \ - && IDX=$( [ -x "$(command -v nvcc)" ] && echo "cu${CUDA_VER:-117}" || echo "cpu" ) \ - && export PIP_FIND_LINKS="https://download.pytorch.org/whl/${IDX}/torch_stable.html ${PIP_FIND_LINKS:-}" \ - && echo "${V}" > /opt/utils/install_list_PY_torch.pip \ + && pip install --no-cache-dir --root-user-action=ignore -U --pre "${V}" torchvision torchaudio --index-url "https://download.pytorch.org/whl/${IDX}" \ ) || echo "Skipping pytorch install" ) \ # ----------------------------- && echo "Handle paddle installation, cpu/gpu: https://www.paddlepaddle.org.cn/" \ - && if $(grep -q "paddle" <<< "${ARG_PROFILE_PYTHON}") ; then \ - URL_PYPI_PADDLE="https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html" \ - && export PIP_FIND_LINKS="${URL_PYPI_PADDLE} ${PIP_FIND_LINKS:-}" \ - && CUDA_VER=$(echo "${CUDA_VERSION:0:4}" | sed 's/\.//' ) \ + && ( $(grep -q "paddle" <<< "${ARG_PROFILE_PYTHON}") && ( \ + URL_PYPI_PADDLE="https://www.paddlepaddle.org.cn/packages/stable/${IDX}/" \ && PADDLE=$( [ -x "$(command -v nvcc)" ] && echo "paddlepaddle-gpu" || echo "paddlepaddle") \ - && PADDLE_VER=$(pip index versions ${PADDLE} -f ${URL_PYPI_PADDLE} | grep 'Available' | cut -d ":" -f 2 | tr ', ' '\n' | grep ${CUDA_VER:-'.'} | head -n 1) \ - && V=$(echo ${PADDLE}==${PADDLE_VER}) && echo "to install paddle: ${V}" \ - && echo "${V}" > /opt/utils/install_list_PY_paddle.pip ; \ - else \ - echo "Skip paddle install" ; \ - fi \ + # && PADDLE_VER=$(pip index versions ${PADDLE} -f ${URL_PYPI_PADDLE} | grep 'Available' | cut -d ":" -f 2 | tr ', ' '\n' | grep ${CUDA_VER:-'.'} | head -n 1) \ + # && V=$(echo ${PADDLE}==${PADDLE_VER}) && echo "to install paddle: ${V}" \ + && pip install --no-cache-dir --root-user-action=ignore -U --pre --index-url ${URL_PYPI_PADDLE} "${PADDLE}" \ + ) || echo "Skip paddle install" ) \ # ----------------------------- - && echo "PIP_FIND_LINKS=${PIP_FIND_LINKS:-default}" \ - && for profile in $(echo $ARG_PROFILE_PYTHON | tr "," "\n") ; do ( echo "Pip install for ${profile}" ; install_pip "/opt/utils/install_list_PY_${profile}.pip" ; ) ; done \ + # && [ "${PIP_FIND_LINKS+set}" != "set" ] && echo "PIP_FIND_LINKS is not set!" || echo "PIP_FIND_LINKS is set to: ${PIP_FIND_LINKS}" \ + && for profile in $(echo $ARG_PROFILE_PYTHON | tr "," "\n") ; do ( \ + [ -f "/opt/utils/install_list_PY_${profile}.apt" ] && install_apt "/opt/utils/install_list_PY_${profile}.apt" || echo "apt install skipped for ${profile}" ; \ + [ -f "/opt/utils/install_list_PY_${profile}.pip" ] && install_pip "/opt/utils/install_list_PY_${profile}.pip" || echo "pip install skipped for ${profile}" ; \ + ) ; done \ # ----------------------------- && if echo "${ARG_PROFILE_GO}" | grep -q "base" ; then \ echo "Installing GO: ${ARG_PROFILE_GO}" && setup_GO ; \ diff --git a/docker_core/work/install_list_PY_torch.pip b/docker_core/work/install_list_PY_torch.pip deleted file mode 100644 index 6ec9b57..0000000 --- a/docker_core/work/install_list_PY_torch.pip +++ /dev/null @@ -1,4 +0,0 @@ -% This file contains python packages to be installed with pip line by line. -% Use percent char as line comment separator. - -numpy % torch requires numpy but didn't declare it in its file