Skip to content

Commit 54eae88

Browse files
committed
Call the isaaclab console script directly in the images
Review feedback on #7405: the images went through ``isaaclab.sh -p`` for every Python invocation. Putting the environment on PATH makes the console script directly callable, so the call sites read ``isaaclab -p`` -- shorter than the launcher path, with no wrapper. ``uv run`` was the other option but needs ``--frozen --no-sync --project`` to match: without them it re-resolves the project on every call, and it warns when invoked outside the project directory. Measured 124 ms against 110 ms per call. ``install_deps.py apt`` moves below the workspace install. It ran before it, where the console script cannot import its own package, and nothing between the two steps needs apt first: the third-party packages are already installed and the workspace members are pure-Python editables. Two aliases go with it. ``isaaclab`` shadowed the console script now on PATH, and ``tensorboard`` was an explicit path into the environment. ``isaaclab.sh`` itself still ships and is unchanged; this only changes how the images reach it.
1 parent 355e1f9 commit 54eae88

3 files changed

Lines changed: 30 additions & 25 deletions

File tree

docker/Dockerfile.base

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,6 @@ COPY ../source/ ${ISAACLAB_PATH}/source/
149149
RUN find ${ISAACLAB_PATH} -type f -name "*.sh" -exec sed -i 's/\r$//' {} + \
150150
&& chmod 755 ${ISAACLAB_PATH}/isaaclab.sh
151151

