Repository: mlcommons/GaNDLF

Issue:
Pickle5 may cause setup errors on Python 3.8 (future-proofing)
**Describe the bug**
When  installing GaNDLF on Python 3.8, an error occurs when installing the dependency "pickle5".
Note that pickle5 is redundant in 3.8 -- the backported functionality is the default/standard [[ref](https://github.com/pitrou/pickle5-backport/issues/12)]. 

You can solve this by adding this annotation in setup.py so that pickle5 is only installed on Python versions 3.7 or lower (example of this syntax: https://stackoverflow.com/a/32643122).
If pickle5 is imported directly in your code, you may also need to do a version check at import time, something like this:
``` python
# Both these should come standard if you have setuptools anyway
import platform
from packaging import version
if version.parse(platform.python_version()) < version.parse("3.8.0"):
    import pickle5 as pickle
else:
   import pickle
```

**To Reproduce**
Steps to reproduce the behavior:
1. Create a Python 3.8 environment using your mechanism of choice.
2. Install GaNDLF per instructions.
3. Receive error message while installing pickle5.

**GaNDLF Version**
Latest master (0.0.14.dev0 I think)

**Desktop (please complete the following information):**
Occurs in any system with Python 3.8 or greater. At least for me on Ubuntu-based machines.

**Additional context**
This issue is just a heads up for supporting 3.8 and greater. Hope this helps.



Discussion:
Thanks for the report, @AlexanderGetka-cbica! 

I am a bit lost as to where this should go, so can you put in a PR? Perhaps we could include python 3.8 tests in our CI - what do you think, @Geeks-Sid?
Sure, I can work on this and put in a PR sometime in the next few days.
Stale issue message
Now that 0.0.14 has been tagged, we should prioritize this, since python 3.7 support has already been dropped from official python channels and we need to move to 3.8 for a most consistent build chain.

Thoughts @Geeks-Sid @AlexanderGetka-cbica? 
@sarthakpati @Geeks-Sid I can fix the setup.py easily for this, and since GaNDLF doesn't actually call pickle5 explicitly anywhere (at least, as far as a GitHub search reveals), the only thing that needs to change is the Dockerfiles for CI. Before I actually put in the PR, what is our policy for our Torch lib versions? Do we want LTS only, or are we cool with the latest stable?
If I remember correctly, the `pickle` usage is mostly centered in the [training](https://github.com/CBICA/GaNDLF/blob/master/GANDLF/training_manager.py) and [inference managers](https://github.com/CBICA/GaNDLF/blob/master/GANDLF/inference_manager.py).

Unless we have a specific requirement to move ahead of the Torch LTS release, I think let's stick to that, for now? For example, we know that at least 2 projects in the future will need `torch>=1.11`, but until we need to merge those codebases in, let's use LTS for as long as possible. 😄 
Ah, OK -- just one note: PyTorch LTS 1.8.2 supports CUDA 11.1, not CUDA 11.3. So, the CUDA11.3 Dockerfile will continue to use PyTorch 1.11.0.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -60,7 +60,7 @@ def run(self):
     "pylint",
     "scikit-learn>=0.23.2",
     "scikit-image>=0.19.1",
-    "pickle5>=0.0.11",
+    'pickle5>=0.0.11; python_version < "3.8.0"',
     "setuptools",
     "seaborn",
     "pyyaml",


Test patch: