We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Include a git submodule update when doing pip install
**Is your feature request related to a problem? Please describe.**
Currently, the installation step requires a user to run `git submodule update --init --recursive` before doing `pip install`, which can lead to broken installation if the user forgets the step.

**Describe the solution you'd like**
Ensure the [git submodule line is working correctly in the setup.py file](https://github.com/CBICA/GaNDLF/blob/f4d0f02848c894d43259c2bb0b70612db612eb53/setup.py#L95).

**Describe alternatives you've considered**
N.A.

**Additional context**
N.A.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 #!/usr/bin/env python
2 
3 """The setup script."""
4 
5 from setuptools import setup, find_packages
6 
7 with open("README.md") as readme_file:
8     readme = readme_file.read()
9 
10 # read version.py
11 import sys, re
12 
13 try:
14     filepath = "GANDLF/version.py"
15     version_file = open(filepath)
16     (__version__,) = re.findall('__version__ = "(.*)"', version_file.read())
17 
18 except Exception as error:
19     __version__ = "0.0.1"
20     sys.stderr.write("Warning: Could not open '%s' due %s\n" % (filepath, error))
21 
22 requirements = [
23     "black",
24     "numpy==1.21.0",
25     "scipy",
26     "SimpleITK==2.1.0",
27     "torch>=1.7",
28     "torchvision",
29     "tqdm",
30     "torchio==0.18.57",
31     "pandas",
32     "pylint",
33     "scikit-learn==0.23.1",
34     "pickle5==0.0.11",
35     "setuptools",
36     "seaborn",
37     "pyyaml",
38     "openslide-python",
39     "scikit-image",
40     "matplotlib",
41     "requests>=2.25.0",
42     "pyvips",
43     "pytest",
44     "coverage",
45     "psutil",
46     "medcam",
47     "opencv-python",
48     "torchmetrics",
49     "OpenPatchMiner==0.1.6",
50     "pydicom",
51 ]
52 
53 setup(
54     name="GANDLF",
55     version=__version__,
56     author="Jose Agraz, Vinayak Ahluwalia, Bhakti Baheti, Spyridon Bakas, Ujjwal Baid, Megh Bhalerao, Brandon Edwards, Karol Gotkowski, Caleb Grenko, Orhun Güley, Sarthak Pati, Micah Sheller, Juliia Skobleva, Siddhesh Thakur, Spiros Thermos",  # alphabetical order
57     author_email="software@cbica.upenn.edu",
58     python_requires=">=3.6",
59     packages=find_packages(),
60     scripts=[
61         "gandlf_run",
62         "gandlf_constructCSV",
63         "gandlf_collectStats",
64         "gandlf_patchMiner",
65         "gandlf_preprocess",
66         "gandlf_anonymizer",
67     ],
68     classifiers=[
69         "Development Status :: 3 - Alpha",
70         "Intended Audience :: Science/Research",
71         "License :: OSI Approved :: BSD License",
72         "Natural Language :: English",
73         "Operating System :: OS Independent",
74         "Programming Language :: Python :: 3.6",
75         "Programming Language :: Python :: 3.7",
76         "Programming Language :: Python :: 3.8",
77         "Programming Language :: Python :: 3.9",
78         "Topic :: Scientific/Engineering :: Medical Science Apps",
79     ],
80     description=(
81         "PyTorch-based framework that handles segmentation/regression/classification using various DL architectures for medical imaging."
82     ),
83     install_requires=requirements,
84     license="BSD-3-Clause License",
85     long_description=readme,
86     long_description_content_type="text/markdown",
87     include_package_data=True,
88     keywords="semantic, segmentation, regression, classification, data-augmentation, medical-imaging",
89     zip_safe=False,
90 )
91 
92 import os
93 
94 ## submodule update
95 os.system("git submodule update --init --recursive")
96 
97 ## windows vips installation
98 if os.name == "nt":  # proceed for windows
99     from pathlib import Path
100 
101     # download and extract if main dll is absent
102     if not Path("./vips/vips-dev-8.10/bin/libvips-42.dll").exists():
103         print("Downloading and extracting VIPS for Windows")
104         url = "https://github.com/libvips/libvips/releases/download/v8.10.2/vips-dev-w64-all-8.10.2.zip"
105         zip_to_extract = "./vips.zip"
106         import urllib.request, zipfile
107 
108         urllib.request.urlretrieve(url, zip_to_extract)
109         z = zipfile.ZipFile(zip_to_extract)
110         z.extractall("./vips")
111         z.close()
112         os.remove(zip_to_extract)
113
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -2,11 +2,40 @@
 
 """The setup script."""
 
+
+import os
 from setuptools import setup, find_packages
+from setuptools.command.install import install
+from setuptools.command.develop import develop
+from setuptools.command.egg_info import egg_info
 
 with open("README.md") as readme_file:
     readme = readme_file.read()
 
+
+def git_submodule_update():
+    ## submodule update
+    os.system("git submodule update --init --recursive")
+
+
+class CustomInstallCommand(install):
+    def run(self):
+        install.run(self)
+        git_submodule_update()
+
+
+class CustomDevelopCommand(develop):
+    def run(self):
+        develop.run(self)
+        git_submodule_update()
+
+
+class CustomEggInfoCommand(egg_info):
+    def run(self):
+        egg_info.run(self)
+        git_submodule_update()
+
+
 # read version.py
 import sys, re
 
@@ -42,6 +71,7 @@
     "pyvips",
     "pytest",
     "coverage",
+    "pytest-cov",
     "psutil",
     "medcam",
     "opencv-python",
@@ -53,10 +83,15 @@
 setup(
     name="GANDLF",
     version=__version__,
-    author="Jose Agraz, Vinayak Ahluwalia, Bhakti Baheti, Spyridon Bakas, Ujjwal Baid, Megh Bhalerao, Brandon Edwards, Karol Gotkowski, Caleb Grenko, Orhun Güley, Sarthak Pati, Micah Sheller, Juliia Skobleva, Siddhesh Thakur, Spiros Thermos",  # alphabetical order
+    author="Jose Agraz, Vinayak Ahluwalia, Bhakti Baheti, Spyridon Bakas, Ujjwal Baid, Megh Bhalerao, Brandon Edwards, Karol Gotkowski, Caleb Grenko, Orhun Güley, Ibrahim Ethem Hamamci, Sarthak Pati, Micah Sheller, Juliia Skobleva, Siddhesh Thakur, Spiros Thermos",  # alphabetical order
     author_email="software@cbica.upenn.edu",
     python_requires=">=3.6",
     packages=find_packages(),
+    cmdclass={  # this ensures git_submodule_update is called during install
+        "install": CustomInstallCommand,
+        "develop": CustomDevelopCommand,
+        "egg_info": CustomEggInfoCommand,
+    },
     scripts=[
         "gandlf_run",
         "gandlf_constructCSV",
@@ -89,11 +124,6 @@
     zip_safe=False,
 )
 
-import os
-
-## submodule update
-os.system("git submodule update --init --recursive")
-
 ## windows vips installation
 if os.name == "nt":  # proceed for windows
     from pathlib import Path

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -2,11 +2,40 @@\n \n \"\"\"The setup script.\"\"\"\n \n+\n+import os\n from setuptools import setup, find_packages\n+from setuptools.command.install import install\n+from setuptools.command.develop import develop\n+from setuptools.command.egg_info import egg_info\n \n with open(\"README.md\") as readme_file:\n     readme = readme_file.read()\n \n+\n+def git_submodule_update():\n+    ## submodule update\n+    os.system(\"git submodule update --init --recursive\")\n+\n+\n+class CustomInstallCommand(install):\n+    def run(self):\n+        install.run(self)\n+        git_submodule_update()\n+\n+\n+class CustomDevelopCommand(develop):\n+    def run(self):\n+        develop.run(self)\n+        git_submodule_update()\n+\n+\n+class CustomEggInfoCommand(egg_info):\n+    def run(self):\n+        egg_info.run(self)\n+        git_submodule_update()\n+\n+\n # read version.py\n import sys, re\n \n@@ -42,6 +71,7 @@\n     \"pyvips\",\n     \"pytest\",\n     \"coverage\",\n+    \"pytest-cov\",\n     \"psutil\",\n     \"medcam\",\n     \"opencv-python\",\n@@ -53,10 +83,15 @@\n setup(\n     name=\"GANDLF\",\n     version=__version__,\n-    author=\"Jose Agraz, Vinayak Ahluwalia, Bhakti Baheti, Spyridon Bakas, Ujjwal Baid, Megh Bhalerao, Brandon Edwards, Karol Gotkowski, Caleb Grenko, Orhun G\u00fcley, Sarthak Pati, Micah Sheller, Juliia Skobleva, Siddhesh Thakur, Spiros Thermos\",  # alphabetical order\n+    author=\"Jose Agraz, Vinayak Ahluwalia, Bhakti Baheti, Spyridon Bakas, Ujjwal Baid, Megh Bhalerao, Brandon Edwards, Karol Gotkowski, Caleb Grenko, Orhun G\u00fcley, Ibrahim Ethem Hamamci, Sarthak Pati, Micah Sheller, Juliia Skobleva, Siddhesh Thakur, Spiros Thermos\",  # alphabetical order\n     author_email=\"software@cbica.upenn.edu\",\n     python_requires=\">=3.6\",\n     packages=find_packages(),\n+    cmdclass={  # this ensures git_submodule_update is called during install\n+        \"install\": CustomInstallCommand,\n+        \"develop\": CustomDevelopCommand,\n+        \"egg_info\": CustomEggInfoCommand,\n+    },\n     scripts=[\n         \"gandlf_run\",\n         \"gandlf_constructCSV\",\n@@ -89,11 +124,6 @@\n     zip_safe=False,\n )\n \n-import os\n-\n-## submodule update\n-os.system(\"git submodule update --init --recursive\")\n-\n ## windows vips installation\n if os.name == \"nt\":  # proceed for windows\n     from pathlib import Path\n", "issue": "Include a git submodule update when doing pip install\n**Is your feature request related to a problem? Please describe.**\r\nCurrently, the installation step requires a user to run `git submodule update --init --recursive` before doing `pip install`, which can lead to broken installation if the user forgets the step.\r\n\r\n**Describe the solution you'd like**\r\nEnsure the [git submodule line is working correctly in the setup.py file](https://github.com/CBICA/GaNDLF/blob/f4d0f02848c894d43259c2bb0b70612db612eb53/setup.py#L95).\r\n\r\n**Describe alternatives you've considered**\r\nN.A.\r\n\r\n**Additional context**\r\nN.A.\n", "before_files": [{"content": "#!/usr/bin/env python\n\n\"\"\"The setup script.\"\"\"\n\nfrom setuptools import setup, find_packages\n\nwith open(\"README.md\") as readme_file:\n    readme = readme_file.read()\n\n# read version.py\nimport sys, re\n\ntry:\n    filepath = \"GANDLF/version.py\"\n    version_file = open(filepath)\n    (__version__,) = re.findall('__version__ = \"(.*)\"', version_file.read())\n\nexcept Exception as error:\n    __version__ = \"0.0.1\"\n    sys.stderr.write(\"Warning: Could not open '%s' due %s\\n\" % (filepath, error))\n\nrequirements = [\n    \"black\",\n    \"numpy==1.21.0\",\n    \"scipy\",\n    \"SimpleITK==2.1.0\",\n    \"torch>=1.7\",\n    \"torchvision\",\n    \"tqdm\",\n    \"torchio==0.18.57\",\n    \"pandas\",\n    \"pylint\",\n    \"scikit-learn==0.23.1\",\n    \"pickle5==0.0.11\",\n    \"setuptools\",\n    \"seaborn\",\n    \"pyyaml\",\n    \"openslide-python\",\n    \"scikit-image\",\n    \"matplotlib\",\n    \"requests>=2.25.0\",\n    \"pyvips\",\n    \"pytest\",\n    \"coverage\",\n    \"psutil\",\n    \"medcam\",\n    \"opencv-python\",\n    \"torchmetrics\",\n    \"OpenPatchMiner==0.1.6\",\n    \"pydicom\",\n]\n\nsetup(\n    name=\"GANDLF\",\n    version=__version__,\n    author=\"Jose Agraz, Vinayak Ahluwalia, Bhakti Baheti, Spyridon Bakas, Ujjwal Baid, Megh Bhalerao, Brandon Edwards, Karol Gotkowski, Caleb Grenko, Orhun G\u00fcley, Sarthak Pati, Micah Sheller, Juliia Skobleva, Siddhesh Thakur, Spiros Thermos\",  # alphabetical order\n    author_email=\"software@cbica.upenn.edu\",\n    python_requires=\">=3.6\",\n    packages=find_packages(),\n    scripts=[\n        \"gandlf_run\",\n        \"gandlf_constructCSV\",\n        \"gandlf_collectStats\",\n        \"gandlf_patchMiner\",\n        \"gandlf_preprocess\",\n        \"gandlf_anonymizer\",\n    ],\n    classifiers=[\n        \"Development Status :: 3 - Alpha\",\n        \"Intended Audience :: Science/Research\",\n        \"License :: OSI Approved :: BSD License\",\n        \"Natural Language :: English\",\n        \"Operating System :: OS Independent\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"Topic :: Scientific/Engineering :: Medical Science Apps\",\n    ],\n    description=(\n        \"PyTorch-based framework that handles segmentation/regression/classification using various DL architectures for medical imaging.\"\n    ),\n    install_requires=requirements,\n    license=\"BSD-3-Clause License\",\n    long_description=readme,\n    long_description_content_type=\"text/markdown\",\n    include_package_data=True,\n    keywords=\"semantic, segmentation, regression, classification, data-augmentation, medical-imaging\",\n    zip_safe=False,\n)\n\nimport os\n\n## submodule update\nos.system(\"git submodule update --init --recursive\")\n\n## windows vips installation\nif os.name == \"nt\":  # proceed for windows\n    from pathlib import Path\n\n    # download and extract if main dll is absent\n    if not Path(\"./vips/vips-dev-8.10/bin/libvips-42.dll\").exists():\n        print(\"Downloading and extracting VIPS for Windows\")\n        url = \"https://github.com/libvips/libvips/releases/download/v8.10.2/vips-dev-w64-all-8.10.2.zip\"\n        zip_to_extract = \"./vips.zip\"\n        import urllib.request, zipfile\n\n        urllib.request.urlretrieve(url, zip_to_extract)\n        z = zipfile.ZipFile(zip_to_extract)\n        z.extractall(\"./vips\")\n        z.close()\n        os.remove(zip_to_extract)\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python\n\n\"\"\"The setup script.\"\"\"\n\n\nimport os\nfrom setuptools import setup, find_packages\nfrom setuptools.command.install import install\nfrom setuptools.command.develop import develop\nfrom setuptools.command.egg_info import egg_info\n\nwith open(\"README.md\") as readme_file:\n    readme = readme_file.read()\n\n\ndef git_submodule_update():\n    ## submodule update\n    os.system(\"git submodule update --init --recursive\")\n\n\nclass CustomInstallCommand(install):\n    def run(self):\n        install.run(self)\n        git_submodule_update()\n\n\nclass CustomDevelopCommand(develop):\n    def run(self):\n        develop.run(self)\n        git_submodule_update()\n\n\nclass CustomEggInfoCommand(egg_info):\n    def run(self):\n        egg_info.run(self)\n        git_submodule_update()\n\n\n# read version.py\nimport sys, re\n\ntry:\n    filepath = \"GANDLF/version.py\"\n    version_file = open(filepath)\n    (__version__,) = re.findall('__version__ = \"(.*)\"', version_file.read())\n\nexcept Exception as error:\n    __version__ = \"0.0.1\"\n    sys.stderr.write(\"Warning: Could not open '%s' due %s\\n\" % (filepath, error))\n\nrequirements = [\n    \"black\",\n    \"numpy==1.21.0\",\n    \"scipy\",\n    \"SimpleITK==2.1.0\",\n    \"torch>=1.7\",\n    \"torchvision\",\n    \"tqdm\",\n    \"torchio==0.18.57\",\n    \"pandas\",\n    \"pylint\",\n    \"scikit-learn==0.23.1\",\n    \"pickle5==0.0.11\",\n    \"setuptools\",\n    \"seaborn\",\n    \"pyyaml\",\n    \"openslide-python\",\n    \"scikit-image\",\n    \"matplotlib\",\n    \"requests>=2.25.0\",\n    \"pyvips\",\n    \"pytest\",\n    \"coverage\",\n    \"pytest-cov\",\n    \"psutil\",\n    \"medcam\",\n    \"opencv-python\",\n    \"torchmetrics\",\n    \"OpenPatchMiner==0.1.6\",\n    \"pydicom\",\n]\n\nsetup(\n    name=\"GANDLF\",\n    version=__version__,\n    author=\"Jose Agraz, Vinayak Ahluwalia, Bhakti Baheti, Spyridon Bakas, Ujjwal Baid, Megh Bhalerao, Brandon Edwards, Karol Gotkowski, Caleb Grenko, Orhun G\u00fcley, Ibrahim Ethem Hamamci, Sarthak Pati, Micah Sheller, Juliia Skobleva, Siddhesh Thakur, Spiros Thermos\",  # alphabetical order\n    author_email=\"software@cbica.upenn.edu\",\n    python_requires=\">=3.6\",\n    packages=find_packages(),\n    cmdclass={  # this ensures git_submodule_update is called during install\n        \"install\": CustomInstallCommand,\n        \"develop\": CustomDevelopCommand,\n        \"egg_info\": CustomEggInfoCommand,\n    },\n    scripts=[\n        \"gandlf_run\",\n        \"gandlf_constructCSV\",\n        \"gandlf_collectStats\",\n        \"gandlf_patchMiner\",\n        \"gandlf_preprocess\",\n        \"gandlf_anonymizer\",\n    ],\n    classifiers=[\n        \"Development Status :: 3 - Alpha\",\n        \"Intended Audience :: Science/Research\",\n        \"License :: OSI Approved :: BSD License\",\n        \"Natural Language :: English\",\n        \"Operating System :: OS Independent\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"Topic :: Scientific/Engineering :: Medical Science Apps\",\n    ],\n    description=(\n        \"PyTorch-based framework that handles segmentation/regression/classification using various DL architectures for medical imaging.\"\n    ),\n    install_requires=requirements,\n    license=\"BSD-3-Clause License\",\n    long_description=readme,\n    long_description_content_type=\"text/markdown\",\n    include_package_data=True,\n    keywords=\"semantic, segmentation, regression, classification, data-augmentation, medical-imaging\",\n    zip_safe=False,\n)\n\n## windows vips installation\nif os.name == \"nt\":  # proceed for windows\n    from pathlib import Path\n\n    # download and extract if main dll is absent\n    if not Path(\"./vips/vips-dev-8.10/bin/libvips-42.dll\").exists():\n        print(\"Downloading and extracting VIPS for Windows\")\n        url = \"https://github.com/libvips/libvips/releases/download/v8.10.2/vips-dev-w64-all-8.10.2.zip\"\n        zip_to_extract = \"./vips.zip\"\n        import urllib.request, zipfile\n\n        urllib.request.urlretrieve(url, zip_to_extract)\n        z = zipfile.ZipFile(zip_to_extract)\n        z.extractall(\"./vips\")\n        z.close()\n        os.remove(zip_to_extract)\n", "path": "setup.py"}]}