Repository: modin-project/modin

Issue:
TypeError while creating cluster
### System information
- **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**: `Windows 10`
- **Modin version** (`modin.__version__`): e2f628ca7b4361291fac23e994a2f3ff4d070160
- **Python version**:
- **Code we can use to reproduce**:

```python
from modin.experimental.cloud import create_cluster
test_cluster = create_cluster(
    "aws",
    "aws_credentials.yaml",
    cluster_name="modin-cluster",
)
```

<!--
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. -->

```sh
Traceback (most recent call last):
  File "test_cloud.py", line 5, in <module>
    cluster_name="modin-cluster",
  File ".../modin/experimental/cloud/cluster.py", line 304, in create
    add_conda_packages=add_conda_packages,
  File ".../modin/experimental/cloud/rayscale.py", line 84, in __init__
    self.config = self.__make_config()
  File ".../modin/experimental/cloud/rayscale.py", line 140, in __make_config
    res = self._update_conda_requirements(config["setup_commands"][0])
  File ".../modin/experimental/cloud/rayscale.py", line 168, in _update_conda_requirements
    "{{CONDA_PACKAGES}}", " ".join(self._conda_requirements())
  File ".../modin/experimental/cloud/rayscale.py", line 152, in _conda_requirements
    if not any(re.match(r"modin(\W|$)", p) for p in self.add_conda_packages):
TypeError: 'NoneType' object is not iterable
```



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
@@ -149,12 +149,12 @@ def _conda_requirements(self):
 
         reqs.extend(self._get_python_version())
 
-        if not any(re.match(r"modin(\W|$)", p) for p in self.add_conda_packages):
-            # user didn't define modin release;
-            # use automatically detected modin release from local context
-            reqs.append(self._get_modin_version())
-
         if self.add_conda_packages:
+            if not any(re.match(r"modin(\W|$)", p) for p in self.add_conda_packages):
+                # user didn't define modin release;
+                # use automatically detected modin release from local context
+                reqs.append(self._get_modin_version())
+
             reqs.extend(self.add_conda_packages)
 
         # this is needed, for example, for dependencies that


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
@@ -57,14 +57,14 @@ def make_create_or_update_cluster_mock():
 
 @pytest.fixture
 def make_ray_cluster(make_bootstrap_config_mock):
-    def ray_cluster():
+    def ray_cluster(conda_packages=None):
         with mock.patch(
             "modin.experimental.cloud.rayscale._bootstrap_config",
             make_bootstrap_config_mock,
         ):
             ray_cluster = RayCluster(
                 Provider(name="aws"),
-                add_conda_packages=["scikit-learn>=0.23", "modin==0.8.0"],
+                add_conda_packages=conda_packages,
             )
         return ray_cluster
 
@@ -115,9 +115,9 @@ def test_create_or_update_cluster(make_ray_cluster, make_create_or_update_cluste
 def test_update_conda_requirements(setup_commands_source, make_ray_cluster):
     fake_version = namedtuple("FakeVersion", "major minor micro")(7, 12, 45)
     with mock.patch("sys.version_info", fake_version):
-        setup_commands_result = make_ray_cluster()._update_conda_requirements(
-            setup_commands_source
-        )
+        setup_commands_result = make_ray_cluster(
+            ["scikit-learn>=0.23", "modin==0.8.0"]
+        )._update_conda_requirements(setup_commands_source)
 
     assert f"python>={fake_version.major}.{fake_version.minor}" in setup_commands_result
     assert (