Repository: deepchem/deepchem

Issue:
Clarification for installation issues
I was working with a new source install for deepchem following the new lightweight guide and tried

```
pip install -e .[jax]
```
And got the following error
```
zsh: no matches found: [jax]
```
I googled this and found https://stackoverflow.com/questions/30539798/zsh-no-matches-found-requestssecurity. The basic issue is we need to do something like
```
noglob pip install -e .[jax]
```
We should modify the install directions to clarify.

Comments:

Patch:
diff --git a/README.md b/README.md
index fec472dbe..54d1c06d7 100644
--- a/README.md
+++ b/README.md
@@ -109,6 +109,10 @@ If GPU support is required, then make sure CUDA is installed and then install th
 2. pytorch - https://pytorch.org/get-started/locally/#start-locally
 3. jax - https://github.com/google/jax#pip-installation-gpu-cuda
 
+In `zsh` square brackets are used for globbing/pattern matching. This means you
+need to escape the square brackets in the above installation. You can do so
+by including the dependencies in quotes like `pip install --pre 'deepchem[jax]'`
+
 ### Docker
 
 If you want to install deepchem using a docker, you can pull two kinds of images.  
diff --git a/deepchem/data/datasets.py b/deepchem/data/datasets.py
index 1abdde3e7..27427927a 100644
--- a/deepchem/data/datasets.py
+++ b/deepchem/data/datasets.py
@@ -1500,10 +1500,10 @@ class DiskDataset(Dataset):
     """Gets size of shards on disk."""
     if not len(self.metadata_df):
       raise ValueError("No data in dataset.")
-    sample_y = load_from_disk(
+    sample_ids = load_from_disk(
         os.path.join(self.data_dir,
-                     next(self.metadata_df.iterrows())[1]['y']))
-    return len(sample_y)
+                     next(self.metadata_df.iterrows())[1]['ids']))
+    return len(sample_ids)
 
   def _get_metadata_filename(self) -> Tuple[str, str]:
     """Get standard location for metadata file."""
@@ -2369,11 +2369,11 @@ class DiskDataset(Dataset):
           if y is not None:
             y_sel = y[shard_inds]
           else:
-            y_sel = None
+            y_sel = np.array([])
           if w is not None:
             w_sel = w[shard_inds]
           else:
-            w_sel = None
+            w_sel = np.array([])
           ids_sel = ids[shard_inds]
           Xs.append(X_sel)
           ys.append(y_sel)
@@ -2399,9 +2399,16 @@ class DiskDataset(Dataset):
                 np.where(sorted_indices == orig_index)[0][0]
                 for orig_index in select_shard_indices
             ])
-        X, y, w, ids = X[reverted_indices], y[reverted_indices], w[
-            reverted_indices], ids[reverted_indices]
-        yield (X, y, w, ids)
+        if y.size == 0:
+          tup_y = y
+        else:
+          tup_y = y[reverted_indices]
+        if w.size == 0:
+          tup_w = w
+        else:
+          tup_w = w[reverted_indices]
+        X, ids = X[reverted_indices], ids[reverted_indices]
+        yield (X, tup_y, tup_w, ids)
         start = end
         select_shard_num += 1
 
diff --git a/docs/source/get_started/installation.rst b/docs/source/get_started/installation.rst
index 198d1020c..1c9a0cd68 100644
--- a/docs/source/get_started/installation.rst
+++ b/docs/source/get_started/installation.rst
@@ -66,6 +66,9 @@ If GPU support is required, then make sure CUDA is installed and then install th
 2. pytorch - https://pytorch.org/get-started/locally/#start-locally
 3. jax - https://github.com/google/jax#pip-installation-gpu-cuda
 
+In :code:`zsh` square brackets are used for globbing/pattern matching. This means
+you need to escape the square brackets in the above installation. You can do so by
+including the dependencies in quotes like :code:`pip install --pre 'deepchem[jax]'`
 
 Google Colab
 ------------


Test patch:
diff --git a/deepchem/data/tests/reaction_smiles.csv b/deepchem/data/tests/reaction_smiles.csv
new file mode 100644
index 000000000..ce90ba563
--- /dev/null
+++ b/deepchem/data/tests/reaction_smiles.csv
@@ -0,0 +1,5 @@
+reactions
+CCS(=O)(=O)Cl.OCCBr>CCN(CC)CC.CCOCC>CCS(=O)(=O)OCCBr
+CC(C)CS(=O)(=O)Cl.OCCCl>CCN(CC)CC.CCOCC>CC(C)CS(=O)(=O)OCCCl
+O=[N+]([O-])c1cccc2cnc(Cl)cc12>CC(=O)O.O.[Fe].[Na+].[OH-]>Nc1cccc2cnc(Cl)cc12
+Cc1cc2c([N+](=O)[O-])cccc2c[n+]1[O-].O=P(Cl)(Cl)Cl>>Cc1cc2c([N+](=O)[O-])cccc2c(Cl)n1
\ No newline at end of file
diff --git a/deepchem/data/tests/test_shape.py b/deepchem/data/tests/test_shape.py
index 346c7da31..aca120dbe 100644
--- a/deepchem/data/tests/test_shape.py
+++ b/deepchem/data/tests/test_shape.py
@@ -106,3 +106,29 @@ def test_disk_dataset_get_legacy_shape_multishard():
   assert y_shape == (num_datapoints, num_tasks)
   assert w_shape == (num_datapoints, num_tasks)
   assert ids_shape == (num_datapoints,)
+
+
+def test_get_shard_size():
+  """
+  Test that using ids for getting the shard size does not break the method.
+  The issue arises when attempting to load a dataset that does not have a labels
+  column. The create_dataset method of the DataLoader class sets the y to None
+  in this case, which causes the existing implementation of the get_shard_size()
+  method to fail, as it relies on the dataset having a not None y column. This
+  consequently breaks all methods depending on this, like the splitters for
+  example.
+
+  Note
+  ----
+  DiskDatasets without labels cannot be resharded!
+  """
+
+  current_dir = os.path.dirname(os.path.abspath(__file__))
+  file_path = os.path.join(current_dir, "reaction_smiles.csv")
+
+  featurizer = dc.feat.DummyFeaturizer()
+  loader = dc.data.CSVLoader(
+      tasks=[], feature_field="reactions", featurizer=featurizer)
+
+  dataset = loader.create_dataset(file_path)
+  assert dataset.get_shard_size() == 4