Skip to content

Adds optional --python arg when --uv is used to create venv - #3560

Closed
kwang-12 wants to merge 5 commits into
isaac-sim:mainfrom
kwang-12:main
Closed

kwang-12 wants to merge 5 commits into
isaac-sim:mainfrom
kwang-12:main

Conversation

@kwang-12

@kwang-12 kwang-12 commented Sep 25, 2025 •

Copy link
Copy Markdown

Description

This PR directly addresses #3559.

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • 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
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@rowoflo

rowoflo commented Oct 8, 2025

Copy link
Copy Markdown

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)

@Mayankm96 Mayankm96 moved this to In review in Isaac Lab Oct 10, 2025
@Mayankm96 Mayankm96 moved this from In review to In progress in Isaac Lab Oct 10, 2025
@KyleM73

KyleM73 commented Oct 13, 2025

Copy link
Copy Markdown
Contributor

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.

@KyleM73

KyleM73 commented Oct 13, 2025

Copy link
Copy Markdown
Contributor

@kellyguo11 with a little polish this should solve #3524

@kwang-12

Copy link
Copy Markdown
Author

@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.

Comment thread isaaclab.sh Outdated
Comment on lines +501 to +509
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"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should go to the docs instead of having it here? Or maybe more optional, i.e. printed only when uv --help is passed? Otherwise it becomes many things.

Comment thread isaaclab.sh Resolved
@kwang-12
kwang-12 requested a review from jtigue-bdai as a code owner October 15, 2025 04:29
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Oct 15, 2025
@kellyguo11 kellyguo11 moved this from In progress to In review in Isaac Lab Nov 3, 2025
@kellyguo11 kellyguo11 changed the title Add optional --python arg when --uv is used to create venv Adds optional --python arg when --uv is used to create venv Nov 6, 2025
@Mayankm96
Mayankm96 force-pushed the main branch 2 times, most recently from 2ef7fc8 to f3061a4 Compare January 28, 2026 16:16
kellyguo11 pushed a commit that referenced this pull request Jan 30, 2026
# Description

This PR enhances the `isaaclab.sh` installation script to support
flexible virtual environment workflows by allowing installation into
existing uv/venv environments.

## Changes

- **Environment Detection**: Detect and use active uv/venv/conda
environments during installation
- **Environment Display**: Show current environment path and Python
executable when installing
- **Smart Python Selection**: Auto-detect Isaac Sim version (4.5 vs
5.0+) and select appropriate Python version (3.10 vs 3.11)
- **Improved UX**: Provide helpful hints when running `-u` with an
active environment
- **Compatibility Fix**: Fix tabs command error in non-interactive
terminals

## Motivation

Previously, users had to create a new environment in the IsaacLab
directory. This PR enables modern Python workflows where users can:
- Install Isaac Lab into project-specific virtual environments
- Use `uv` project-based workflows
- Manage multiple Isaac Lab installations in different environments
The issue is mentioned in
#3783 and
#3560
## Type of change

- [x] New feature (non-breaking change which adds functionality)
- [x] Documentation update (help text improvements)

## Testing

Tested scenarios:
- ✅ Installation in existing uv environment
- ✅ Installation in existing conda environment
- ✅ Creating new environment with `-u` flag
- ✅ Environment switching between multiple installations
- ✅ Script help output (`./isaaclab.sh -h`)

## Checklist

- [x] I have run the `pre-commit` checks with `./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation (help text)
- [x] My changes generate no new warnings
- [x] Maintains backward compatibility with existing workflows

---------

Co-authored-by: Liang,Yi <[email protected]>
@kwang-12 kwang-12 closed this Mar 27, 2026
@github-project-automation github-project-automation Bot moved this from In review to Done in Isaac Lab Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation infrastructure isaac-lab Related to Isaac Lab team

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants