holoscan-cli 2.9.0__py3-none-any.whl → 3.8.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,399 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2023-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ ARG GPU_TYPE=dgpu
17
+ ARG LIBTORCH_VERSION=2.8.0
18
+ ARG LIBTORCH_VISION_VERSION="0.23.0"
19
+
20
+ {% if application_type == 'CppCMake' %}
21
+ # Build C++ application in the builder stage
22
+ FROM {{ build_image }} AS builder
23
+ ENV DEBIAN_FRONTEND=noninteractive
24
+
25
+ RUN apt-get update && \
26
+ apt-get install -y --no-install-recommends jq
27
+
28
+ WORKDIR /src
29
+ COPY ./app/* /src
30
+
31
+ RUN mkdir -p /install/.cmake/api/v1/query/ && \
32
+ touch /install/.cmake/api/v1/query/codemodel-v2
33
+ RUN cd /src && \
34
+ cmake -S . -DHOLOHUB_DOWNLOAD_DATASETS=OFF {{ cmake_args }} -B /install && \
35
+ cmake --build /install -j && \
36
+ export OUTNAME=$(cat $(find /install/.cmake/api/v1/reply -type f | xargs grep -l "nameOnDisk") | jq -r '.nameOnDisk') && \
37
+ cd /install && \
38
+ if [ "${OUTNAME}" != "{{ command_filename }}" ]; then mv ./${OUTNAME} ./{{ command_filename }}; fi
39
+
40
+ RUN rm /install/CMakeCache.txt /install/Makefile /install/cmake_install.cmake && \
41
+ rm -r /install/CMakeFiles/ /install/.cmake/
42
+ {% endif %}
43
+
44
+
45
+
46
+ FROM {{ base_image }} AS base
47
+
48
+ RUN apt-get update \
49
+ && apt-get install -y --no-install-recommends --no-install-suggests \
50
+ curl \
51
+ jq \
52
+ && rm -rf /var/lib/apt/lists/*
53
+
54
+ {% if 'onnx' in includes %}
55
+ # Collect onnx dependencies
56
+ FROM base AS onnx-dependencies
57
+ ARG GPU_TYPE
58
+ ARG ONNX_RUNTIME_VERSION=1.22.1
59
+
60
+ WORKDIR /opt/onnxruntime
61
+
62
+ # Download onnx binaries
63
+ RUN CUDA_MAJOR_MINOR=12.6 \
64
+ && echo "Downloading from https://edge.urm.nvidia.com/artifactory/sw-holoscan-thirdparty-generic-local/onnxruntime/onnxruntime-${ONNX_RUNTIME_VERSION}-cuda-${CUDA_MAJOR_MINOR}-$(uname -m).tar.gz" \
65
+ && curl -S -L -# -o ort.tgz \
66
+ https://edge.urm.nvidia.com/artifactory/sw-holoscan-thirdparty-generic-local/onnxruntime/onnxruntime-${ONNX_RUNTIME_VERSION}-cuda-${CUDA_MAJOR_MINOR}-$(uname -m).tar.gz
67
+ RUN mkdir -p ${ONNX_RUNTIME_VERSION} \
68
+ && tar -xf ort.tgz -C ${ONNX_RUNTIME_VERSION} --strip-components 2 --no-same-owner --no-same-permissions \
69
+ && rm -f ort.tgz
70
+ WORKDIR /
71
+ # End collect onnx dependencies
72
+ {% endif %}
73
+
74
+ FROM base AS release
75
+ ENV DEBIAN_FRONTEND=noninteractive
76
+ ENV TERM=xterm-256color
77
+
78
+ ARG GPU_TYPE
79
+ ARG UNAME
80
+ ARG UID
81
+ ARG GID
82
+ ARG LIBTORCH_VERSION
83
+ ARG LIBTORCH_VISION_VERSION
84
+
85
+ RUN mkdir -p /etc/holoscan/ \
86
+ && mkdir -p /opt/holoscan/ \
87
+ && mkdir -p {{ working_dir }} \
88
+ && mkdir -p {{ app_dir }} \
89
+ && mkdir -p {{ full_input_path }} \
90
+ && mkdir -p {{ full_output_path }}
91
+
92
+ LABEL base="{{ base_image }}"
93
+ LABEL tag="{{ tag }}"
94
+ LABEL org.opencontainers.image.title="{{ title }}"
95
+ LABEL org.opencontainers.image.version="{{ version }}"
96
+ LABEL org.nvidia.holoscan="{{ holoscan_sdk_version }}"
97
+
98
+ {% if sdk_type == 'monai-deploy' %}
99
+ LABEL org.monai.deploy.app-sdk="{{ monai_deploy_app_sdk_version }}"
100
+ {% endif %}
101
+
102
+ ENV HOLOSCAN_INPUT_PATH={{ full_input_path }}
103
+ ENV HOLOSCAN_OUTPUT_PATH={{ full_output_path }}
104
+ ENV HOLOSCAN_WORKDIR={{ working_dir }}
105
+ ENV HOLOSCAN_APPLICATION={{ app_dir }}
106
+ ENV HOLOSCAN_TIMEOUT={{ timeout }}
107
+ ENV HOLOSCAN_MODEL_PATH={{ models_dir }}
108
+ ENV HOLOSCAN_DOCS_PATH={{ docs_dir }}
109
+ ENV HOLOSCAN_CONFIG_PATH={{ config_file_path }}
110
+ ENV HOLOSCAN_APP_MANIFEST_PATH={{ app_json }}
111
+ ENV HOLOSCAN_PKG_MANIFEST_PATH={{ pkg_json }}
112
+ ENV HOLOSCAN_LOGS_PATH={{ logs_dir }}
113
+ ENV HOLOSCAN_VERSION={{ holoscan_sdk_version }}
114
+
115
+ # Update NV GPG repo key
116
+ # https://developer.nvidia.com/blog/updating-the-cuda-linux-gpg-repository-key/
117
+ RUN rm -f /etc/apt/sources.list.d/cuda*.list \
118
+ && curl -OL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/{{ cuda_deb_arch }}/cuda-keyring_1.1-1_all.deb \
119
+ && dpkg -i cuda-keyring_1.1-1_all.deb \
120
+ && rm -f cuda-keyring_1.1-1_all.deb \
121
+ && apt-get update
122
+
123
+ {% if 'debug' in includes %}
124
+ # Install debugging tools
125
+ RUN apt-get update \
126
+ && apt-get install -y --no-install-recommends --no-install-suggests \
127
+ build-essential \
128
+ ccache \
129
+ gdb \
130
+ strace \
131
+ sudo \
132
+ && rm -rf /var/lib/apt/lists/*
133
+ ### End install debugging tools
134
+ {% endif %}
135
+
136
+
137
+ {% if 'holoviz' in includes %}
138
+ # Install Holoviz dependencies
139
+ RUN apt-get update \
140
+ && apt-get install --no-install-recommends --no-install-suggests --allow-downgrades --allow-change-held-packages -y \
141
+ libvulkan1="1.3.275.0-*" \
142
+ # X11 support \
143
+ libgl1="1.7.0-*" \
144
+ # Wayland support \
145
+ libwayland-client0="1.22.0-*" \
146
+ libwayland-egl1="1.22.0-*" \
147
+ libxkbcommon0="1.6.0-*" \
148
+ libdecor-0-plugin-1-cairo="0.2.2-*" \
149
+ libegl1="1.7.0-*" \
150
+ && rm -rf /var/lib/apt/lists/*
151
+ # End install Holoviz dependencies
152
+ {% endif %}
153
+
154
+
155
+ {% if 'torch' in includes %}
156
+ # Install torch dependencies
157
+ ENV PYTHON_VERSION=3.12.3-*
158
+ ENV PYTHON_PIP_VERSION=24.0+dfsg-*
159
+ ENV LIBTORCH=/opt/libtorch
160
+ ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${LIBTORCH}
161
+
162
+ RUN apt update \
163
+ && apt-get install -y --no-install-recommends --no-install-suggests \
164
+ python3-minimal=${PYTHON_VERSION} \
165
+ libpython3-stdlib=${PYTHON_VERSION} \
166
+ python3=${PYTHON_VERSION} \
167
+ python3-venv=${PYTHON_VERSION} \
168
+ python3-pip=${PYTHON_PIP_VERSION} \
169
+ python3-dev \
170
+ libjpeg-turbo8="2.1.5-*" \
171
+ libnuma1="2.0.18-*" \
172
+ libhwloc15="2.10.0-*" \
173
+ libopenblas0="0.3.26+ds-*" \
174
+ libevent-core-2.1-7 \
175
+ libevent-pthreads-2.1-7 \
176
+ $([ "${GPU_TYPE}" != "igpu" ] && echo "cuda-cupti-$(echo ${CUDA_VERSION} | sed 's/\./-/g' | cut -d- -f1,2)") \
177
+ $([ "${GPU_TYPE}" != "igpu" ] && echo "libcudnn9-cuda-$(echo ${CUDA_VERSION} | cut -d. -f1)") \
178
+ && rm -rf /var/lib/apt/lists/*
179
+
180
+ RUN rm -rf /usr/lib/python3.12/EXTERNALLY-MANAGED \
181
+ && if [ "${GPU_TYPE}" = "igpu" ]; then \
182
+ PYTORCH_WHEEL_VERSION="${LIBTORCH_VERSION}"; \
183
+ INDEX_URL="https://pypi.jetson-ai-lab.io/jp6/cu129"; \
184
+ else \
185
+ PYTORCH_WHEEL_VERSION="${LIBTORCH_VERSION}+cu129"; \
186
+ INDEX_URL="https://download.pytorch.org/whl"; \
187
+ fi; \
188
+ echo "Installing torch==${PYTORCH_WHEEL_VERSION} from $INDEX_URL"; \
189
+ python3 -m pip install --break-system-packages --force-reinstall torch==${PYTORCH_WHEEL_VERSION} torchvision==${LIBTORCH_VISION_VERSION} torchaudio --index-url $INDEX_URL; \
190
+ if ! find /usr/local/lib/python3.12/dist-packages/torch -name libtorch_cuda.so | grep -q .; then \
191
+ echo "libtorch_cuda.so not found, torch installation failed"; \
192
+ exit 1; \
193
+ fi
194
+ # Set up Holoscan SDK container libtorch to be found with ldconfig for app C++ build and runtime
195
+ RUN echo $(python3 -c "import torch; print(torch.__path__[0])")/lib > /etc/ld.so.conf.d/libtorch.conf \
196
+ && ldconfig \
197
+ && ldconfig -p | grep -q "libtorch.so"
198
+ WORKDIR /
199
+ ### End install torch dependencies
200
+ {% endif %}
201
+
202
+
203
+ {% if 'onnx' in includes %}
204
+ # Install onnx dependencies
205
+ ENV ONNX_RUNTIME=/opt/onnxruntime
206
+ ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${ONNX_RUNTIME}
207
+
208
+ # Copy ONNX Runtime
209
+ COPY --from=onnx-dependencies ${ONNX_RUNTIME} ${ONNX_RUNTIME}
210
+
211
+ {% if gpu_type == "dgpu" %}
212
+ RUN apt-get update \
213
+ && apt-get install --no-install-recommends --no-install-suggests --allow-downgrades -y \
214
+ libnvinfer10="10.9.0.34-1+cuda12.8" \
215
+ libnvinfer-plugin10="10.9.0.34-1+cuda12.8" \
216
+ libnvonnxparsers10="10.9.0.34-1+cuda12.8" \
217
+ libcusparselt0="0.7.1.0-*" \
218
+ libcudnn9-cuda-12 \
219
+ && rm -rf /var/lib/apt/lists/* \
220
+ && rm -f /usr/lib/*/libcudnn*train.so*
221
+ {% endif %}
222
+ ### End install onnx dependencies
223
+ {% endif %}
224
+
225
+ {% if health_probe is defined %}
226
+ # Install gRPC health probe
227
+ RUN curl -L -o /bin/grpc_health_probe {{ health_probe | pprint }} \
228
+ && chmod +x /bin/grpc_health_probe && ls -l /bin/grpc_health_probe
229
+
230
+ HEALTHCHECK --interval=10s --timeout=1s \
231
+ CMD /bin/grpc_health_probe -addr=:8765 || exit 1
232
+
233
+ # End install gRPC health probe
234
+ {% endif %}
235
+
236
+ {% if application_type == 'PythonModule' or application_type == 'PythonFile' %}
237
+ {% if not 'torch' in includes %}
238
+ # If torch is installed, we can skip installing Python
239
+ ENV PYTHON_VERSION=3.12.3-*
240
+ ENV PYTHON_PIP_VERSION=24.0+dfsg-*
241
+
242
+ RUN apt update \
243
+ && apt-get install -y --no-install-recommends --no-install-suggests \
244
+ python3-minimal=${PYTHON_VERSION} \
245
+ libpython3-stdlib=${PYTHON_VERSION} \
246
+ python3=${PYTHON_VERSION} \
247
+ python3-venv=${PYTHON_VERSION} \
248
+ python3-pip=${PYTHON_PIP_VERSION} \
249
+ && rm -rf /var/lib/apt/lists/*
250
+ {% endif %}
251
+
252
+ {% if holoscan_deb_arch == "arm64" %}
253
+ # Requires python3-dev on aarch64
254
+ RUN apt update \
255
+ && apt-get install -y --no-install-recommends --no-install-suggests \
256
+ gcc \
257
+ python3-dev \
258
+ && rm -rf /var/lib/apt/lists/*
259
+ {% endif %}
260
+
261
+ {% endif %}
262
+
263
+ {% if application_type == 'CppCMake' or application_type == 'Binary' %}
264
+
265
+ ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/nvidia/holoscan/lib
266
+
267
+ RUN if [ "{{ holoscan_deb_arch }}" = "arm64" ]; then \
268
+ GDR_REPO_ARCH=aarch64 ; \
269
+ else \
270
+ GDR_REPO_ARCH=x64 ; \
271
+ fi \
272
+ && curl -O https://developer.download.nvidia.com/compute/redist/gdrcopy/CUDA%2012.8/ubuntu24_04/${GDR_REPO_ARCH}/libgdrapi_2.5.1-1_{{ holoscan_deb_arch }}.Ubuntu24_04.deb \
273
+ && dpkg -i libgdrapi_2.5.1-1_{{ holoscan_deb_arch }}.Ubuntu24_04.deb \
274
+ && rm -f libgdrapi_2.5.1-1_{{ holoscan_deb_arch }}.Ubuntu24_04.deb \
275
+ && rm -rf /var/lib/apt/lists/*
276
+
277
+ {% if custom_holoscan_sdk == True %}
278
+
279
+ # Use user-specified Holoscan SDK Debian Package
280
+ COPY ./{{ holoscan_sdk_filename }} /tmp/{{ holoscan_sdk_filename }}
281
+ RUN apt-get update \
282
+ && apt-get install -y --no-install-recommends --no-install-suggests \
283
+ /tmp/{{ holoscan_sdk_filename }} \
284
+ && rm -rf /var/lib/apt/lists/*
285
+ {% else %}
286
+
287
+ # Install Holoscan SDK from NVIDIA APT repository
288
+ # Holoscan: available versions (https://pypi.org/project/holoscan/#history)
289
+ RUN apt-get install -y --no-install-recommends --no-install-suggests \
290
+ holoscan={{ holoscan_sdk_filename }} \
291
+ # && apt-get remove -y g++ g++-11 gcc gcc-11 gcc-11-base build-essential \
292
+ && apt-get purge -y cuda-keyring \
293
+ && rm -rf /var/lib/apt/lists/*
294
+ {% endif %}
295
+
296
+ {% endif %}
297
+
298
+
299
+ {% if holoscan_deb_arch == "arm64" %}
300
+ # Requires libnuma on aarch64
301
+ RUN apt update \
302
+ && apt-get install -y --no-install-recommends --no-install-suggests \
303
+ libnuma1="2.0.18-*" \
304
+ && rm -rf /var/lib/apt/lists/*
305
+ {% endif %}
306
+
307
+ RUN if id "ubuntu" >/dev/null 2>&1; then touch /var/mail/ubuntu && chown ubuntu /var/mail/ubuntu && userdel -r ubuntu; fi
308
+ RUN groupadd -f -g $GID $UNAME
309
+ RUN useradd -rm -d /home/$UNAME -s /bin/bash -g $GID -G sudo -u $UID $UNAME
310
+ RUN chown -R holoscan {{ working_dir }} && \
311
+ chown -R holoscan {{ full_input_path }} && \
312
+ chown -R holoscan {{ full_output_path }}
313
+
314
+ # Set the working directory
315
+ WORKDIR {{ working_dir }}
316
+
317
+ # Copy HAP/MAP tool script
318
+ COPY ./tools {{ working_dir }}/tools
319
+ RUN chmod +x {{ working_dir }}/tools
320
+
321
+ # Remove EXTERNALLY-MANAGED directory
322
+ RUN rm -rf /usr/lib/python3.12/EXTERNALLY-MANAGED
323
+
324
+ # Set the working directory
325
+ WORKDIR {{ working_dir }}
326
+
327
+ USER $UNAME
328
+
329
+ ENV PATH=/home/${UNAME}/.local/bin:/opt/nvidia/holoscan/bin:$PATH
330
+ ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/${UNAME}/.local/lib/python3.12/site-packages/holoscan/lib
331
+
332
+ {% if application_type == 'PythonModule' or application_type == 'PythonFile' %}
333
+ COPY ./pip/requirements.txt /tmp/requirements.txt
334
+
335
+ RUN pip install --upgrade pip
336
+ RUN pip install --no-cache-dir --user -r /tmp/requirements.txt
337
+
338
+ {% if sdk_type == 'holoscan' %}
339
+ # Install Holoscan SDK
340
+
341
+ {% if custom_holoscan_sdk == True %}
342
+ # Copy user-specified Holoscan SDK wheel file
343
+ COPY ./{{ holoscan_sdk_filename }} /tmp/{{ holoscan_sdk_filename }}
344
+ RUN pip install /tmp/{{ holoscan_sdk_filename }}
345
+
346
+ {% else %}
347
+ # Install Holoscan SDK wheel from PyPI
348
+ RUN pip install holoscan-cu12=={{holoscan_sdk_filename}}
349
+ {% endif %}
350
+ {% else %}
351
+
352
+ # Install MONAI Deploy App SDK
353
+ {% if custom_monai_deploy_sdk == True %}
354
+ # Copy user-specified MONAI Deploy SDK file
355
+ COPY ./{{ monai_deploy_sdk_filename }} /tmp/{{ monai_deploy_sdk_filename }}
356
+ RUN pip install /tmp/{{ monai_deploy_sdk_filename }}
357
+ {% else %}
358
+
359
+ # Install MONAI Deploy from PyPI org
360
+ RUN pip install monai-deploy-app-sdk=={{ monai_deploy_app_sdk_version }}
361
+
362
+ {% endif %}
363
+ {% endif %}
364
+ {% endif %}
365
+
366
+ {% if models is defined %}
367
+ COPY ./models {{ models_dir }}
368
+ {% endif %}
369
+
370
+ {% if docs is defined %}
371
+ COPY ./docs {{ docs_dir }}
372
+ {% endif %}
373
+
374
+ COPY ./map/app.json {{ app_json }}
375
+ COPY ./app.config {{ config_file_path }}
376
+ COPY ./map/pkg.json {{ pkg_json }}
377
+
378
+ {% if application_type == 'CppCMake' %}
379
+ COPY --from=builder /install {{ app_dir }}
380
+ {% else %}
381
+ COPY ./app {{ app_dir }}
382
+ {% endif %}
383
+
384
+ {% if additional_lib_paths != '' %}
385
+
386
+ ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:{{ additional_lib_paths }}:{{ lib_dir }}
387
+ COPY ./lib {{ lib_dir }}
388
+
389
+ {% if application_type == 'PythonModule' or application_type == 'PythonFile' %}
390
+ ENV PYTHONPATH=$PYTHONPATH:{{ additional_lib_paths }}:{{ lib_dir }}
391
+ {% endif %}
392
+
393
+ {% endif %}
394
+
395
+ {% if input_data != None %}
396
+ COPY ./input $HOLOSCAN_INPUT_PATH
397
+ {% endif %}
398
+
399
+ ENTRYPOINT ["/var/holoscan/tools"]