Skip to content

Improves uv environment support in isaaclab.sh - #4269

Merged
kellyguo11 merged 3 commits into
isaac-sim:developfrom
cidxb:fix/installation_sh
Jan 30, 2026
Merged

kellyguo11 merged 3 commits into
isaac-sim:developfrom
cidxb:fix/installation_sh

Conversation

@cidxb

@cidxb cidxb commented Dec 23, 2025

Copy link
Copy Markdown
Contributor

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:

Type of change

  • New feature (non-breaking change which adds functionality)
  • 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

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

@github-actions github-actions Bot added bug Something isn't working infrastructure labels Dec 23, 2025
@greptile-apps

greptile-apps Bot commented Dec 23, 2025 •

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

This PR enhances the isaaclab.sh script to support flexible virtual environment workflows, allowing installation into existing uv/venv/conda environments instead of requiring a new environment in the IsaacLab directory.

Key Changes

  • Environment Detection: Script now detects and uses active uv/venv/conda environments during installation with improved grep pattern matching (^uv\s*=)
  • Smart Python Version Selection: Automatically detects Isaac Sim version (4.5 vs 5.0+) and selects appropriate Python version (3.10 vs 3.11)
  • UX Improvements: Added environment path display during installation and helpful hints when running -u with an active environment
  • Compatibility Fix: Fixed tabs command error in non-interactive terminals with 2>/dev/null || true

Issues Found

  • Missing quotes around function arguments on line 694 could cause word splitting
  • Python version detection uses system python command which may not match the intended Python executable in mixed environments

Confidence Score: 4/5

  • This PR is safe to merge after addressing the two identified issues
  • The changes improve flexibility and user experience. Two issues were identified: missing quotes around function arguments (line 694) that could cause word splitting, and inconsistent Python executable detection (line 686) that uses system python instead of the script's helper function. Both are straightforward fixes.
  • isaaclab.sh:694 (missing quotes) and isaaclab.sh:686 (inconsistent python detection)

Important Files Changed

Filename Overview
isaaclab.sh Enhanced uv environment support with Python version auto-detection and improved UX, contains one logical issue with variable quoting

Sequence Diagram

sequenceDiagram
    participant User
    participant isaaclab.sh
    participant uv/conda
    participant Python
    participant IsaacSim
    
    alt Creating new uv environment
        User->>isaaclab.sh: ./isaaclab.sh -u my_env
        isaaclab.sh->>isaaclab.sh: Check if VIRTUAL_ENV is set
        alt Already in uv environment
            isaaclab.sh->>User: [INFO] Detected active uv environment
            isaaclab.sh->>User: Use ./isaaclab.sh -i instead
        else No active environment
            isaaclab.sh->>IsaacSim: is_isaacsim_version_4_5()
            alt Isaac Sim 4.5 detected
                IsaacSim-->>isaaclab.sh: version = 4.5.x
                isaaclab.sh->>isaaclab.sh: python_version = "3.10"
            else Isaac Sim 5.0+ or not detected
                isaaclab.sh->>Python: python -c "import isaacsim"
                alt isaacsim importable
                    Python-->>isaaclab.sh: Success
                    isaaclab.sh->>isaaclab.sh: python_version = "3.11"
                else isaacsim not found
                    Python-->>isaaclab.sh: Error
                    isaaclab.sh->>isaaclab.sh: python_version = "3.11" (default)
                end
            end
            isaaclab.sh->>uv/conda: uv venv --python ${python_version} ${env_name}
            uv/conda-->>isaaclab.sh: Environment created
            isaaclab.sh->>User: [INFO] Created uv environment
        end
    end
    
    alt Installing in existing environment
        User->>uv/conda: source my_env/bin/activate
        uv/conda-->>User: Environment activated (VIRTUAL_ENV set)
        User->>isaaclab.sh: ./isaaclab.sh -i
        isaaclab.sh->>isaaclab.sh: extract_python_exe()
        isaaclab.sh->>isaaclab.sh: extract_pip_command()
        alt VIRTUAL_ENV set and pyvenv.cfg has uv
            isaaclab.sh->>isaaclab.sh: pip_command = "uv pip install"
        else CONDA_PREFIX set
            isaaclab.sh->>isaaclab.sh: pip_command = "${python_exe} -m pip install"
        end
        isaaclab.sh->>User: [INFO] Using environment: ${VIRTUAL_ENV}
        isaaclab.sh->>User: [INFO] Python executable: ${python_exe}
        isaaclab.sh->>Python: Install Isaac Lab extensions
        Python-->>isaaclab.sh: Installation complete
    end
Loading

@greptile-apps greptile-apps Bot left a comment •

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.

Additional Comments (4)

  1. isaaclab.sh, line 679-685 (link)

    logic: calling is_isaacsim_version_4_5 requires a working Python executable from extract_python_exe(). If no environment is active AND _isaac_sim/python.sh doesn't exist AND system python lacks isaacsim-rl, the script will exit with an error before creating the environment. This breaks the workflow for users who want to create a uv environment before installing Isaac Sim.

    fallback to a default version (3.11) if version detection fails:

  2. isaaclab.sh, line 236-237 (link)

    logic: grep -q "uv" uses substring matching, which could cause false positives if "uv" appears anywhere in pyvenv.cfg (e.g., in a path like /home/uv_user/ or version strings). Use a more specific pattern:

  3. isaaclab.sh, line 249-250 (link)

    logic: same substring matching issue as in extract_pip_command. Use a more specific pattern to avoid false positives:

  4. isaaclab.sh, line 457-458 (link)

    logic: same substring matching issue. Use a more specific pattern:

