Skip to content

Commit 435a44f

Browse files
committed
Update driver_utils.py to wrap pip package in pip install cmd.
1 parent 8f2286a commit 435a44f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ads/jobs/templates/driver_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,10 @@ def install_pip_packages(self, packages: str = None):
439439
packages = os.environ.get(CONST_ENV_PIP_PKG)
440440
if not packages:
441441
return self
442+
# The package requirement may contain special character like '>'.
443+
# Here we wrap each package requirement with single quote to make sure they can be installed correctly
444+
package_list = shlex.split(packages)
445+
packages = " ".join([f"'{package}'" for package in package_list])
442446
self.run_command(
443447
f"pip install {packages}", conda_prefix=self.conda_prefix, check=True
444448
)

0 commit comments

Comments
 (0)