Skip to content

Commit 91ed516

Browse files
authored
install requirements from relative path
this allows it to correctly find the path to install from whl files.
1 parent 7fcb805 commit 91ed516

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/sagemaker_inference/model_server.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,15 @@ def _terminate(signo, frame): # pylint: disable=unused-argument
180180

181181
def _install_requirements():
182182
logger.info("installing packages from requirements.txt...")
183-
pip_install_cmd = [sys.executable, "-m", "pip", "install", "-r", REQUIREMENTS_PATH]
183+
if sys.version_info >= (3, 5):
184+
pip_install_cmd = [sys.executable, "-m", "pip", "install", "-r", "requirements.txt"]
185+
kw = {"cwd": code_dir}
186+
else:
187+
pip_install_cmd = [sys.executable, "-m", "pip", "install", "-r", REQUIREMENTS_PATH]
188+
kw = {}
184189

185190
try:
186-
subprocess.check_call(pip_install_cmd)
191+
subprocess.check_call(pip_install_cmd, **kw)
187192
except subprocess.CalledProcessError:
188193
logger.error("failed to install required packages, exiting")
189194
raise ValueError("failed to install required packages")

0 commit comments

Comments
 (0)