Repository: modin-project/modin

Issue:
"conda install python==3.7.9 -c conda-forge" failed when the cluster is created
### System information
- **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**:
- **Modin version** (`modin.__version__`):
- **Python version**:
- **Code we can use to reproduce**:

<!--
You can obtain the Modin version with

python -c "import modin; print(modin.__version__)"
-->

### Describe the problem
<!-- Describe the problem clearly here. -->

### Source code / logs
<!-- Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Try to provide a reproducible test case that is the bare minimum necessary to generate the problem. -->



Discussion:

Resolving patch:
diff --git a/modin/experimental/cloud/rayscale.py b/modin/experimental/cloud/rayscale.py
--- a/modin/experimental/cloud/rayscale.py
+++ b/modin/experimental/cloud/rayscale.py
@@ -146,7 +146,7 @@ def _conda_requirements(self):
 
         reqs = []
 
-        reqs.append(f"python=={self._get_python_version()}")
+        reqs.extend(self._get_python_version())
 
         if self.add_conda_packages:
             reqs.extend(self.add_conda_packages)
@@ -167,7 +167,7 @@ def _get_python_version():
         major = sys.version_info.major
         minor = sys.version_info.minor
         micro = sys.version_info.micro
-        return f"{major}.{minor}.{micro}"
+        return [f"python>={major}.{minor}", f"python<={major}.{minor}.{micro}"]
 
     @staticmethod
     def __save_config(config):


Test patch:
diff --git a/modin/experimental/cloud/test/test_cloud.py b/modin/experimental/cloud/test/test_cloud.py
--- a/modin/experimental/cloud/test/test_cloud.py
+++ b/modin/experimental/cloud/test/test_cloud.py
@@ -11,9 +11,9 @@
 # ANY KIND, either express or implied. See the License for the specific language
 # governing permissions and limitations under the License.
 
-import sys
 import unittest.mock as mock
 import pytest
+from collections import namedtuple
 from modin.experimental.cloud.rayscale import RayCluster
 from modin.experimental.cloud.cluster import Provider
 
@@ -30,11 +30,6 @@
     ],
 )
 def test_update_conda_requirements(setup_commands_source):
-    major = sys.version_info.major
-    minor = sys.version_info.minor
-    micro = sys.version_info.micro
-    python_version = f"python=={major}.{minor}.{micro}"
-
     with mock.patch(
         "modin.experimental.cloud.rayscale._bootstrap_config", lambda config: config
     ):
@@ -42,10 +37,16 @@ def test_update_conda_requirements(setup_commands_source):
             Provider(name="aws"), add_conda_packages=["scikit-learn>=0.23"]
         )
 
-    setup_commands_result = ray_cluster._update_conda_requirements(
-        setup_commands_source
-    )
+    fake_version = namedtuple("FakeVersion", "major minor micro")(7, 12, 45)
+    with mock.patch("sys.version_info", fake_version):
+        setup_commands_result = ray_cluster._update_conda_requirements(
+            setup_commands_source
+        )
 
-    assert python_version in setup_commands_result
+    assert f"python>={fake_version.major}.{fake_version.minor}" in setup_commands_result
+    assert (
+        f"python<={fake_version.major}.{fake_version.minor}.{fake_version.micro}"
+        in setup_commands_result
+    )
     assert "scikit-learn>=0.23" in setup_commands_result
     assert "{{CONDA_PACKAGES}}" not in setup_commands_result