Adds optional --python arg when --uv is used to create venv
Description
This PR directly addresses #3559.
Type of change
- New feature (non-breaking change which adds functionality)
Checklist
- [x] I have read and understood the contribution guidelines
- [x] I have run the
pre-commitchecks with./isaaclab.sh --format - [ ] 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.tomlfile - [ ] I have added my name to the
CONTRIBUTORS.mdor my name already exists there
I was blocked by not being able to specify the python path to uv as well. I wrote a fix but then found this PR. The diff for my fix is below. You might want to use the portion that has it default to a given Python version based on the Isaac Sim version as stated here.
╰─$ git diff
diff --git a/isaaclab.sh b/isaaclab.sh
index 263ff88e8a..92f66eb9d3 100755
--- a/isaaclab.sh
+++ b/isaaclab.sh
@@ -496,7 +496,8 @@ 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_PATH] Create the uv environment for Isaac Lab. Default name is 'env_isaaclab'."
+ echo -e "\t Optional PYTHON_PATH: Python interpreter path (e.g., '3.11', 'python3.10', or '/usr/bin/python3.11')."
echo -e "\n" >&2
}
@@ -599,8 +600,25 @@ while [[ $# -gt 0 ]]; do
uv_env_name=$2
shift # past argument
fi
+
+ # check if python path is provided
+ if [ -n "$2" ] && [[ "$2" != -* ]]; then
+ echo "[INFO] Using python interpreter: $2"
+ python_path="$2"
+ shift # past argument
+ else
+ # use default python version based on Isaac Sim version
+ if is_isaacsim_version_4_5; then
+ echo "[INFO] Detected Isaac Sim 4.5 → using python 3.10"
+ python_path="3.10"
+ else
+ echo "[INFO] Using default python 3.11"
+ python_path="3.11"
+ fi
+ fi
+
# setup the uv environment for Isaac Lab
- setup_uv_env ${uv_env_name}
+ setup_uv_env ${uv_env_name} ${python_path}
shift # past argument
;;
-f|--format)
I agree with @rowoflo that the default should be the version based on isaacsim (that's what I had intended the default behavior to be). Thanks for this PR! I'm not sure if you need so much context in the help script, but the core change + default fixes the problem.
@kellyguo11 with a little polish this should solve #3524
@KyleM73 The help texts was included to showcase how to use the option. For my use case, I have multiple python3.11 installed so I need the path to be specific when creating the venv.