1 file reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

- Allow installation into existing uv/venv environments
- Auto-detect Isaac Sim version for Python version selection
- Display active environment information during installation
- Fix tabs command compatibility for non-interactive terminals

This change enables more flexible workflow patterns by detecting
and using active virtual environments instead of forcing creation
of new environments in the IsaacLab directory."
@cidxb

cidxb commented Dec 23, 2025

Copy link
Copy Markdown
Contributor Author

I have fixed the bugs that greptile has mentioned.

@Mayankm96
Mayankm96 force-pushed the main branch 2 times, most recently from 2ef7fc8 to f3061a4 Compare January 28, 2026 16:16
@cidxb

cidxb commented Jan 30, 2026

Copy link
Copy Markdown
Contributor Author

Hi maintainers, the PR has been approved and is now waiting for workflow approval.
Thanks for your time!

@kellyguo11

Copy link
Copy Markdown
Contributor

@greptile-apps

@greptile-apps greptile-apps Bot left a comment

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.

1 file reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment thread isaaclab.sh Resolved
Comment thread isaaclab.sh Resolved
@cidxb

cidxb commented Jan 30, 2026

Copy link
Copy Markdown
Contributor Author

@greptile-apps can we push forward now?

@greptile-apps

greptile-apps Bot commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

Based on the PR status, I can see that:

  1. Status: The PR is mergeable but blocked (mergeable_state: "blocked")
  2. Reviews: You have an approval from Mayankm96, which is positive
  3. Pending checks: There are pending CI checks that haven't completed yet
  4. Review feedback: There are some unresolved code review comments from me (Greptile bot) about grep pattern improvements and error handling logic

Here's the current situation:

✅ Positives:

  • The PR has an approval from a contributor (Mayankm96)
  • The code is functionally mergeable
  • Your testing scenarios look comprehensive

❌ Blocking factors:

  • CI checks are still pending/running
  • There are unresolved code review comments about:
    • Substring matching issues in grep patterns that could cause false positives
    • Error handling logic that could break workflows for new users

Recommendation: Not quite ready to push forward yet. You should:

  1. Wait for CI checks to complete - The status shows pending checks that need to pass
  2. Address the code review feedback - The grep pattern issues are legitimate concerns that could cause subtle bugs
  3. Get reviewer acknowledgment - Since there are outstanding comments, it's good practice to have them reviewed/resolved

The PR is close but needs these technical issues resolved before it's safe to merge. The feedback about grep patterns is particularly important as it could cause false environment detection.

@cidxb

cidxb commented Jan 30, 2026

Copy link
Copy Markdown
Contributor Author

@greptile-apps What should we do next?

@greptile-apps

greptile-apps Bot commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

Based on the current status of your PR, here's what you should do next:

✅ Good News - Major Progress Made:

  • Approval obtained from Mayankm96 (maintainer) ✅
  • Code review issues resolved - Both Python execution and variable quoting issues have been properly addressed ✅
  • CI Status: Shows pending (not failed) which means checks are likely queued or still running

🚧 Outstanding Items to Address:

1. Grep Pattern Issues (High Priority)

There are still 4 unresolved comments about substring matching in grep patterns that could cause false positives:

Lines to fix:

  • isaaclab.sh:236-237 - grep -q "uv" in extract_pip_command
  • isaaclab.sh:249-250 - grep -q "uv" in environment detection
  • isaaclab.sh:457-458 - grep -q "uv" in another location
  • isaaclab.sh:679-685 - Error handling logic for new users

The Issue: grep -q "uv" matches anywhere in the file (e.g., paths like /home/uv_user/). Should use grep -q "^uv\s*=" for exact key matching.

2. Potential Logic Issue

Line 679-685: The current logic could break for new users who want to create a uv environment before installing Isaac Sim, because is_isaacsim_version_4_5 requires a working Python with Isaac Sim packages.

🎯 Immediate Action Items:

  1. Fix the grep patterns to prevent false environment detection
  2. Add fallback logic for Python version detection when Isaac Sim isn't installed yet
  3. Wait for CI completion (they're pending, not failing)

📋 Next Steps:

  1. Address the grep pattern issues with more specific patterns
  2. Test the edge case where users create uv environment before Isaac Sim installation
  3. Once CI passes and patterns are fixed, the PR should be ready to merge

The core functionality looks solid - you just need to make these grep patterns more robust to avoid potential false positives in production use.

@kellyguo11 kellyguo11 changed the title Improve uv environment support in isaaclab.sh Improves uv environment support in isaaclab.sh Jan 30, 2026
@kellyguo11
kellyguo11 changed the base branch from main to develop January 30, 2026 20:05
@kellyguo11

Copy link
Copy Markdown
Contributor

Thanks for the updates! will point this to our new development branch

@kellyguo11
kellyguo11 merged commit 2c60472 into isaac-sim:develop Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants