We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
when pip version older than newest version, it calls API on every command rather than caching the information
When I use an older pip version, I see multiple lines of output like this when I run `lightly-magic`
```
...Python/3.8/lib/python/site-packages/lightly/api/version_checking.py:57: Warning: You are using lightly version 1.1.17. There is a newer version of the package available. For compatability reasons, please upgrade your current version: pip install lightly==1.1.18
  warnings.warn(Warning(warning))
```

Also tracking the connections it makes, it calls the API for **every** images I want to upload. So the pip does not cache the information that it is an outdated version. This is no bueno
  
  

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `lightly/__init__.py`
Content:
```
1 """Lightly is a computer vision framework for self-supervised learning.
2 
3 With Lightly you can train deep learning models using
4 self-supervision. This means, that you don't require
5 any labels to train a model. Lightly has been built
6 to help you understand and work with large unlabeled datasets.
7 It is built on top of PyTorch and therefore fully compatible 
8 with other frameworks such as Fast.ai.
9 
10 The framework is structured into the following modules:
11 
12 - **api**: 
13 
14   The lightly.api module handles communication with the Lightly web-app.
15 
16 - **cli**:
17 
18   The lightly.cli module provides a command-line interface for training 
19   self-supervised models and embedding images. Furthermore, the command-line
20   tool can be used to upload and download images from/to the Lightly web-app.
21 
22 - **core**:
23 
24   The lightly.core module offers one-liners for simple self-supervised learning.
25 
26 - **data**:
27 
28   The lightly.data module provides a dataset wrapper and collate functions. The
29   collate functions are in charge of the data augmentations which are crucial for
30   self-supervised learning.
31 
32 - **embedding**:
33 
34   The lightly.embedding module combines the self-supervised models with a dataloader,
35   optimizer, and loss function to provide a simple pytorch-lightning trainable.
36 
37 - **loss**:
38 
39   The lightly.loss module contains implementations of popular self-supervised training
40   loss functions.
41 
42 - **models**:
43 
44   The lightly.models module holds the implementation of the ResNet as well as self-
45   supervised methods. Currently implements:
46 
47   - SimCLR
48 
49   - MoCo
50 
51   - SimSiam
52 
53   - Barlow Twins
54 
55   - BYOL
56 
57   - NNCLR
58 
59 - **transforms**:
60 
61   The lightly.transforms module implements custom data transforms. Currently implements:
62 
63   - Gaussian Blur
64 
65   - Random Rotation
66 
67   - Random Solarization
68 
69 - **utils**:
70 
71   The lightly.utils package provides global utility methods.
72   The io module contains utility to save and load embeddings in a format which is
73   understood by the Lightly library.
74 
75 """
76 
77 # Copyright (c) 2020. Lightly AG and its affiliates.
78 # All Rights Reserved
79 
80 __name__ = 'lightly'
81 __version__ = '1.1.18'
82 
83 
84 try:
85     # See (https://github.com/PyTorchLightning/pytorch-lightning)
86     # This variable is injected in the __builtins__ by the build
87     # process. It used to enable importing subpackages of skimage when
88     # the binaries are not built
89     __LIGHTLY_SETUP__
90 except NameError:
91     __LIGHTLY_SETUP__ = False
92 
93 
94 if __LIGHTLY_SETUP__:
95     # setting up lightly
96     msg = f'Partial import of {__name__}=={__version__} during build process.' 
97     print(msg)
98 else:
99     # see if prefetch_generator is available
100     try:
101         import prefetch_generator
102     except ImportError:
103         _prefetch_generator_available = False
104     else:
105         _prefetch_generator_available = True
106 
107     def _is_prefetch_generator_available():
108         return _prefetch_generator_available
109 
110     from lightly.core import *
111     from lightly import active_learning
112     from lightly import api
113     from lightly import data
114     from lightly import embedding
115     from lightly import loss
116     from lightly import models
117     from lightly import openapi_generated
118     from lightly import transforms
119     from lightly import utils
120 
121 
122     # check for latest version
123     from lightly.api.version_checking import get_latest_version
124     from lightly.api.version_checking import version_compare
125     from lightly.api.version_checking import pretty_print_latest_version
126 
127     latest_version = get_latest_version(__version__)
128     if latest_version is not None:
129         if version_compare(__version__, latest_version) < 0:
130             # local version is behind latest version
131             pretty_print_latest_version(latest_version)
132
```
--- 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/lightly/__init__.py b/lightly/__init__.py
--- a/lightly/__init__.py
+++ b/lightly/__init__.py
@@ -80,6 +80,7 @@
 __name__ = 'lightly'
 __version__ = '1.1.18'
 
+from multiprocessing import current_process
 
 try:
     # See (https://github.com/PyTorchLightning/pytorch-lightning)
@@ -118,14 +119,15 @@
     from lightly import transforms
     from lightly import utils
 
+    if current_process().name == 'MainProcess':
+        # check for latest version
+        from lightly.api.version_checking import get_latest_version
+        from lightly.api.version_checking import version_compare
+        from lightly.api.version_checking import pretty_print_latest_version
 
-    # check for latest version
-    from lightly.api.version_checking import get_latest_version
-    from lightly.api.version_checking import version_compare
-    from lightly.api.version_checking import pretty_print_latest_version
+        latest_version = get_latest_version(__version__)
+        if latest_version is not None:
+            if version_compare(__version__, latest_version) < 0:
+                # local version is behind latest version
+                pretty_print_latest_version(latest_version)
 
-    latest_version = get_latest_version(__version__)
-    if latest_version is not None:
-        if version_compare(__version__, latest_version) < 0:
-            # local version is behind latest version
-            pretty_print_latest_version(latest_version)

{"golden_diff": "diff --git a/lightly/__init__.py b/lightly/__init__.py\n--- a/lightly/__init__.py\n+++ b/lightly/__init__.py\n@@ -80,6 +80,7 @@\n __name__ = 'lightly'\n __version__ = '1.1.18'\n \n+from multiprocessing import current_process\n \n try:\n     # See (https://github.com/PyTorchLightning/pytorch-lightning)\n@@ -118,14 +119,15 @@\n     from lightly import transforms\n     from lightly import utils\n \n+    if current_process().name == 'MainProcess':\n+        # check for latest version\n+        from lightly.api.version_checking import get_latest_version\n+        from lightly.api.version_checking import version_compare\n+        from lightly.api.version_checking import pretty_print_latest_version\n \n-    # check for latest version\n-    from lightly.api.version_checking import get_latest_version\n-    from lightly.api.version_checking import version_compare\n-    from lightly.api.version_checking import pretty_print_latest_version\n+        latest_version = get_latest_version(__version__)\n+        if latest_version is not None:\n+            if version_compare(__version__, latest_version) < 0:\n+                # local version is behind latest version\n+                pretty_print_latest_version(latest_version)\n \n-    latest_version = get_latest_version(__version__)\n-    if latest_version is not None:\n-        if version_compare(__version__, latest_version) < 0:\n-            # local version is behind latest version\n-            pretty_print_latest_version(latest_version)\n", "issue": "when pip version older than newest version, it calls API on every command rather than caching the information\nWhen I use an older pip version, I see multiple lines of output like this when I run `lightly-magic`\r\n```\r\n...Python/3.8/lib/python/site-packages/lightly/api/version_checking.py:57: Warning: You are using lightly version 1.1.17. There is a newer version of the package available. For compatability reasons, please upgrade your current version: pip install lightly==1.1.18\r\n  warnings.warn(Warning(warning))\r\n```\r\n\r\nAlso tracking the connections it makes, it calls the API for **every** images I want to upload. So the pip does not cache the information that it is an outdated version. This is no bueno\r\n  \r\n  \n", "before_files": [{"content": "\"\"\"Lightly is a computer vision framework for self-supervised learning.\n\nWith Lightly you can train deep learning models using\nself-supervision. This means, that you don't require\nany labels to train a model. Lightly has been built\nto help you understand and work with large unlabeled datasets.\nIt is built on top of PyTorch and therefore fully compatible \nwith other frameworks such as Fast.ai.\n\nThe framework is structured into the following modules:\n\n- **api**: \n\n  The lightly.api module handles communication with the Lightly web-app.\n\n- **cli**:\n\n  The lightly.cli module provides a command-line interface for training \n  self-supervised models and embedding images. Furthermore, the command-line\n  tool can be used to upload and download images from/to the Lightly web-app.\n\n- **core**:\n\n  The lightly.core module offers one-liners for simple self-supervised learning.\n\n- **data**:\n\n  The lightly.data module provides a dataset wrapper and collate functions. The\n  collate functions are in charge of the data augmentations which are crucial for\n  self-supervised learning.\n\n- **embedding**:\n\n  The lightly.embedding module combines the self-supervised models with a dataloader,\n  optimizer, and loss function to provide a simple pytorch-lightning trainable.\n\n- **loss**:\n\n  The lightly.loss module contains implementations of popular self-supervised training\n  loss functions.\n\n- **models**:\n\n  The lightly.models module holds the implementation of the ResNet as well as self-\n  supervised methods. Currently implements:\n\n  - SimCLR\n\n  - MoCo\n\n  - SimSiam\n\n  - Barlow Twins\n\n  - BYOL\n\n  - NNCLR\n\n- **transforms**:\n\n  The lightly.transforms module implements custom data transforms. Currently implements:\n\n  - Gaussian Blur\n\n  - Random Rotation\n\n  - Random Solarization\n\n- **utils**:\n\n  The lightly.utils package provides global utility methods.\n  The io module contains utility to save and load embeddings in a format which is\n  understood by the Lightly library.\n\n\"\"\"\n\n# Copyright (c) 2020. Lightly AG and its affiliates.\n# All Rights Reserved\n\n__name__ = 'lightly'\n__version__ = '1.1.18'\n\n\ntry:\n    # See (https://github.com/PyTorchLightning/pytorch-lightning)\n    # This variable is injected in the __builtins__ by the build\n    # process. It used to enable importing subpackages of skimage when\n    # the binaries are not built\n    __LIGHTLY_SETUP__\nexcept NameError:\n    __LIGHTLY_SETUP__ = False\n\n\nif __LIGHTLY_SETUP__:\n    # setting up lightly\n    msg = f'Partial import of {__name__}=={__version__} during build process.' \n    print(msg)\nelse:\n    # see if prefetch_generator is available\n    try:\n        import prefetch_generator\n    except ImportError:\n        _prefetch_generator_available = False\n    else:\n        _prefetch_generator_available = True\n\n    def _is_prefetch_generator_available():\n        return _prefetch_generator_available\n\n    from lightly.core import *\n    from lightly import active_learning\n    from lightly import api\n    from lightly import data\n    from lightly import embedding\n    from lightly import loss\n    from lightly import models\n    from lightly import openapi_generated\n    from lightly import transforms\n    from lightly import utils\n\n\n    # check for latest version\n    from lightly.api.version_checking import get_latest_version\n    from lightly.api.version_checking import version_compare\n    from lightly.api.version_checking import pretty_print_latest_version\n\n    latest_version = get_latest_version(__version__)\n    if latest_version is not None:\n        if version_compare(__version__, latest_version) < 0:\n            # local version is behind latest version\n            pretty_print_latest_version(latest_version)\n", "path": "lightly/__init__.py"}], "after_files": [{"content": "\"\"\"Lightly is a computer vision framework for self-supervised learning.\n\nWith Lightly you can train deep learning models using\nself-supervision. This means, that you don't require\nany labels to train a model. Lightly has been built\nto help you understand and work with large unlabeled datasets.\nIt is built on top of PyTorch and therefore fully compatible \nwith other frameworks such as Fast.ai.\n\nThe framework is structured into the following modules:\n\n- **api**: \n\n  The lightly.api module handles communication with the Lightly web-app.\n\n- **cli**:\n\n  The lightly.cli module provides a command-line interface for training \n  self-supervised models and embedding images. Furthermore, the command-line\n  tool can be used to upload and download images from/to the Lightly web-app.\n\n- **core**:\n\n  The lightly.core module offers one-liners for simple self-supervised learning.\n\n- **data**:\n\n  The lightly.data module provides a dataset wrapper and collate functions. The\n  collate functions are in charge of the data augmentations which are crucial for\n  self-supervised learning.\n\n- **embedding**:\n\n  The lightly.embedding module combines the self-supervised models with a dataloader,\n  optimizer, and loss function to provide a simple pytorch-lightning trainable.\n\n- **loss**:\n\n  The lightly.loss module contains implementations of popular self-supervised training\n  loss functions.\n\n- **models**:\n\n  The lightly.models module holds the implementation of the ResNet as well as self-\n  supervised methods. Currently implements:\n\n  - SimCLR\n\n  - MoCo\n\n  - SimSiam\n\n  - Barlow Twins\n\n  - BYOL\n\n  - NNCLR\n\n- **transforms**:\n\n  The lightly.transforms module implements custom data transforms. Currently implements:\n\n  - Gaussian Blur\n\n  - Random Rotation\n\n  - Random Solarization\n\n- **utils**:\n\n  The lightly.utils package provides global utility methods.\n  The io module contains utility to save and load embeddings in a format which is\n  understood by the Lightly library.\n\n\"\"\"\n\n# Copyright (c) 2020. Lightly AG and its affiliates.\n# All Rights Reserved\n\n__name__ = 'lightly'\n__version__ = '1.1.18'\n\nfrom multiprocessing import current_process\n\ntry:\n    # See (https://github.com/PyTorchLightning/pytorch-lightning)\n    # This variable is injected in the __builtins__ by the build\n    # process. It used to enable importing subpackages of skimage when\n    # the binaries are not built\n    __LIGHTLY_SETUP__\nexcept NameError:\n    __LIGHTLY_SETUP__ = False\n\n\nif __LIGHTLY_SETUP__:\n    # setting up lightly\n    msg = f'Partial import of {__name__}=={__version__} during build process.' \n    print(msg)\nelse:\n    # see if prefetch_generator is available\n    try:\n        import prefetch_generator\n    except ImportError:\n        _prefetch_generator_available = False\n    else:\n        _prefetch_generator_available = True\n\n    def _is_prefetch_generator_available():\n        return _prefetch_generator_available\n\n    from lightly.core import *\n    from lightly import active_learning\n    from lightly import api\n    from lightly import data\n    from lightly import embedding\n    from lightly import loss\n    from lightly import models\n    from lightly import openapi_generated\n    from lightly import transforms\n    from lightly import utils\n\n    if current_process().name == 'MainProcess':\n        # check for latest version\n        from lightly.api.version_checking import get_latest_version\n        from lightly.api.version_checking import version_compare\n        from lightly.api.version_checking import pretty_print_latest_version\n\n        latest_version = get_latest_version(__version__)\n        if latest_version is not None:\n            if version_compare(__version__, latest_version) < 0:\n                # local version is behind latest version\n                pretty_print_latest_version(latest_version)\n\n", "path": "lightly/__init__.py"}]}