From e571091e62e8ebd592d817978314a800388d2855 Mon Sep 17 00:00:00 2001 From: Kezhuo Wang Date: Thu, 25 Sep 2025 05:48:49 -0700 Subject: [PATCH 1/3] add option to specifiy python when creating venv with uv --- isaaclab.sh | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/isaaclab.sh b/isaaclab.sh index 263ff88e8a2..2070d376b6b 100755 --- a/isaaclab.sh +++ b/isaaclab.sh @@ -429,7 +429,7 @@ setup_uv_env() { 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}" + uv venv --clear ${python_path:+--python "$python_path"} "${env_path}" else echo "[INFO] uv environment '${env_name}' already exists." fi @@ -496,7 +496,18 @@ print_help () { 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-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 "\t-u, --uv [NAME] [--python PYTHON_PATH]" + echo -e "\t Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'." + echo -e "\t Optionally specify a Python interpreter path to use for the environment." + echo -e "\nExamples:" + echo -e "\t 1. uv environment creation:" + echo -e "\t\t1.a create env_isaaclab with system python3" + echo -e "\t\t$(basename "$0") --uv" + echo -e "\t\t1.b create myenv with system python3" + echo -e "\t\t$(basename "$0") --uv myenv " + echo -e "\t\t1.c create myenv with specified Python 3.11" + echo -e "\t\t$(basename "$0") --uv myenv --python ${HOME}/isaacsim50/kit/python/bin/python3" + echo -e "\t" echo -e "\n" >&2 } @@ -590,18 +601,20 @@ while [[ $# -gt 0 ]]; do 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 + uv_env_name="env_isaaclab" + python_path="" + # consume env name + if [[ -n "$2" && "$2" != "--python" ]]; then + uv_env_name="$2" + shift fi - # setup the uv environment for Isaac Lab - setup_uv_env ${uv_env_name} - shift # past argument + # consume python path + if [[ "$2" == "--python" && -n "$3" ]]; then + python_path="$3" + shift 2 + fi + setup_uv_env "${uv_env_name}" "${python_path}" + shift ;; -f|--format) # reset the python path to avoid conflicts with pre-commit From 3ff0dcca62340e1a918e878ccaf3487a0f835d3d Mon Sep 17 00:00:00 2001 From: Kezhuo Wang Date: Tue, 14 Oct 2025 16:32:52 -0700 Subject: [PATCH 2/3] use delimiter -- to pass additional uv args when creating venv with uv --- isaaclab.sh | 66 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/isaaclab.sh b/isaaclab.sh index 4be9be0e1a8..9519c614512 100755 --- a/isaaclab.sh +++ b/isaaclab.sh @@ -406,9 +406,9 @@ setup_conda_env() { # setup uv environment for Isaac Lab setup_uv_env() { - # get environment name from input local env_name="$1" - local python_path="$2" + shift 1 + local extra_uv_args=("$@") # check uv is installed if ! command -v uv &>/dev/null; then @@ -429,7 +429,18 @@ setup_uv_env() { 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_path:+--python "$python_path"} "${env_path}" + # make the command + declare -a uv_cmd=("uv" "venv") + uv_cmd+=("$env_path") + uv_cmd+=("${extra_uv_args[@]}") + # print the command + printf '[INFO] Executing:' + for arg in "${uv_cmd[@]}"; do + printf ' %q' "$arg" + done + echo + # run the command + "${uv_cmd[@]}" else echo "[INFO] uv environment '${env_name}' already exists." fi @@ -496,18 +507,7 @@ print_help () { 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-c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'." - echo -e "\t-u, --uv [NAME] [--python PYTHON_PATH]" - echo -e "\t Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'." - echo -e "\t Optionally specify a Python interpreter path to use for the environment." - echo -e "\nExamples:" - echo -e "\t 1. uv environment creation:" - echo -e "\t\t1.a create env_isaaclab with system python3" - echo -e "\t\t$(basename "$0") --uv" - echo -e "\t\t1.b create myenv with system python3" - echo -e "\t\t$(basename "$0") --uv myenv " - echo -e "\t\t1.c create myenv with specified Python 3.11" - echo -e "\t\t$(basename "$0") --uv myenv --python ${HOME}/isaacsim50/kit/python/bin/python3" - echo -e "\t" + echo -e "\t-u, --uv [NAME] Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'. Use delimiter -- to pass additional arg to uv." echo -e "\n" >&2 } @@ -601,20 +601,32 @@ while [[ $# -gt 0 ]]; do shift # past argument ;; -u|--uv) + shift uv_env_name="env_isaaclab" - python_path="" - # consume env name - if [[ -n "$2" && "$2" != "--python" ]]; then - uv_env_name="$2" - shift - fi - # consume python path - if [[ "$2" == "--python" && -n "$3" ]]; then - python_path="$3" - shift 2 + extra_args=() + + # look for delimiter -- + while [[ $# -gt 0 ]]; do + case "$1" in + --) shift; extra_args=("$@"); break ;; # everything after -- goes to uv + -*) + echo "[Error] Unknown option for --uv: $1" + exit 1 + ;; + *) + uv_env_name="$1" + shift + ;; + esac + done + + echo "[INFO] Using env name: ${uv_env_name}" + if [[ ${#extra_args[@]} -gt 0 ]]; then + echo "[INFO] Forwarding extra uv args: ${extra_args[*]}" fi - setup_uv_env "${uv_env_name}" "${python_path}" - shift + + setup_uv_env "${uv_env_name}" "${extra_args[@]}" + break ;; -f|--format) # reset the python path to avoid conflicts with pre-commit From 5b0c2d2447f870b7a17533592cb7475599511e2c Mon Sep 17 00:00:00 2001 From: Kezhuo Wang Date: Tue, 14 Oct 2025 21:29:34 -0700 Subject: [PATCH 3/3] updated uv related docs --- .../source/setup/installation/include/src_clone_isaaclab.rst | 3 +-- .../setup/installation/include/src_python_virtual_env.rst | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/source/setup/installation/include/src_clone_isaaclab.rst b/docs/source/setup/installation/include/src_clone_isaaclab.rst index 844cac2f3fd..fbefad0e31e 100644 --- a/docs/source/setup/installation/include/src_clone_isaaclab.rst +++ b/docs/source/setup/installation/include/src_clone_isaaclab.rst @@ -53,7 +53,7 @@ respectively that provides utilities to manage extensions. -d, --docs Build the documentation from source using sphinx. -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'. - -u, --uv [NAME] Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'. + -u, --uv [NAME] Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'. Use delimiter -- to pass additional arg to uv. .. tab-item:: :icon:`fa-brands fa-windows` Windows :sync: windows @@ -75,4 +75,3 @@ respectively that provides utilities to manage extensions. -d, --docs Build the documentation from source using sphinx. -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'. - -u, --uv [NAME] Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'. diff --git a/docs/source/setup/installation/include/src_python_virtual_env.rst b/docs/source/setup/installation/include/src_python_virtual_env.rst index 7757e40ca31..306cc2359f0 100644 --- a/docs/source/setup/installation/include/src_python_virtual_env.rst +++ b/docs/source/setup/installation/include/src_python_virtual_env.rst @@ -50,8 +50,11 @@ instead of *./isaaclab.sh -p* or *isaaclab.bat -p*. # Option 1: Default environment name 'env_isaaclab' ./isaaclab.sh --uv # or "./isaaclab.sh -u" - # Option 2: Custom name + # Option 2: Custom environment name ./isaaclab.sh --uv my_env # or "./isaaclab.sh -u my_env" + # Option 3: Custom environment name with additional args to uv + # the following command set the path to python interpreter and use verbose output + ./isaaclab.sh --uv my_env -- --python ${HOME}/isaacsim50/kit/python/bin/python3 --verbose .. code:: bash