152-
# Install apt dependencies for extensions that declare them in their extension.toml,
153-
RUN ${ISAACLAB_PATH}/isaaclab.sh -p ${ISAACLAB_PATH}/tools/install_deps.py apt ${ISAACLAB_PATH}/source && \
154-
apt-get -y autoremove && apt-get clean && \
155-
rm -rf /var/lib/apt/lists/*
156-
157152
# robomimic and moviepy declare imageio-ffmpeg for optional video helpers. Its bundled
158153
# FFmpeg binary stays out of the distributed image; users who enable video recording install
159154
# MoviePy and its video backend explicitly.
@@ -164,25 +159,32 @@ RUN --mount=type=cache,target=/root/.cache/uv \
164159
find ${VIRTUAL_ENV} \! -user isaaclab \
165160
-exec chown isaaclab:isaaclab {} + -exec chmod a+rwX {} +
166161

162+
# Resolve ``isaaclab``/``python`` from the environment. Kept below the install layers, which it
163+
# would otherwise invalidate.
164+
ENV PATH="${VENV_PATH_ARG}/bin:${PATH}"
165+
166+
# Install apt dependencies for extensions that declare them in their extension.toml.
167+
RUN isaaclab -p ${ISAACLAB_PATH}/tools/install_deps.py apt ${ISAACLAB_PATH}/source && \
168+
apt-get -y autoremove && apt-get clean && \
169+
rm -rf /var/lib/apt/lists/*
170+
167171
# Isaac Sim's prebundled packages sit on PYTHONPATH ahead of the venv for launch paths that
168172
# never import isaaclab (``runheadless.sh``, ``isaac-sim.streaming.sh``), so its torch would
169173
# shadow the venv's and load a libtorch_cuda.so needing an NCCL symbol the bundled NCCL does
170174
# not export (nvbugs 6343978). Repoint them at the venv; the pip install path did this itself.
171-
RUN ${ISAACLAB_PATH}/isaaclab.sh -p -c \
175+
RUN isaaclab -p -c \
172176
"from isaaclab.cli.commands.install import _repoint_prebundle_packages; _repoint_prebundle_packages()"
173177

174178
# uv venv/uv sync above needed Kit's interpreter as the venv base; from here on ``uv pip``
175179
# should target the venv, including the interactive ``pip`` alias below.
176180
ENV UV_PYTHON=${VENV_PATH_ARG}/bin/python
177181

178-
# aliasing isaaclab.sh and python for convenience
182+
# aliasing python for convenience; ``isaaclab`` and ``tensorboard`` come from PATH
179183
RUN echo "export ISAACLAB_PATH=${ISAACLAB_PATH}" >> ${DOCKER_USER_HOME}/.bashrc && \
180-
echo "alias isaaclab=${ISAACLAB_PATH}/isaaclab.sh" >> ${DOCKER_USER_HOME}/.bashrc && \
181-
echo "alias python='${ISAACLAB_PATH}/isaaclab.sh -p'" >> ${DOCKER_USER_HOME}/.bashrc && \
182-
echo "alias python3='${ISAACLAB_PATH}/isaaclab.sh -p'" >> ${DOCKER_USER_HOME}/.bashrc && \
184+
echo "alias python='isaaclab -p'" >> ${DOCKER_USER_HOME}/.bashrc && \
185+
echo "alias python3='isaaclab -p'" >> ${DOCKER_USER_HOME}/.bashrc && \
183186
echo "alias pip='uv pip'" >> ${DOCKER_USER_HOME}/.bashrc && \
184187
echo "alias pip3='uv pip'" >> ${DOCKER_USER_HOME}/.bashrc && \
185-
echo "alias tensorboard='${VIRTUAL_ENV}/bin/tensorboard'" >> ${DOCKER_USER_HOME}/.bashrc && \
186188
echo "export TZ=$(date +%Z)" >> ${DOCKER_USER_HOME}/.bashrc && \
187189
echo "shopt -s histappend" >> ${DOCKER_USER_HOME}/.bashrc && \
188190
echo "PROMPT_COMMAND='history -a'" >> ${DOCKER_USER_HOME}/.bashrc
@@ -227,7 +229,7 @@ RUN set -o pipefail \
227229
&& export DOCKER_ISAACSIM_ROOT_PATH="${ISAACSIM_ROOT_PATH}" \
228230
DOCKER_ISAACLAB_PATH="${ISAACLAB_PATH}" \
229231
DOCKER_USER_HOME="${DOCKER_USER_HOME}" \
230-
&& dirs="$(${ISAACLAB_PATH}/isaaclab.sh -p ${ISAACLAB_PATH}/docker/utils/volume_mounts.py | grep '^/')" \
232+
&& dirs="$(isaaclab -p ${ISAACLAB_PATH}/docker/utils/volume_mounts.py | grep '^/')" \
231233
&& mkdir -p ${dirs} \
232234
&& chown -R isaaclab:isaaclab ${dirs}
233235

docker/Dockerfile.curobo

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,6 @@ COPY ../source/ ${ISAACLAB_PATH}/source/
189189
# Fix the line endings of the scripts the COPY above just wrote.
190190
RUN find ${ISAACLAB_PATH}/source -type f -name "*.sh" -exec sed -i 's/\r$//' {} +
191191

192-
# Install apt dependencies for extensions that declare them in their extension.toml,
193-
RUN ${ISAACLAB_PATH}/isaaclab.sh -p ${ISAACLAB_PATH}/tools/install_deps.py apt ${ISAACLAB_PATH}/source && \
194-
apt-get -y autoremove && apt-get clean && \
195-
rm -rf /var/lib/apt/lists/*
196-
197192
# The workspace members install editable now that their sources are present; ``find`` fixes
198193
# only what this layer wrote, so overlayfs does not copy up the venv again.
199194
RUN --mount=type=cache,target=/root/.cache/uv \
@@ -203,11 +198,21 @@ RUN --mount=type=cache,target=/root/.cache/uv \
203198
find ${VIRTUAL_ENV} \! -user isaaclab \
204199
-exec chown isaaclab:isaaclab {} + -exec chmod a+rwX {} +
205200

201+
# Resolve ``isaaclab``/``python`` from the environment. Kept below the install layers, which it
202+
# would otherwise invalidate.
203+
ENV PATH="${VENV_PATH_ARG}/bin:${PATH}"
204+
205+
# Install apt dependencies for extensions that declare them in their extension.toml,
206+
# via the launcher: the workspace members install below, so ``isaaclab`` is not importable yet.
207+
RUN isaaclab -p ${ISAACLAB_PATH}/tools/install_deps.py apt ${ISAACLAB_PATH}/source && \
208+
apt-get -y autoremove && apt-get clean && \
209+
rm -rf /var/lib/apt/lists/*
210+
206211
# Isaac Sim's prebundled packages sit on PYTHONPATH ahead of the venv for launch paths that
207212
# never import isaaclab (``runheadless.sh``, ``isaac-sim.streaming.sh``), so its torch would
208213
# shadow the venv's and load a libtorch_cuda.so needing an NCCL symbol the bundled NCCL does
209214
# not export (nvbugs 6343978). Repoint them at the venv; the pip install path did this itself.
210-
RUN ${ISAACLAB_PATH}/isaaclab.sh -p -c \
215+
RUN isaaclab -p -c \
211216
"from isaaclab.cli.commands.install import _repoint_prebundle_packages; _repoint_prebundle_packages()"
212217

213218
# uv venv/uv sync above needed Kit's interpreter as the venv base; from here on ``uv pip``
@@ -224,14 +229,12 @@ RUN --mount=type=cache,target=/root/.cache/uv \
224229
&& find ${VIRTUAL_ENV} \! -user isaaclab \
225230
-exec chown isaaclab:isaaclab {} + -exec chmod a+rwX {} +
226231

227-
# aliasing isaaclab.sh and python for convenience
232+
# aliasing python for convenience; ``isaaclab`` and ``tensorboard`` come from PATH
228233
RUN echo "export ISAACLAB_PATH=${ISAACLAB_PATH}" >> ${DOCKER_USER_HOME}/.bashrc && \
229-
echo "alias isaaclab=${ISAACLAB_PATH}/isaaclab.sh" >> ${DOCKER_USER_HOME}/.bashrc && \
230-
echo "alias python='${ISAACLAB_PATH}/isaaclab.sh -p'" >> ${DOCKER_USER_HOME}/.bashrc && \
231-
echo "alias python3='${ISAACLAB_PATH}/isaaclab.sh -p'" >> ${DOCKER_USER_HOME}/.bashrc && \
234+
echo "alias python='isaaclab -p'" >> ${DOCKER_USER_HOME}/.bashrc && \
235+
echo "alias python3='isaaclab -p'" >> ${DOCKER_USER_HOME}/.bashrc && \
232236
echo "alias pip='uv pip'" >> ${DOCKER_USER_HOME}/.bashrc && \
233237
echo "alias pip3='uv pip'" >> ${DOCKER_USER_HOME}/.bashrc && \
234-
echo "alias tensorboard='${VIRTUAL_ENV}/bin/tensorboard'" >> ${DOCKER_USER_HOME}/.bashrc && \
235238
echo "export TZ=$(date +%Z)" >> ${DOCKER_USER_HOME}/.bashrc && \
236239
echo "shopt -s histappend" >> ${DOCKER_USER_HOME}/.bashrc && \
237240
echo "PROMPT_COMMAND='history -a'" >> ${DOCKER_USER_HOME}/.bashrc
@@ -273,7 +276,7 @@ RUN set -o pipefail \
273276
&& export DOCKER_ISAACSIM_ROOT_PATH="${ISAACSIM_ROOT_PATH}" \
274277
DOCKER_ISAACLAB_PATH="${ISAACLAB_PATH}" \
275278
DOCKER_USER_HOME="${DOCKER_USER_HOME}" \
276-
&& dirs="$(${ISAACLAB_PATH}/isaaclab.sh -p ${ISAACLAB_PATH}/docker/utils/volume_mounts.py | grep '^/')" \
279+
&& dirs="$(isaaclab -p ${ISAACLAB_PATH}/docker/utils/volume_mounts.py | grep '^/')" \
277280
&& mkdir -p ${dirs} \
278281
&& chown -R isaaclab:isaaclab ${dirs}
279282

docker/Dockerfile.ros2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ RUN --mount=type=cache,target=/var/cache/apt \
3232
ros-dev-tools && \
3333
# Install rosdeps for extensions that declare a ros_ws in
3434
# their extension.toml
35-
${ISAACLAB_PATH}/isaaclab.sh -p ${ISAACLAB_PATH}/tools/install_deps.py rosdep ${ISAACLAB_PATH}/source && \
35+
isaaclab -p ${ISAACLAB_PATH}/tools/install_deps.py rosdep ${ISAACLAB_PATH}/source && \
3636
apt -y autoremove && apt clean autoclean && \
3737
rm -rf /var/lib/apt/lists/* && \
3838
# Add sourcing of setup.bash to .bashrc

0 commit comments

Comments
 (0)