Repository navigation
Refactors ensure_cuda_torch function to use extracted python and pip commands - #3949
Conversation
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
This PR refactors the ensure_cuda_torch function in isaaclab.sh to fix a compatibility issue with UV package manager installations. The changes replace direct parameter passing and hardcoded pip commands with calls to existing helper functions (extract_python_exe(), extract_pip_command(), extract_pip_uninstall_command()) that properly detect and use the appropriate commands for different environments (conda, UV, system python). The version checking logic is also improved by using direct Python imports instead of pip version queries, making it more reliable across different package managers. The contributor has also added their name to the CONTRIBUTORS.md file following project guidelines.
Important Files Changed
| Filename | Score | Overview |
|---|---|---|
| isaaclab.sh | 4/5 | Refactored ensure_cuda_torch function to use helper functions for UV compatibility and improved version checking |
| CONTRIBUTORS.md | 5/5 | Added new contributor "Zijian Li" to the alphabetically sorted list |
Confidence score: 4/5
- This PR addresses a legitimate bug that breaks UV installations and uses well-established helper functions already present in the codebase
- Score reflects solid implementation using existing patterns, though the checklist indicates missing documentation updates and tests for the fix
- Pay close attention to
isaaclab.shto ensure the refactored function works correctly across all supported environments (conda, UV, system python)
Sequence Diagram
sequenceDiagram
participant User
participant Script as "isaaclab.sh"
participant System as "System Commands"
participant Python as "Python/Pip"
participant UV as "UV Package Manager"
User->>Script: "./isaaclab.sh --install"
Script->>Script: "install_system_deps()"
Script->>System: "Check if cmake installed"
System-->>Script: "Status response"
alt cmake not installed
Script->>System: "sudo apt-get install cmake build-essential"
end
Script->>Script: "extract_python_exe()"
Script->>Script: "extract_pip_command()"
Script->>Script: "extract_pip_uninstall_command()"
alt ARM architecture detected
Script->>Script: "begin_arm_install_sandbox()"
Script->>Script: "Unset LD_PRELOAD temporarily"
end
Script->>Script: "ensure_cuda_torch()"
alt UV environment detected
Script->>UV: "uv pip uninstall torch torchvision torchaudio"
UV-->>Script: "Uninstall response"
Script->>UV: "uv pip install torch torchvision"
UV-->>Script: "Install response"
else Standard pip environment
Script->>Python: "python -m pip uninstall torch torchvision torchaudio"
Python-->>Script: "Uninstall response"
Script->>Python: "python -m pip install torch torchvision"
Python-->>Script: "Install response"
end
Script->>Script: "Install isaaclab extensions"
Script->>Python: "Install source directory extensions"
Python-->>Script: "Extension install responses"
Script->>Python: "Install RL frameworks"
Python-->>Script: "Framework install response"
Script->>Script: "ensure_cuda_torch() (verification)"
alt ARM architecture
Script->>Script: "end_arm_install_sandbox()"
Script->>Script: "Restore LD_PRELOAD"
end
alt Not in Docker
Script->>Script: "update_vscode_settings()"
Script->>Python: "Run setup_vscode.py"
Python-->>Script: "VSCode setup response"
end
Script-->>User: "Installation complete"
2 files reviewed, no comments
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
This PR refactors the ensure_cuda_torch function in isaaclab.sh to fix UV package manager compatibility issues. The changes replace hardcoded pip commands with standardized helper functions that automatically detect the environment type and use appropriate commands (uv pip for UV environments, pip for standard environments). The refactoring removes the python executable parameter from the function and adds a new extract_pip_uninstall_command() helper function. Additionally, the contributor Zijian Li has been added to the CONTRIBUTORS.md file following the project's alphabetical ordering guidelines.
Important Files Changed
| Filename | Score | Overview |
|---|---|---|
CONTRIBUTORS.md |
5/5 | Adds new contributor "Zijian Li" to the alphabetical list |
isaaclab.sh |
4/5 | Refactors ensure_cuda_torch function to use extracted commands and adds extract_pip_uninstall_command() helper |
Confidence score: 4/5
- This PR is relatively safe to merge with low risk of breaking existing functionality
- Score reflects well-structured changes that follow established patterns, but deducted one point due to changes in critical installation logic that could affect multiple package managers and the lack of comprehensive testing coverage mentioned in the checklist
- Pay close attention to the
isaaclab.shfile, particularly the refactoredensure_cuda_torchfunction and newextract_pip_uninstall_command()helper
2 files reviewed, no comments
…commands (isaac-sim#3949) # Description <!-- Thank you for your interest in sending a pull request. Please make sure to check the contribution guidelines. Link: https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html 💡 Please try to keep PRs small and focused. Large PRs are harder to review and merge. --> Since the latest update in `isaaclab.sh` breaks installation with uv, I modified `ensure_cuda_torch` to maintain compatiability with uv installation method. Tested on my machine and it works Fixes isaac-sim#3524 <!-- As a practice, it is recommended to open an issue to have discussions on the proposed pull request. This makes it easier for the community to keep track of what is being developed or added, and if a given feature is demanded by more than one party. --> ## Type of change <!-- As you go through the list, delete the ones that are not applicable. --> - Bug fix (non-breaking change which fixes an issue) ## Screenshots Please attach before and after screenshots of the change if applicable. <!-- Example: | Before | After | | ------ | ----- | | _gif/png before_ | _gif/png after_ | To upload images to a PR -- simply drag and drop an image while in edit mode and it should upload the image directly. You can then paste that source into the above before/after sections. --> ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) 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 - [x] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there <!-- As you go through the checklist above, you can mark something as done by putting an x character in it For example, - [x] I have done this task - [ ] I have not done this task --> --------- Co-authored-by: Kelly Guo <[email protected]>
…commands (isaac-sim#3949) # Description <!-- Thank you for your interest in sending a pull request. Please make sure to check the contribution guidelines. Link: https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html 💡 Please try to keep PRs small and focused. Large PRs are harder to review and merge. --> Since the latest update in `isaaclab.sh` breaks installation with uv, I modified `ensure_cuda_torch` to maintain compatiability with uv installation method. Tested on my machine and it works Fixes isaac-sim#3524 <!-- As a practice, it is recommended to open an issue to have discussions on the proposed pull request. This makes it easier for the community to keep track of what is being developed or added, and if a given feature is demanded by more than one party. --> ## Type of change <!-- As you go through the list, delete the ones that are not applicable. --> - Bug fix (non-breaking change which fixes an issue) ## Screenshots Please attach before and after screenshots of the change if applicable. <!-- Example: | Before | After | | ------ | ----- | | _gif/png before_ | _gif/png after_ | To upload images to a PR -- simply drag and drop an image while in edit mode and it should upload the image directly. You can then paste that source into the above before/after sections. --> ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) 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 - [x] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there <!-- As you go through the checklist above, you can mark something as done by putting an x character in it For example, - [x] I have done this task - [ ] I have not done this task --> --------- Co-authored-by: Kelly Guo <[email protected]>
…commands (isaac-sim#3949) # Description <!-- Thank you for your interest in sending a pull request. Please make sure to check the contribution guidelines. Link: https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html 💡 Please try to keep PRs small and focused. Large PRs are harder to review and merge. --> Since the latest update in `isaaclab.sh` breaks installation with uv, I modified `ensure_cuda_torch` to maintain compatiability with uv installation method. Tested on my machine and it works Fixes isaac-sim#3524 <!-- As a practice, it is recommended to open an issue to have discussions on the proposed pull request. This makes it easier for the community to keep track of what is being developed or added, and if a given feature is demanded by more than one party. --> ## Type of change <!-- As you go through the list, delete the ones that are not applicable. --> - Bug fix (non-breaking change which fixes an issue) ## Screenshots Please attach before and after screenshots of the change if applicable. <!-- Example: | Before | After | | ------ | ----- | | _gif/png before_ | _gif/png after_ | To upload images to a PR -- simply drag and drop an image while in edit mode and it should upload the image directly. You can then paste that source into the above before/after sections. --> ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) 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 - [x] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there <!-- As you go through the checklist above, you can mark something as done by putting an x character in it For example, - [x] I have done this task - [ ] I have not done this task --> --------- Co-authored-by: Kelly Guo <[email protected]>
Description
Since the latest update in
isaaclab.shbreaks installation with uv, I modifiedensure_cuda_torchto maintain compatiability with uv installation method. Tested on my machine and it worksFixes #3524
Type of change
Screenshots
Please attach before and after screenshots of the change if applicable.
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there