Skip to content

Commit

Permalink
Quote pip installs correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
rohinb2 committed Jul 18, 2024
1 parent 5875d9b commit 7ac6349
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion runhouse/resources/packages/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ def _pip_install_cmd(
f"{str(Path(self.install_target.local_path).absolute())}" + install_args
)
else:
install_cmd = self.install_target + install_args
install_target = f'"{self.install_target}"'
install_cmd = install_target + install_args

install_cmd = f"pip install {self._install_cmd_for_torch(install_cmd, cluster)}"
install_cmd = self._prepend_python_executable(
Expand Down
6 changes: 3 additions & 3 deletions tests/test_resources/test_data/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_from_string(self, pkg_str):
def test_pip_install_cmd(self, pip_package):
assert (
pip_package._pip_install_cmd()
== f"{sys.executable} -m pip install {pip_package.install_target}"
== f'{sys.executable} -m pip install "{pip_package.install_target}"'
)

@pytest.mark.level("unit")
Expand All @@ -97,15 +97,15 @@ def test_reqs_install_cmd(self, reqs_package):
def test_git_install_cmd(self, git_package):
assert (
git_package._pip_install_cmd()
== f"{sys.executable} -m pip install {git_package.install_target}"
== f'{sys.executable} -m pip install "{git_package.install_target}"'
)

# --------- test install on cluster ---------
@pytest.mark.level("local")
def test_pip_install(self, cluster, pip_package):
assert (
pip_package._pip_install_cmd(cluster=cluster)
== f"python3 -m pip install {pip_package.install_target}"
== f'python3 -m pip install "{pip_package.install_target}"'
)

# install through remote ssh
Expand Down

0 comments on commit 7ac6349

Please sign in to comment.