Unverified Commit d5d57112 authored by Kyle Morgenstein's avatar Kyle Morgenstein Committed by GitHub

Adds uv support as an alternative to conda in isaaclab.sh (#3172)

# Description

This PR adds support for uv as an alternative to conda or venv for
managing virtual environments and adds corresponding support for uv pip
for managing python dependencies. uv and uv pip is significantly faster
than conda and has many useful tools.

If users wish to use the uv workflow they will need to have uv
installed, but otherwise no additional dependencies are added.

Docs should be updated to describe this option. There may need to be
more work done to clean when deactivating the environment. Uv does not
support pre and post activation hooks like conda so cleaning up the
environment variables is slightly more tricky. I would greatly
appreciate feedback to improve this workflow!

Fixes #3408

## Type of change

- New feature (non-breaking change which adds functionality)
- This change requires a documentation update


## Checklist

- [X] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [X] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [X] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

---------
Signed-off-by: 's avatarKyle Morgenstein <34984693+KyleM73@users.noreply.github.com>
Signed-off-by: 's avatarMayank Mittal <12863862+Mayankm96@users.noreply.github.com>
Co-authored-by: 's avatarMayank Mittal <12863862+Mayankm96@users.noreply.github.com>
parent 9e327f26
MIT License
Copyright (c) 2025 Astral Software Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
...@@ -69,7 +69,7 @@ python executable provided by Omniverse. This is specified in the ...@@ -69,7 +69,7 @@ python executable provided by Omniverse. This is specified in the
"python.defaultInterpreterPath": "${workspaceFolder}/_isaac_sim/python.sh", "python.defaultInterpreterPath": "${workspaceFolder}/_isaac_sim/python.sh",
} }
If you want to use a different python interpreter (for instance, from your conda environment), If you want to use a different python interpreter (for instance, from your conda or uv environment),
you need to change the python interpreter used by selecting and activating the python interpreter you need to change the python interpreter used by selecting and activating the python interpreter
of your choice in the bottom left corner of VSCode, or opening the command palette (``Ctrl+Shift+P``) of your choice in the bottom left corner of VSCode, or opening the command palette (``Ctrl+Shift+P``)
and selecting ``Python: Select Interpreter``. and selecting ``Python: Select Interpreter``.
......
...@@ -33,7 +33,7 @@ Running the template generator ...@@ -33,7 +33,7 @@ Running the template generator
------------------------------ ------------------------------
Install Isaac Lab by following the `installation guide <../../setup/installation/index.html>`_. Install Isaac Lab by following the `installation guide <../../setup/installation/index.html>`_.
We recommend using conda installation as it simplifies calling Python scripts from the terminal. We recommend using conda or uv installation as it simplifies calling Python scripts from the terminal.
Then, run the following command to generate a new external project or internal task: Then, run the following command to generate a new external project or internal task:
......
...@@ -213,6 +213,7 @@ Clone the Isaac Lab repository into your workspace: ...@@ -213,6 +213,7 @@ Clone the Isaac Lab repository into your workspace:
-d, --docs Build the documentation from source using sphinx. -d, --docs Build the documentation from source using sphinx.
-n, --new Create a new external project or internal task from template. -n, --new Create a new external project or internal task from template.
-c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'. -c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'.
-u, --uv [NAME] Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'.
.. tab-item:: :icon:`fa-brands fa-windows` Windows .. tab-item:: :icon:`fa-brands fa-windows` Windows
:sync: windows :sync: windows
...@@ -234,6 +235,7 @@ Clone the Isaac Lab repository into your workspace: ...@@ -234,6 +235,7 @@ Clone the Isaac Lab repository into your workspace:
-d, --docs Build the documentation from source using sphinx. -d, --docs Build the documentation from source using sphinx.
-n, --new Create a new external project or internal task from template. -n, --new Create a new external project or internal task from template.
-c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'. -c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'.
-u, --uv [NAME] Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'.
Creating the Isaac Sim Symbolic Link Creating the Isaac Sim Symbolic Link
...@@ -268,6 +270,57 @@ to index the python modules and look for extensions shipped with Isaac Sim. ...@@ -268,6 +270,57 @@ to index the python modules and look for extensions shipped with Isaac Sim.
mklink /D _isaac_sim path_to_isaac_sim mklink /D _isaac_sim path_to_isaac_sim
:: For example: mklink /D _isaac_sim C:/isaacsim :: For example: mklink /D _isaac_sim C:/isaacsim
Setting up the uv environment (optional)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. attention::
This step is optional. If you are using the bundled python with Isaac Sim, you can skip this step.
The executable ``isaaclab.sh`` automatically fetches the python bundled with Isaac
Sim, using ``./isaaclab.sh -p`` command (unless inside a virtual environment). This executable
behaves like a python executable, and can be used to run any python script or
module with the simulator. For more information, please refer to the
`documentation <https://docs.isaacsim.omniverse.nvidia.com/latest/python_scripting/manual_standalone_python.html>`__.
To install ``uv``, please follow the instructions `here <https://docs.astral.sh/uv/getting-started/installation/>`__.
You can create the Isaac Lab environment using the following commands.
.. tab-set::
:sync-group: os
.. tab-item:: :icon:`fa-brands fa-linux` Linux
:sync: linux
.. code:: bash
# Option 1: Default name for uv environment is 'env_isaaclab'
./isaaclab.sh --uv # or "./isaaclab.sh -u"
# Option 2: Custom name for uv environment
./isaaclab.sh --uv my_env # or "./isaaclab.sh -u my_env"
.. tab-item:: :icon:`fa-brands fa-windows` Windows
:sync: windows
.. code:: batch
:: Option 1: Default name for uv environment is 'env_isaaclab'
isaaclab.bat --uv :: or "isaaclab.bat -u"
:: Option 2: Custom name for uv environment
isaaclab.bat --uv my_env :: or "isaaclab.bat -u my_env"
Once created, be sure to activate the environment before proceeding!
.. code:: bash
source ./env_isaaclab/bin/activate # or "source ./my_env/bin/activate"
Once you are in the virtual environment, you do not need to use ``./isaaclab.sh -p`` / ``isaaclab.bat -p``
to run python scripts. You can use the default python executable in your environment
by running ``python`` or ``python3``. However, for the rest of the documentation,
we will assume that you are using ``./isaaclab.sh -p`` / ``isaaclab.bat -p`` to run python scripts. This command
is equivalent to running ``python`` or ``python3`` in your virtual environment.
Setting up the conda environment (optional) Setting up the conda environment (optional)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -427,8 +480,8 @@ On Windows machines, please terminate the process from Command Prompt using ...@@ -427,8 +480,8 @@ On Windows machines, please terminate the process from Command Prompt using
If you see this, then the installation was successful! |:tada:| If you see this, then the installation was successful! |:tada:|
If you see an error ``ModuleNotFoundError: No module named 'isaacsim'``, ensure that the conda environment is activated If you see an error ``ModuleNotFoundError: No module named 'isaacsim'``, ensure that the conda or uv environment is activated
and ``source _isaac_sim/setup_conda_env.sh`` has been executed. and ``source _isaac_sim/setup_conda_env.sh`` has been executed (for uv as well).
Train a robot! Train a robot!
......
...@@ -25,6 +25,31 @@ To learn about how to set up your own project on top of Isaac Lab, see :ref:`tem ...@@ -25,6 +25,31 @@ To learn about how to set up your own project on top of Isaac Lab, see :ref:`tem
conda create -n env_isaaclab python=3.11 conda create -n env_isaaclab python=3.11
conda activate env_isaaclab conda activate env_isaaclab
.. tab-item:: uv environment
.. tab-set::
:sync-group: os
.. tab-item:: :icon:`fa-brands fa-linux` Linux
:sync: linux
.. code-block:: bash
# create a virtual environment named env_isaaclab with python3.11
uv venv --python 3.11 env_isaaclab
# activate the virtual environment
source env_isaaclab/bin/activate
.. tab-item:: :icon:`fa-brands fa-windows` Windows
:sync: windows
.. code-block:: batch
# create a virtual environment named env_isaaclab with python3.11
uv venv --python 3.11 env_isaaclab
# activate the virtual environment
env_isaaclab\Scripts\activate
.. tab-item:: venv environment .. tab-item:: venv environment
.. tab-set:: .. tab-set::
...@@ -70,6 +95,10 @@ To learn about how to set up your own project on top of Isaac Lab, see :ref:`tem ...@@ -70,6 +95,10 @@ To learn about how to set up your own project on top of Isaac Lab, see :ref:`tem
python -m pip install --upgrade pip python -m pip install --upgrade pip
.. note::
If you use uv, replace ``pip`` with ``uv pip``.
- Next, install a CUDA-enabled PyTorch 2.7.0 build for CUDA 12.8. - Next, install a CUDA-enabled PyTorch 2.7.0 build for CUDA 12.8.
......
...@@ -49,6 +49,31 @@ If you encounter any issues, please report them to the ...@@ -49,6 +49,31 @@ If you encounter any issues, please report them to the
conda create -n env_isaaclab python=3.11 conda create -n env_isaaclab python=3.11
conda activate env_isaaclab conda activate env_isaaclab
.. tab-item:: uv environment
.. tab-set::
:sync-group: os
.. tab-item:: :icon:`fa-brands fa-linux` Linux
:sync: linux
.. code-block:: bash
# create a virtual environment named env_isaaclab with python3.11
uv venv --python 3.11 env_isaaclab
# activate the virtual environment
source env_isaaclab/bin/activate
.. tab-item:: :icon:`fa-brands fa-windows` Windows
:sync: windows
.. code-block:: batch
# create a virtual environment named env_isaaclab with python3.11
uv venv --python 3.11 env_isaaclab
# activate the virtual environment
env_isaaclab\Scripts\activate
.. tab-item:: venv environment .. tab-item:: venv environment
.. tab-set:: .. tab-set::
...@@ -94,6 +119,9 @@ If you encounter any issues, please report them to the ...@@ -94,6 +119,9 @@ If you encounter any issues, please report them to the
python -m pip install --upgrade pip python -m pip install --upgrade pip
.. note::
If you use uv, replace ``pip`` with ``uv pip``.
- Next, install a CUDA-enabled PyTorch 2.7.0 build. - Next, install a CUDA-enabled PyTorch 2.7.0 build.
...@@ -216,6 +244,7 @@ Clone the Isaac Lab repository into your workspace: ...@@ -216,6 +244,7 @@ Clone the Isaac Lab repository into your workspace:
-d, --docs Build the documentation from source using sphinx. -d, --docs Build the documentation from source using sphinx.
-n, --new Create a new external project or internal task from template. -n, --new Create a new external project or internal task from template.
-c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'. -c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'.
-u, --uv [NAME] Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'.
.. tab-item:: :icon:`fa-brands fa-windows` Windows .. tab-item:: :icon:`fa-brands fa-windows` Windows
:sync: windows :sync: windows
...@@ -237,6 +266,7 @@ Clone the Isaac Lab repository into your workspace: ...@@ -237,6 +266,7 @@ Clone the Isaac Lab repository into your workspace:
-d, --docs Build the documentation from source using sphinx. -d, --docs Build the documentation from source using sphinx.
-n, --new Create a new external project or internal task from template. -n, --new Create a new external project or internal task from template.
-c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'. -c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'.
-u, --uv [NAME] Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'.
Installation Installation
~~~~~~~~~~~~ ~~~~~~~~~~~~
......
...@@ -29,13 +29,41 @@ pip install route using virtual environments. ...@@ -29,13 +29,41 @@ pip install route using virtual environments.
To begin, we first define our virtual environment. To begin, we first define our virtual environment.
.. tab-set::
.. code-block:: bash .. tab-item:: conda
.. code-block:: bash
# create a virtual environment named env_isaaclab with python3.11
conda create -n env_isaaclab python=3.11
# activate the virtual environment
conda activate env_isaaclab
.. tab-item:: uv
.. tab-set::
:sync-group: os
.. tab-item:: :icon:`fa-brands fa-linux` Linux
:sync: linux
.. code-block:: bash
# create a virtual environment named env_isaaclab with python3.11
uv venv --python 3.11 env_isaaclab
# activate the virtual environment
source env_isaaclab/bin/activate
.. tab-item:: :icon:`fa-brands fa-windows` Windows
:sync: windows
.. code-block:: batch
# create a virtual environment named env_isaaclab with python3.11 # create a virtual environment named env_isaaclab with python3.11
conda create -n env_isaaclab python=3.11 uv venv --python 3.11 env_isaaclab
# activate the virtual environment # activate the virtual environment
conda activate env_isaaclab env_isaaclab\Scripts\activate
Next, install a CUDA-enabled PyTorch 2.7.0 build. Next, install a CUDA-enabled PyTorch 2.7.0 build.
......
...@@ -97,26 +97,27 @@ is_docker() { ...@@ -97,26 +97,27 @@ is_docker() {
} }
ensure_cuda_torch() { ensure_cuda_torch() {
local py="$1" local pip_command=$(extract_pip_command)
local pip_uninstall_command=$(extract_pip_uninstall_command)
local -r TORCH_VER="2.7.0" local -r TORCH_VER="2.7.0"
local -r TV_VER="0.22.0" local -r TV_VER="0.22.0"
local -r CUDA_TAG="cu128" local -r CUDA_TAG="cu128"
local -r PYTORCH_INDEX="https://download.pytorch.org/whl/${CUDA_TAG}" local -r PYTORCH_INDEX="https://download.pytorch.org/whl/${CUDA_TAG}"
local torch_ver local torch_ver
if "$py" -m pip show torch >/dev/null 2>&1; then if "$pip_command" show torch >/dev/null 2>&1; then
torch_ver="$("$py" -m pip show torch 2>/dev/null | awk -F': ' '/^Version/{print $2}')" torch_ver="$("$pip_command" show torch 2>/dev/null | awk -F': ' '/^Version/{print $2}')"
echo "[INFO] Found PyTorch version ${torch_ver}." echo "[INFO] Found PyTorch version ${torch_ver}."
if [[ "$torch_ver" != "${TORCH_VER}+${CUDA_TAG}" ]]; then if [[ "$torch_ver" != "${TORCH_VER}+${CUDA_TAG}" ]]; then
echo "[INFO] Replacing PyTorch ${torch_ver}${TORCH_VER}+${CUDA_TAG}..." echo "[INFO] Replacing PyTorch ${torch_ver}${TORCH_VER}+${CUDA_TAG}..."
"$py" -m pip uninstall -y torch torchvision torchaudio >/dev/null 2>&1 || true "$pip_uninstall_command" torch torchvision torchaudio >/dev/null 2>&1 || true
"$py" -m pip install "torch==${TORCH_VER}" "torchvision==${TV_VER}" --index-url "${PYTORCH_INDEX}" "$pip_command" "torch==${TORCH_VER}" "torchvision==${TV_VER}" --index-url "${PYTORCH_INDEX}"
else else
echo "[INFO] PyTorch ${TORCH_VER}+${CUDA_TAG} already installed." echo "[INFO] PyTorch ${TORCH_VER}+${CUDA_TAG} already installed."
fi fi
else else
echo "[INFO] Installing PyTorch ${TORCH_VER}+${CUDA_TAG}..." echo "[INFO] Installing PyTorch ${TORCH_VER}+${CUDA_TAG}..."
"$py" -m pip install "torch==${TORCH_VER}" "torchvision==${TV_VER}" --index-url "${PYTORCH_INDEX}" ${pip_command} "torch==${TORCH_VER}" "torchvision==${TV_VER}" --index-url "${PYTORCH_INDEX}"
fi fi
} }
...@@ -154,6 +155,9 @@ extract_python_exe() { ...@@ -154,6 +155,9 @@ extract_python_exe() {
if ! [[ -z "${CONDA_PREFIX}" ]]; then if ! [[ -z "${CONDA_PREFIX}" ]]; then
# use conda python # use conda python
local python_exe=${CONDA_PREFIX}/bin/python local python_exe=${CONDA_PREFIX}/bin/python
elif ! [[ -z "${VIRTUAL_ENV}" ]]; then
# use uv virtual environment python
local python_exe=${VIRTUAL_ENV}/bin/python
else else
# use kit python # use kit python
local python_exe=${ISAACLAB_PATH}/_isaac_sim/python.sh local python_exe=${ISAACLAB_PATH}/_isaac_sim/python.sh
...@@ -171,7 +175,7 @@ extract_python_exe() { ...@@ -171,7 +175,7 @@ extract_python_exe() {
if [ ! -f "${python_exe}" ]; then if [ ! -f "${python_exe}" ]; then
echo -e "[ERROR] Unable to find any Python executable at path: '${python_exe}'" >&2 echo -e "[ERROR] Unable to find any Python executable at path: '${python_exe}'" >&2
echo -e "\tThis could be due to the following reasons:" >&2 echo -e "\tThis could be due to the following reasons:" >&2
echo -e "\t1. Conda environment is not activated." >&2 echo -e "\t1. Conda or uv environment is not activated." >&2
echo -e "\t2. Isaac Sim pip package 'isaacsim-rl' is not installed." >&2 echo -e "\t2. Isaac Sim pip package 'isaacsim-rl' is not installed." >&2
echo -e "\t3. Python executable is not available at the default path: ${ISAACLAB_PATH}/_isaac_sim/python.sh" >&2 echo -e "\t3. Python executable is not available at the default path: ${ISAACLAB_PATH}/_isaac_sim/python.sh" >&2
exit 1 exit 1
...@@ -203,14 +207,43 @@ extract_isaacsim_exe() { ...@@ -203,14 +207,43 @@ extract_isaacsim_exe() {
echo ${isaacsim_exe} echo ${isaacsim_exe}
} }
# find pip command based on virtualization
extract_pip_command() {
# detect if we're in a uv environment
if [ -n "${VIRTUAL_ENV}" ] && [ -f "${VIRTUAL_ENV}/pyvenv.cfg" ] && grep -q "uv" "${VIRTUAL_ENV}/pyvenv.cfg"; then
pip_command="uv pip install"
else
# retrieve the python executable
python_exe=$(extract_python_exe)
pip_command="${python_exe} -m pip install"
fi
echo ${pip_command}
}
extract_pip_uninstall_command() {
# detect if we're in a uv environment
if [ -n "${VIRTUAL_ENV}" ] && [ -f "${VIRTUAL_ENV}/pyvenv.cfg" ] && grep -q "uv" "${VIRTUAL_ENV}/pyvenv.cfg"; then
pip_uninstall_command="uv pip uninstall"
else
# retrieve the python executable
python_exe=$(extract_python_exe)
pip_uninstall_command="${python_exe} -m pip uninstall -y"
fi
echo ${pip_uninstall_command}
}
# check if input directory is a python extension and install the module # check if input directory is a python extension and install the module
install_isaaclab_extension() { install_isaaclab_extension() {
# retrieve the python executable # retrieve the python executable
python_exe=$(extract_python_exe) python_exe=$(extract_python_exe)
pip_command=$(extract_pip_command)
# if the directory contains setup.py then install the python module # if the directory contains setup.py then install the python module
if [ -f "$1/setup.py" ]; then if [ -f "$1/setup.py" ]; then
echo -e "\t module: $1" echo -e "\t module: $1"
${python_exe} -m pip install --editable $1 $pip_command --editable "$1"
fi fi
} }
...@@ -331,6 +364,68 @@ setup_conda_env() { ...@@ -331,6 +364,68 @@ setup_conda_env() {
echo -e "\n" echo -e "\n"
} }
# setup uv environment for Isaac Lab
setup_uv_env() {
# get environment name from input
local env_name="$1"
local python_path="$2"
# check uv is installed
if ! command -v uv &>/dev/null; then
echo "[ERROR] uv could not be found. Please install uv and try again."
echo "[ERROR] uv can be installed here:"
echo "[ERROR] https://docs.astral.sh/uv/getting-started/installation/"
exit 1
fi
# check if _isaac_sim symlink exists and isaacsim-rl is not installed via pip
if [ ! -L "${ISAACLAB_PATH}/_isaac_sim" ] && ! python -m pip list | grep -q 'isaacsim-rl'; then
echo -e "[WARNING] _isaac_sim symlink not found at ${ISAACLAB_PATH}/_isaac_sim"
echo -e "\tThis warning can be ignored if you plan to install Isaac Sim via pip."
echo -e "\tIf you are using a binary installation of Isaac Sim, please ensure the symlink is created before setting up the conda environment."
fi
# check if the environment exists
local env_path="${ISAACLAB_PATH}/${env_name}"
if [ ! -d "${env_path}" ]; then
echo -e "[INFO] Creating uv environment named '${env_name}'..."
uv venv --clear --python "${python_path}" "${env_path}"
else
echo "[INFO] uv environment '${env_name}' already exists."
fi
# define root path for activation hooks
local isaaclab_root="${ISAACLAB_PATH}"
# cache current paths for later
cache_pythonpath=$PYTHONPATH
cache_ld_library_path=$LD_LIBRARY_PATH
# ensure activate file exists
touch "${env_path}/bin/activate"
# add variables to environment during activation
cat >> "${env_path}/bin/activate" <<EOF
export ISAACLAB_PATH="${ISAACLAB_PATH}"
alias isaaclab="${ISAACLAB_PATH}/isaaclab.sh"
export RESOURCE_NAME="IsaacSim"
if [ -f "${ISAACLAB_PATH}/_isaac_sim/setup_conda_env.sh" ]; then
. "${ISAACLAB_PATH}/_isaac_sim/setup_conda_env.sh"
fi
EOF
# add information to the user about alias
echo -e "[INFO] Added 'isaaclab' alias to uv environment for 'isaaclab.sh' script."
echo -e "[INFO] Created uv environment named '${env_name}'.\n"
echo -e "\t\t1. To activate the environment, run: source ${env_name}/bin/activate."
echo -e "\t\t2. To install Isaac Lab extensions, run: isaaclab -i"
echo -e "\t\t3. To perform formatting, run: isaaclab -f"
echo -e "\t\t4. To deactivate the environment, run: deactivate"
echo -e "\n"
}
# update the vscode settings from template and isaac sim settings # update the vscode settings from template and isaac sim settings
update_vscode_settings() { update_vscode_settings() {
echo "[INFO] Setting up vscode settings..." echo "[INFO] Setting up vscode settings..."
...@@ -348,7 +443,7 @@ update_vscode_settings() { ...@@ -348,7 +443,7 @@ update_vscode_settings() {
# print the usage description # print the usage description
print_help () { print_help () {
echo -e "\nusage: $(basename "$0") [-h] [-i] [-f] [-p] [-s] [-t] [-o] [-v] [-d] [-n] [-c] -- Utility to manage Isaac Lab." echo -e "\nusage: $(basename "$0") [-h] [-i] [-f] [-p] [-s] [-t] [-o] [-v] [-d] [-n] [-c] [-u] -- Utility to manage Isaac Lab."
echo -e "\noptional arguments:" echo -e "\noptional arguments:"
echo -e "\t-h, --help Display the help content." echo -e "\t-h, --help Display the help content."
echo -e "\t-i, --install [LIB] Install the extensions inside Isaac Lab and learning frameworks as extra dependencies. Default is 'all'." echo -e "\t-i, --install [LIB] Install the extensions inside Isaac Lab and learning frameworks as extra dependencies. Default is 'all'."
...@@ -361,6 +456,7 @@ print_help () { ...@@ -361,6 +456,7 @@ print_help () {
echo -e "\t-d, --docs Build the documentation from source using sphinx." echo -e "\t-d, --docs Build the documentation from source using sphinx."
echo -e "\t-n, --new Create a new external project or internal task from template." echo -e "\t-n, --new Create a new external project or internal task from template."
echo -e "\t-c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'." echo -e "\t-c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'."
echo -e "\t-u, --uv [NAME] Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'."
echo -e "\n" >&2 echo -e "\n" >&2
} }
...@@ -386,12 +482,17 @@ while [[ $# -gt 0 ]]; do ...@@ -386,12 +482,17 @@ while [[ $# -gt 0 ]]; do
# install the python packages in IsaacLab/source directory # install the python packages in IsaacLab/source directory
echo "[INFO] Installing extensions inside the Isaac Lab repository..." echo "[INFO] Installing extensions inside the Isaac Lab repository..."
python_exe=$(extract_python_exe) python_exe=$(extract_python_exe)
pip_command=$(extract_pip_command)
pip_uninstall_command=$(extract_pip_uninstall_command)
# check if pytorch is installed and its version # check if pytorch is installed and its version
# install pytorch with cuda 12.8 for blackwell support # install pytorch with cuda 12.8 for blackwell support
ensure_cuda_torch ${python_exe} ensure_cuda_torch
# recursively look into directories and install them # recursively look into directories and install them
# this does not check dependencies between extensions # this does not check dependencies between extensions
export -f extract_python_exe export -f extract_python_exe
export -f extract_pip_command
export -f extract_pip_uninstall_command
export -f install_isaaclab_extension export -f install_isaaclab_extension
# source directory # source directory
find -L "${ISAACLAB_PATH}/source" -mindepth 1 -maxdepth 1 -type d -exec bash -c 'install_isaaclab_extension "{}"' \; find -L "${ISAACLAB_PATH}/source" -mindepth 1 -maxdepth 1 -type d -exec bash -c 'install_isaaclab_extension "{}"' \;
...@@ -411,12 +512,12 @@ while [[ $# -gt 0 ]]; do ...@@ -411,12 +512,12 @@ while [[ $# -gt 0 ]]; do
shift # past argument shift # past argument
fi fi
# install the learning frameworks specified # install the learning frameworks specified
${python_exe} -m pip install -e ${ISAACLAB_PATH}/source/isaaclab_rl["${framework_name}"] ${pip_command} -e "${ISAACLAB_PATH}/source/isaaclab_rl[${framework_name}]"
${python_exe} -m pip install -e ${ISAACLAB_PATH}/source/isaaclab_mimic["${framework_name}"] ${pip_command} -e "${ISAACLAB_PATH}/source/isaaclab_mimic[${framework_name}]"
# in some rare cases, torch might not be installed properly by setup.py, add one more check here # in some rare cases, torch might not be installed properly by setup.py, add one more check here
# can prevent that from happening # can prevent that from happening
ensure_cuda_torch ${python_exe} ensure_cuda_torch
# check if we are inside a docker container or are building a docker image # check if we are inside a docker container or are building a docker image
# in that case don't setup VSCode since it asks for EULA agreement which triggers user interaction # in that case don't setup VSCode since it asks for EULA agreement which triggers user interaction
if is_docker; then if is_docker; then
...@@ -427,8 +528,10 @@ while [[ $# -gt 0 ]]; do ...@@ -427,8 +528,10 @@ while [[ $# -gt 0 ]]; do
update_vscode_settings update_vscode_settings
fi fi
# unset local variables # unset local variables
unset extract_python_exe unset extract_python_exe
unset extract_pip_command
unset extract_pip_uninstall_command
unset install_isaaclab_extension unset install_isaaclab_extension
shift # past argument shift # past argument
;; ;;
...@@ -446,11 +549,25 @@ while [[ $# -gt 0 ]]; do ...@@ -446,11 +549,25 @@ while [[ $# -gt 0 ]]; do
setup_conda_env ${conda_env_name} setup_conda_env ${conda_env_name}
shift # past argument shift # past argument
;; ;;
-u|--uv)
# use default name if not provided
if [ -z "$2" ]; then
echo "[INFO] Using default uv environment name: env_isaaclab"
uv_env_name="env_isaaclab"
else
echo "[INFO] Using uv environment name: $2"
uv_env_name=$2
shift # past argument
fi
# setup the uv environment for Isaac Lab
setup_uv_env ${uv_env_name}
shift # past argument
;;
-f|--format) -f|--format)
# reset the python path to avoid conflicts with pre-commit # reset the python path to avoid conflicts with pre-commit
# this is needed because the pre-commit hooks are installed in a separate virtual environment # this is needed because the pre-commit hooks are installed in a separate virtual environment
# and it uses the system python to run the hooks # and it uses the system python to run the hooks
if [ -n "${CONDA_DEFAULT_ENV}" ]; then if [ -n "${CONDA_DEFAULT_ENV}" ] || [ -n "${VIRTUAL_ENV}" ]; then
cache_pythonpath=${PYTHONPATH} cache_pythonpath=${PYTHONPATH}
export PYTHONPATH="" export PYTHONPATH=""
fi fi
...@@ -458,7 +575,8 @@ while [[ $# -gt 0 ]]; do ...@@ -458,7 +575,8 @@ while [[ $# -gt 0 ]]; do
# check if pre-commit is installed # check if pre-commit is installed
if ! command -v pre-commit &>/dev/null; then if ! command -v pre-commit &>/dev/null; then
echo "[INFO] Installing pre-commit..." echo "[INFO] Installing pre-commit..."
pip install pre-commit pip_command=$(extract_pip_command)
${pip_command} pre-commit
sudo apt-get install -y pre-commit sudo apt-get install -y pre-commit
fi fi
# always execute inside the Isaac Lab directory # always execute inside the Isaac Lab directory
...@@ -467,7 +585,7 @@ while [[ $# -gt 0 ]]; do ...@@ -467,7 +585,7 @@ while [[ $# -gt 0 ]]; do
pre-commit run --all-files pre-commit run --all-files
cd - > /dev/null cd - > /dev/null
# set the python path back to the original value # set the python path back to the original value
if [ -n "${CONDA_DEFAULT_ENV}" ]; then if [ -n "${CONDA_DEFAULT_ENV}" ] || [ -n "${VIRTUAL_ENV}" ]; then
export PYTHONPATH=${cache_pythonpath} export PYTHONPATH=${cache_pythonpath}
fi fi
shift # past argument shift # past argument
...@@ -495,9 +613,10 @@ while [[ $# -gt 0 ]]; do ...@@ -495,9 +613,10 @@ while [[ $# -gt 0 ]]; do
-n|--new) -n|--new)
# run the template generator script # run the template generator script
python_exe=$(extract_python_exe) python_exe=$(extract_python_exe)
pip_command=$(extract_pip_command)
shift # past argument shift # past argument
echo "[INFO] Installing template dependencies..." echo "[INFO] Installing template dependencies..."
${python_exe} -m pip install -q -r ${ISAACLAB_PATH}/tools/template/requirements.txt ${pip_command} -q -r ${ISAACLAB_PATH}/tools/template/requirements.txt
echo -e "\n[INFO] Running template generator...\n" echo -e "\n[INFO] Running template generator...\n"
${python_exe} ${ISAACLAB_PATH}/tools/template/cli.py $@ ${python_exe} ${ISAACLAB_PATH}/tools/template/cli.py $@
# exit neatly # exit neatly
...@@ -532,9 +651,10 @@ while [[ $# -gt 0 ]]; do ...@@ -532,9 +651,10 @@ while [[ $# -gt 0 ]]; do
echo "[INFO] Building documentation..." echo "[INFO] Building documentation..."
# retrieve the python executable # retrieve the python executable
python_exe=$(extract_python_exe) python_exe=$(extract_python_exe)
pip_command=$(extract_pip_command)
# install pip packages # install pip packages
cd ${ISAACLAB_PATH}/docs cd ${ISAACLAB_PATH}/docs
${python_exe} -m pip install -r requirements.txt > /dev/null ${pip_command} -r requirements.txt > /dev/null
# build the documentation # build the documentation
${python_exe} -m sphinx -b html -d _build/doctrees . _build/current ${python_exe} -m sphinx -b html -d _build/doctrees . _build/current
# open the documentation # open the documentation
......
...@@ -15,7 +15,7 @@ It allows you to develop in an isolated environment, outside of the core Isaac L ...@@ -15,7 +15,7 @@ It allows you to develop in an isolated environment, outside of the core Isaac L
## Installation ## Installation
- Install Isaac Lab by following the [installation guide](https://isaac-sim.github.io/IsaacLab/main/source/setup/installation/index.html). - Install Isaac Lab by following the [installation guide](https://isaac-sim.github.io/IsaacLab/main/source/setup/installation/index.html).
We recommend using the conda installation as it simplifies calling Python scripts from the terminal. We recommend using the conda or uv installation as it simplifies calling Python scripts from the terminal.
- Clone or copy this project/repository separately from the Isaac Lab installation (i.e. outside the `IsaacLab` directory): - Clone or copy this project/repository separately from the Isaac Lab installation (i.e. outside the `IsaacLab` directory):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment