Skip to content

Conversation

@cidxb
Copy link

@cidxb cidxb commented Dec 23, 2025

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
Copy link
Contributor

greptile-apps bot commented Dec 23, 2025

Greptile Summary

This PR enhances isaaclab.sh to support flexible uv/venv environment workflows, addressing issues #3783 and #3560. The changes add environment detection, automatic Python version selection (3.10 for Isaac Sim 4.5, 3.11 for 5.0+), and improved user guidance.

Key improvements:

  • Detects active uv/venv/conda environments and displays helpful information during installation
  • Auto-selects correct Python version based on Isaac Sim version
  • Prevents creating duplicate environments when one is already active
  • Fixes tabs command error in non-interactive terminals
  • Improves help text and adds usage examples

Critical issues found:

  • Breaking bug in environment creation: Calling is_isaacsim_version_4_5() during ./isaaclab.sh -u requires a working Python executable. If no environment is active AND Isaac Sim isn't installed yet, the script exits with an error, preventing users from creating environments before installing Isaac Sim (isaaclab.sh:679-685)
  • Unreliable uv detection: Using grep -q "uv" for substring matching in pyvenv.cfg can cause false positives if "uv" appears in paths or other content (isaaclab.sh:236, 249, 457)

The PR addresses the original issue of incorrect Python versions, but introduces a regression that breaks the "create environment first, install Isaac Sim later" workflow.

Confidence Score: 2/5

  • This PR has a critical bug that breaks environment creation workflows and requires fixes before merging
  • Score reflects the presence of a critical logic bug in the version detection flow (isaaclab.sh:679-685) that will cause the script to exit with an error when users try to create a new uv environment without having Isaac Sim already installed. This breaks the intended workflow described in the PR. Additionally, the uv environment detection uses unreliable substring matching that could cause false positives. While the PR's goals are sound and it addresses real issues, these bugs must be fixed before merging.
  • Pay close attention to isaaclab.sh lines 679-685 (version detection) and lines 236, 249, 457 (uv detection)

Important Files Changed

Filename Overview
isaaclab.sh Enhanced uv environment support with smart Python version detection, but has critical bug in version detection that breaks environment creation workflow

Sequence Diagram

sequenceDiagram
    participant User
    participant Script as isaaclab.sh
    participant UV as uv command
    participant Python as Python/Isaac Sim
    
    alt Creating new environment (./isaaclab.sh -u)
        User->>Script: ./isaaclab.sh -u my_env
        Script->>Script: Check if VIRTUAL_ENV is active
        alt Active uv environment detected
            Script->>User: [INFO] Detected active uv environment
            Script->>User: Use ./isaaclab.sh -i or deactivate first
        else No active environment
            Script->>Python: is_isaacsim_version_4_5()
            Python->>Script: extract_python_exe()
            alt Isaac Sim found
                Python-->>Script: Return version (4.5 or 5.0+)
                Script->>Script: Set python_version (3.10 or 3.11)
                Script->>UV: uv venv --python {version} {env_name}
                UV-->>Script: Environment created
                Script->>User: [INFO] Created environment
            else Isaac Sim NOT found
                Python-->>Script: ERROR: Unable to find Python
                Script->>User: EXIT 1 (BREAKS WORKFLOW)
            end
        end
    end
    
    alt Installing in existing environment (./isaaclab.sh -i)
        User->>Script: source my_env/bin/activate
        User->>Script: ./isaaclab.sh -i
        Script->>Script: extract_python_exe() from VIRTUAL_ENV
        Script->>Script: Check pyvenv.cfg for "uv" substring
        alt Contains "uv" (substring match)
            Script->>Script: Use "uv pip install"
        else No "uv" found
            Script->>Script: Use "python -m pip install"
        end
        Script->>User: [INFO] Using environment: {VIRTUAL_ENV}
        Script->>Script: Install Isaac Lab extensions
    end
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

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 force-pushed the fix/installation_sh branch from 192805a to f465270 Compare December 23, 2025 04:31
@cidxb
Copy link
Author

cidxb commented Dec 23, 2025

I have fixed the bugs that greptile has mentioned.

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.

1 participant