Skip to content

Commit af26174

Browse files
rohangujarathiRohan Gujarathi
andauthored
fix: remote_function python version mismatch issue (#3836)
Co-authored-by: Rohan Gujarathi <[email protected]>
1 parent 2b83dd0 commit af26174

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/sagemaker/remote_function/runtime_environment/runtime_environment_manager.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def _python_version_in_conda_env(self, env_name):
254254
def _current_python_version(self):
255255
"""Returns the current python version where program is running"""
256256

257-
return f"{sys.version_info.major}.{sys.version_info.minor}"
257+
return f"{sys.version_info.major}.{sys.version_info.minor}".strip()
258258

259259
def _validate_python_version(self, client_python_version: str, conda_env: str = None):
260260
"""Validate the python version
@@ -266,10 +266,10 @@ def _validate_python_version(self, client_python_version: str, conda_env: str =
266266
job_python_version = self._python_version_in_conda_env(conda_env)
267267
else:
268268
job_python_version = self._current_python_version()
269-
if client_python_version != job_python_version:
269+
if client_python_version.strip() != job_python_version.strip():
270270
raise RuntimeEnvironmentError(
271-
f"Python version found in the container is {job_python_version} which "
272-
f"does not match python version {client_python_version} on the local client . "
271+
f"Python version found in the container is '{job_python_version}' which "
272+
f"does not match python version '{client_python_version}' on the local client. "
273273
f"Please make sure that the python version used in the training container "
274274
f"is same as the local python version."
275275
)

0 commit comments

Comments
 (0)