-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update of Habana SynapseAI notebook to 1.15.1
This required quite a few changes, since the SynapseAI stack requires Python 3.11 for 1.15.1. Uses a similar workflow to Anaconda with a custom base image, this however should be easy to update in the future just by swapping out the FROM in the base image and verifying the python versions going forward. Signed-off-by: Sean Pryor <[email protected]>
- Loading branch information
Showing
14 changed files
with
2,262 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
FROM vault.habana.ai/gaudi-docker/1.15.1/rhel9.2/habanalabs/pytorch-installer-2.2.0:1.15.1-15 as base | ||
|
||
LABEL name="odh-notebook-habana-jupyter-1.15.1-ubi9-python-3.10" \ | ||
summary="Jupyter HabanaAI 1.15.1 notebook image for ODH notebooks" \ | ||
description="Jupyter HabanaAI 1.15.1 notebook image with base Python 3.10 builder image based on ubi9 for ODH notebooks" \ | ||
io.k8s.display-name="Jupyter HabanaAI 1.15.1 notebook image for ODH notebooks" \ | ||
io.k8s.description="Jupyter HabanaAI 1.15.1 notebook image with base Python 3.10 builder image based on ubi9 for ODH notebooks" \ | ||
authoritative-source-url="https://github.com/opendatahub-io/notebooks" \ | ||
io.openshift.build.commit.ref="main" \ | ||
io.openshift.build.source-location="https://github.com/opendatahub-io/notebooks/tree/main/habana/1.15.1/ubi9-python-3.10" \ | ||
io.openshift.build.image="quay.io/opendatahub/workbench-images:habana-jupyter-1.15.1-ubi9-python-3.10" | ||
|
||
COPY --from=registry.access.redhat.com/ubi9/python-39:latest /usr/bin/fix-permissions /usr/bin | ||
COPY --from=registry.access.redhat.com/ubi9/python-39:latest /usr/bin/rpm-file-permissions /usr/bin | ||
|
||
ENV PATH=/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ | ||
APP_ROOT="/opt/app-root" | ||
|
||
ENV HOME="${APP_ROOT}/src" | ||
|
||
WORKDIR ${HOME} | ||
|
||
RUN mkdir -p ${APP_ROOT}/src && \ | ||
rpm-file-permissions && \ | ||
useradd -u 1001 -r -g 0 -d ${HOME} -c "Default Application User" default && \ | ||
chown -R 1001:0 ${APP_ROOT} | ||
|
||
FROM base as notebook-base | ||
|
||
ENV PYTHON_VERSION=3.10 \ | ||
PATH=$HOME/.local/bin/:$PATH \ | ||
PYTHONUNBUFFERED=1 \ | ||
PYTHONIOENCODING=UTF-8 \ | ||
LC_ALL=en_US.UTF-8 \ | ||
LANG=en_US.UTF-8 \ | ||
PIP_NO_CACHE_DIR=off | ||
|
||
RUN python3.10 -m venv --system-site-packages ${APP_ROOT} && \ | ||
chown -R 1001:0 ${APP_ROOT} && \ | ||
fix-permissions ${APP_ROOT} -P && \ | ||
rpm-file-permissions && \ | ||
echo "unset BASH_ENV PROMPT_COMMAND ENV" >> ${APP_ROOT}/bin/activate | ||
|
||
ENV BASH_ENV="${APP_ROOT}/bin/activate" \ | ||
ENV="${APP_ROOT}/bin/activate" \ | ||
PROMPT_COMMAND=". ${APP_ROOT}/bin/activate" | ||
|
||
WORKDIR /opt/app-root/bin | ||
|
||
# Install micropipenv to deploy packages from Pipfile.lock | ||
RUN pip install --no-cache-dir -U "micropipenv[toml]" | ||
|
||
# Install Python dependencies from Pipfile.lock file | ||
COPY Pipfile.lock ./ | ||
|
||
RUN echo "Installing softwares and packages" && micropipenv install && rm -f ./Pipfile.lock | ||
|
||
# OS Packages needs to be installed as root | ||
USER root | ||
|
||
# Install usefull OS packages | ||
RUN dnf install -y mesa-libGL && dnf clean all && rm -rf /var/cache/yum | ||
|
||
# Install the oc client | ||
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \ | ||
-o /tmp/openshift-client-linux.tar.gz && \ | ||
tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \ | ||
rm -f /tmp/openshift-client-linux.tar.gz | ||
|
||
# Fix permissions to support pip in Openshift environments | ||
RUN chmod -R g+w /opt/app-root/lib/python3.10/site-packages && \ | ||
fix-permissions /opt/app-root -P | ||
|
||
# Other apps and tools installed as default user | ||
USER 1001 | ||
|
||
WORKDIR /opt/app-root/src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[[source]] | ||
name = "pypi" | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
|
||
[dev-packages] | ||
|
||
[packages] | ||
# Base packages | ||
wheel = "~=0.43.0" | ||
setuptools = "~=69.2.0" | ||
|
||
[requires] | ||
python_version = "3.10" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright (c) 2022 Habana Labs, Ltd. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
ARG BASE_IMAGE | ||
FROM ${BASE_IMAGE} | ||
|
||
USER root | ||
|
||
## Label the image with details required by ODH | ||
LABEL name="odh-notebook-habana-jupyter-1.15.1-ubi9-python-3.10" \ | ||
summary="Jupyter HabanaAI 1.15.1 notebook image for ODH notebooks" \ | ||
description="Jupyter HabanaAI 1.15.1 notebook image with base Python 3.10 builder image based on ubi9 for ODH notebooks" \ | ||
io.k8s.display-name="Jupyter HabanaAI 1.15.1 notebook image for ODH notebooks" \ | ||
io.k8s.description="Jupyter HabanaAI 1.15.1 notebook image with base Python 3.10 builder image based on ubi9 for ODH notebooks" \ | ||
authoritative-source-url="https://github.com/opendatahub-io/notebooks" \ | ||
io.openshift.build.commit.ref="main" \ | ||
io.openshift.build.source-location="https://github.com/opendatahub-io/notebooks/tree/main/habana/1.15.1/ubi9-python-3.10" \ | ||
io.openshift.build.image="quay.io/opendatahub/workbench-images:habana-jupyter-1.15.1-ubi9-python-3.10" | ||
|
||
WORKDIR /opt/app-root/bin | ||
|
||
COPY utils utils/ | ||
|
||
COPY Pipfile.lock start-notebook.sh ./ | ||
|
||
# Install Python dependencies from Pipfile.lock file | ||
RUN echo "Installing softwares and packages" && micropipenv install && rm -f ./Pipfile.lock | ||
|
||
# Disable announcement plugin of jupyterlab | ||
RUN jupyter labextension disable "@jupyterlab/apputils-extension:announcements" | ||
|
||
# Fix permissions to support pip in Openshift environments | ||
RUN chmod -R g+w /opt/app-root/lib/python3.10/site-packages && \ | ||
fix-permissions /opt/app-root -P | ||
|
||
WORKDIR /opt/app-root/src | ||
|
||
# Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y | ||
RUN sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json | ||
|
||
USER 1001 | ||
|
||
ENTRYPOINT ["start-notebook.sh"] | ||
|
||
WORKDIR /opt/app-root/src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
[[source]] | ||
name = "pypi" | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
|
||
[dev-packages] | ||
|
||
[packages] | ||
# JupyterLab packages | ||
jupyterlab = "~=3.6.7" # Wait on upgrade till plugins are ready | ||
jupyter-server = "~=2.13.0" | ||
jupyter-server-proxy = "~=4.0.0" # Upgrade would bring in jupyterlab 4 | ||
jupyter-server-terminals = "~=0.5.3" | ||
jupyterlab-git = "~=0.44.0" | ||
nbdime = "~=3.2.1" | ||
nbgitpuller = "~=1.2.0" | ||
|
||
# Base packages | ||
wheel = "~=0.43.0" | ||
setuptools = "~=69.2.0" | ||
|
||
[requires] | ||
python_version = "3.10" |
Oops, something went wrong.