Skip to content

Conversation

LucasWilkinson
Copy link
Collaborator

@LucasWilkinson LucasWilkinson commented Sep 26, 2025

make the tools/ep_kernels/install_python_libraries.sh support alternatives to pip3/pip namely uv pip, e.g.

TORCH_CUDA_ARCH_LIST="10.0a" PIP_CMD="uv pip" bash install_python_libraries.sh

Signed-off-by: Lucas Wilkinson <[email protected]>
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for configurable pip commands, like uv pip, in the install_python_libraries.sh script by using a PIP_CMD environment variable. This is a great enhancement for flexibility. The changes also modernize the pip install commands by using the --no-build-isolation flag.

My review focuses on improving the robustness of how the PIP_CMD variable is used. The current implementation with unquoted variables can fail if the command path contains spaces. I've suggested using eval to handle such cases correctly, making the script more reliable for different user environments.


# install dependencies if not installed
pip3 install cmake torch ninja
$PIP_CMD install cmake torch ninja
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Using an unquoted variable $PIP_CMD can lead to unexpected behavior due to word splitting, especially if the command path contains spaces. While it works for the intended uv pip case, it's not robust. A more reliable way to handle a command stored in a string is to use eval. This will correctly handle commands with arguments and paths with spaces (if quoted within the string).

For example, if a user sets PIP_CMD="'/path with spaces/pip' --some-arg", eval will handle it correctly, whereas the current implementation would fail.

Suggested change
$PIP_CMD install cmake torch ninja
eval "$PIP_CMD install cmake torch ninja"

# see https://github.com/pypa/pip/issues/9955#issuecomment-838065925
# PIP_NO_BUILD_ISOLATION=0 disables build isolation
PIP_NO_BUILD_ISOLATION=0 pip install -vvv -e .
$PIP_CMD install --no-build-isolation -vvv -e .
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Similar to the previous comment, using an unquoted $PIP_CMD here is not robust. Using eval will ensure that commands with multiple parts or paths with spaces are handled correctly.

Suggested change
$PIP_CMD install --no-build-isolation -vvv -e .
eval "$PIP_CMD install --no-build-isolation -vvv -e ."

cd DeepEP
export NVSHMEM_DIR=$WORKSPACE/nvshmem_install
PIP_NO_BUILD_ISOLATION=0 pip install -vvv -e .
$PIP_CMD install --no-build-isolation -vvv -e .
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Similar to the previous comments, using an unquoted $PIP_CMD here is not robust. Using eval will ensure that commands with multiple parts or paths with spaces are handled correctly.

Suggested change
$PIP_CMD install --no-build-isolation -vvv -e .
eval "$PIP_CMD install --no-build-isolation -vvv -e ."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant