We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Check if the python version is at least 3.6 on server start.
On Server start check if Python version is < 3.8

if lower version, print message:

```
MindsDB server requires Python >= 3.8 to run

Once you have Python 3.8 installed you can tun mindsdb as follows:

1. create and activate venv:
    python3.8 -m venv venv
    source venv/bin/activate
2. install MindsDB:
    pip3 install mindsdb
3. Run MindsDB
    python3.8 -m mindsdb

More instructions in https://docs.mindsdb.com

```

and exit

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mindsdb/__main__.py`
Content:
```
1 import atexit
2 import traceback
3 import sys
4 import os
5 import time
6 
7 from pkg_resources import get_distribution
8 import torch.multiprocessing as mp
9 
10 from mindsdb.utilities.config import Config
11 from mindsdb.interfaces.native.mindsdb import MindsdbNative
12 from mindsdb.interfaces.custom.custom_models import CustomModels
13 from mindsdb.api.http.start import start as start_http
14 from mindsdb.api.mysql.start import start as start_mysql
15 from mindsdb.api.mongo.start import start as start_mongo
16 from mindsdb.utilities.fs import get_or_create_dir_struct, update_versions_file
17 from mindsdb.utilities.ps import is_port_in_use
18 from mindsdb.interfaces.database.database import DatabaseWrapper
19 from mindsdb.utilities.functions import args_parse
20 
21 
22 def close_api_gracefully(p_arr):
23     for p in p_arr:
24         sys.stdout.flush()
25         p.terminate()
26         p.join()
27         sys.stdout.flush()
28 
29 
30 if __name__ == '__main__':
31     mp.freeze_support()
32 
33     args = args_parse()
34 
35     config_path = args.config
36     if config_path is None:
37         config_dir, _ = get_or_create_dir_struct()
38         config_path = os.path.join(config_dir, 'config.json')
39 
40     config = Config(config_path)
41 
42     from mindsdb.__about__ import __version__ as mindsdb_version
43 
44     if args.version:
45         print(f'MindsDB {mindsdb_version}')
46         sys.exit(0)
47 
48     try:
49         lightwood_version = get_distribution('lightwood').version
50     except Exception:
51         from lightwood.__about__ import __version__ as lightwood_version
52 
53     try:
54         mindsdb_native_version = get_distribution('mindsdb_native').version
55     except Exception:
56         from mindsdb_native.__about__ import __version__ as mindsdb_native_version
57 
58     if args.verbose:
59         config['log']['level']['console'] = 'INFO'
60 
61     print(f'Configuration file:\n   {config_path}')
62     print(f"Storage path:\n   {config.paths['root']}")
63 
64     print('Versions:')
65     print(f' - lightwood {lightwood_version}')
66     print(f' - MindsDB_native {mindsdb_native_version}')
67     print(f' - MindsDB {mindsdb_version}')
68 
69     os.environ['MINDSDB_STORAGE_PATH'] = config.paths['predictors']
70     if args.verbose is True:
71         os.environ['DEFAULT_LOG_LEVEL'] = 'INFO'
72         os.environ['LIGHTWOOD_LOG_LEVEL'] = 'INFO'
73     else:
74         os.environ['DEFAULT_LOG_LEVEL'] = 'ERROR'
75         os.environ['LIGHTWOOD_LOG_LEVEL'] = 'ERROR'
76 
77     update_versions_file(
78         config,
79         {
80             'lightwood': lightwood_version,
81             'mindsdb_native': mindsdb_native_version,
82             'mindsdb': mindsdb_version,
83             'python': sys.version.replace('\n', '')
84         }
85     )
86 
87     if args.api is None:
88         api_arr = ['http', 'mysql']
89     else:
90         api_arr = args.api.split(',')
91 
92     api_arr = [{
93         'name': api,
94         'port': config['api'][api]['port'],
95         'started': False
96     } for api in api_arr]
97 
98     for api in api_arr:
99         api_name = api['name']
100         if api_name not in config['api']:
101             print(f"Trying run '{api_name}' API, but is no config for this api.")
102             print(f"Please, fill config['api']['{api_name}']")
103             sys.exit(0)
104 
105     start_functions = {
106         'http': start_http,
107         'mysql': start_mysql,
108         'mongodb': start_mongo
109     }
110 
111     mdb = MindsdbNative(config)
112     cst = CustomModels(config)
113     # @TODO Maybe just use `get_model_data` directly here ? Seems like a useless abstraction
114     model_data_arr = [
115         {
116             'name': x['name'],
117             'predict': x['predict'],
118             'data_analysis': mdb.get_model_data(x['name'])['data_analysis_v2']
119         } for x in mdb.get_models()
120     ]
121 
122     for m in model_data_arr:
123         if 'columns_to_ignore' in m['data_analysis']:
124             del m['data_analysis']['columns_to_ignore']
125         if 'train_std_dev' in m['data_analysis']:
126             del m['data_analysis']['train_std_dev']
127 
128     model_data_arr.extend(cst.get_models())
129 
130     dbw = DatabaseWrapper(config)
131     dbw.register_predictors(model_data_arr)
132 
133     for broken_name in [name for name, connected in dbw.check_connections().items() if connected is False]:
134         print(f'Error failed to integrate with database aliased: {broken_name}')
135 
136     p_arr = []
137     ctx = mp.get_context('spawn')
138 
139     for api in api_arr:
140         api_name = api['name']
141         print(f'{api_name} API: starting...')
142         try:
143             p = ctx.Process(target=start_functions[api_name], args=(config_path, args.verbose))
144             p.start()
145             p_arr.append(p)
146         except Exception as e:
147             close_api_gracefully(p_arr)
148             print(f'Failed to start {api_name} API with exception {e}')
149             print(traceback.format_exc())
150             raise
151 
152     atexit.register(close_api_gracefully, p_arr=p_arr)
153 
154     timeout = 15
155     start_time = time.time()
156     all_started = False
157     while (time.time() - start_time) < timeout and all_started is False:
158         all_started = True
159         for i, api in enumerate(api_arr):
160             try:
161                 in_use = api['started'] or is_port_in_use(api['port'])
162             except Exception:
163                 # NOTE that hotfix for OSX: is_port_in_use will raise AccessDenied error if it runned not as sudo
164                 in_use = True
165             if in_use and api['started'] != in_use:
166                 api['started'] = in_use
167                 print(f"{api['name']} API: started on {api['port']}")
168             all_started = all_started and in_use
169         time.sleep(0.5)
170 
171     for p in p_arr:
172         p.join()
173
```
--- 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/mindsdb/__main__.py b/mindsdb/__main__.py
--- a/mindsdb/__main__.py
+++ b/mindsdb/__main__.py
@@ -28,6 +28,28 @@
 
 
 if __name__ == '__main__':
+    version_error_msg = """
+MindsDB server requires Python >= 3.6 to run
+
+Once you have Python 3.6 installed you can tun mindsdb as follows:
+
+1. create and activate venv:
+python3.6 -m venv venv
+source venv/bin/activate
+
+2. install MindsDB:
+pip3 install mindsdb
+
+3. Run MindsDB
+python3.6 -m mindsdb
+
+More instructions in https://docs.mindsdb.com
+    """
+
+    if not (sys.version_info[0] >= 3 and sys.version_info[1] >= 6):
+        print(version_error_msg)
+        exit(1)
+
     mp.freeze_support()
 
     args = args_parse()

{"golden_diff": "diff --git a/mindsdb/__main__.py b/mindsdb/__main__.py\n--- a/mindsdb/__main__.py\n+++ b/mindsdb/__main__.py\n@@ -28,6 +28,28 @@\n \n \n if __name__ == '__main__':\n+    version_error_msg = \"\"\"\n+MindsDB server requires Python >= 3.6 to run\n+\n+Once you have Python 3.6 installed you can tun mindsdb as follows:\n+\n+1. create and activate venv:\n+python3.6 -m venv venv\n+source venv/bin/activate\n+\n+2. install MindsDB:\n+pip3 install mindsdb\n+\n+3. Run MindsDB\n+python3.6 -m mindsdb\n+\n+More instructions in https://docs.mindsdb.com\n+    \"\"\"\n+\n+    if not (sys.version_info[0] >= 3 and sys.version_info[1] >= 6):\n+        print(version_error_msg)\n+        exit(1)\n+\n     mp.freeze_support()\n \n     args = args_parse()\n", "issue": "Check if the python version is at least 3.6 on server start.\nOn Server start check if Python version is < 3.8\r\n\r\nif lower version, print message:\r\n\r\n```\r\nMindsDB server requires Python >= 3.8 to run\r\n\r\nOnce you have Python 3.8 installed you can tun mindsdb as follows:\r\n\r\n1. create and activate venv:\r\n    python3.8 -m venv venv\r\n    source venv/bin/activate\r\n2. install MindsDB:\r\n    pip3 install mindsdb\r\n3. Run MindsDB\r\n    python3.8 -m mindsdb\r\n\r\nMore instructions in https://docs.mindsdb.com\r\n\r\n```\r\n\r\nand exit\n", "before_files": [{"content": "import atexit\nimport traceback\nimport sys\nimport os\nimport time\n\nfrom pkg_resources import get_distribution\nimport torch.multiprocessing as mp\n\nfrom mindsdb.utilities.config import Config\nfrom mindsdb.interfaces.native.mindsdb import MindsdbNative\nfrom mindsdb.interfaces.custom.custom_models import CustomModels\nfrom mindsdb.api.http.start import start as start_http\nfrom mindsdb.api.mysql.start import start as start_mysql\nfrom mindsdb.api.mongo.start import start as start_mongo\nfrom mindsdb.utilities.fs import get_or_create_dir_struct, update_versions_file\nfrom mindsdb.utilities.ps import is_port_in_use\nfrom mindsdb.interfaces.database.database import DatabaseWrapper\nfrom mindsdb.utilities.functions import args_parse\n\n\ndef close_api_gracefully(p_arr):\n    for p in p_arr:\n        sys.stdout.flush()\n        p.terminate()\n        p.join()\n        sys.stdout.flush()\n\n\nif __name__ == '__main__':\n    mp.freeze_support()\n\n    args = args_parse()\n\n    config_path = args.config\n    if config_path is None:\n        config_dir, _ = get_or_create_dir_struct()\n        config_path = os.path.join(config_dir, 'config.json')\n\n    config = Config(config_path)\n\n    from mindsdb.__about__ import __version__ as mindsdb_version\n\n    if args.version:\n        print(f'MindsDB {mindsdb_version}')\n        sys.exit(0)\n\n    try:\n        lightwood_version = get_distribution('lightwood').version\n    except Exception:\n        from lightwood.__about__ import __version__ as lightwood_version\n\n    try:\n        mindsdb_native_version = get_distribution('mindsdb_native').version\n    except Exception:\n        from mindsdb_native.__about__ import __version__ as mindsdb_native_version\n\n    if args.verbose:\n        config['log']['level']['console'] = 'INFO'\n\n    print(f'Configuration file:\\n   {config_path}')\n    print(f\"Storage path:\\n   {config.paths['root']}\")\n\n    print('Versions:')\n    print(f' - lightwood {lightwood_version}')\n    print(f' - MindsDB_native {mindsdb_native_version}')\n    print(f' - MindsDB {mindsdb_version}')\n\n    os.environ['MINDSDB_STORAGE_PATH'] = config.paths['predictors']\n    if args.verbose is True:\n        os.environ['DEFAULT_LOG_LEVEL'] = 'INFO'\n        os.environ['LIGHTWOOD_LOG_LEVEL'] = 'INFO'\n    else:\n        os.environ['DEFAULT_LOG_LEVEL'] = 'ERROR'\n        os.environ['LIGHTWOOD_LOG_LEVEL'] = 'ERROR'\n\n    update_versions_file(\n        config,\n        {\n            'lightwood': lightwood_version,\n            'mindsdb_native': mindsdb_native_version,\n            'mindsdb': mindsdb_version,\n            'python': sys.version.replace('\\n', '')\n        }\n    )\n\n    if args.api is None:\n        api_arr = ['http', 'mysql']\n    else:\n        api_arr = args.api.split(',')\n\n    api_arr = [{\n        'name': api,\n        'port': config['api'][api]['port'],\n        'started': False\n    } for api in api_arr]\n\n    for api in api_arr:\n        api_name = api['name']\n        if api_name not in config['api']:\n            print(f\"Trying run '{api_name}' API, but is no config for this api.\")\n            print(f\"Please, fill config['api']['{api_name}']\")\n            sys.exit(0)\n\n    start_functions = {\n        'http': start_http,\n        'mysql': start_mysql,\n        'mongodb': start_mongo\n    }\n\n    mdb = MindsdbNative(config)\n    cst = CustomModels(config)\n    # @TODO Maybe just use `get_model_data` directly here ? Seems like a useless abstraction\n    model_data_arr = [\n        {\n            'name': x['name'],\n            'predict': x['predict'],\n            'data_analysis': mdb.get_model_data(x['name'])['data_analysis_v2']\n        } for x in mdb.get_models()\n    ]\n\n    for m in model_data_arr:\n        if 'columns_to_ignore' in m['data_analysis']:\n            del m['data_analysis']['columns_to_ignore']\n        if 'train_std_dev' in m['data_analysis']:\n            del m['data_analysis']['train_std_dev']\n\n    model_data_arr.extend(cst.get_models())\n\n    dbw = DatabaseWrapper(config)\n    dbw.register_predictors(model_data_arr)\n\n    for broken_name in [name for name, connected in dbw.check_connections().items() if connected is False]:\n        print(f'Error failed to integrate with database aliased: {broken_name}')\n\n    p_arr = []\n    ctx = mp.get_context('spawn')\n\n    for api in api_arr:\n        api_name = api['name']\n        print(f'{api_name} API: starting...')\n        try:\n            p = ctx.Process(target=start_functions[api_name], args=(config_path, args.verbose))\n            p.start()\n            p_arr.append(p)\n        except Exception as e:\n            close_api_gracefully(p_arr)\n            print(f'Failed to start {api_name} API with exception {e}')\n            print(traceback.format_exc())\n            raise\n\n    atexit.register(close_api_gracefully, p_arr=p_arr)\n\n    timeout = 15\n    start_time = time.time()\n    all_started = False\n    while (time.time() - start_time) < timeout and all_started is False:\n        all_started = True\n        for i, api in enumerate(api_arr):\n            try:\n                in_use = api['started'] or is_port_in_use(api['port'])\n            except Exception:\n                # NOTE that hotfix for OSX: is_port_in_use will raise AccessDenied error if it runned not as sudo\n                in_use = True\n            if in_use and api['started'] != in_use:\n                api['started'] = in_use\n                print(f\"{api['name']} API: started on {api['port']}\")\n            all_started = all_started and in_use\n        time.sleep(0.5)\n\n    for p in p_arr:\n        p.join()\n", "path": "mindsdb/__main__.py"}], "after_files": [{"content": "import atexit\nimport traceback\nimport sys\nimport os\nimport time\n\nfrom pkg_resources import get_distribution\nimport torch.multiprocessing as mp\n\nfrom mindsdb.utilities.config import Config\nfrom mindsdb.interfaces.native.mindsdb import MindsdbNative\nfrom mindsdb.interfaces.custom.custom_models import CustomModels\nfrom mindsdb.api.http.start import start as start_http\nfrom mindsdb.api.mysql.start import start as start_mysql\nfrom mindsdb.api.mongo.start import start as start_mongo\nfrom mindsdb.utilities.fs import get_or_create_dir_struct, update_versions_file\nfrom mindsdb.utilities.ps import is_port_in_use\nfrom mindsdb.interfaces.database.database import DatabaseWrapper\nfrom mindsdb.utilities.functions import args_parse\n\n\ndef close_api_gracefully(p_arr):\n    for p in p_arr:\n        sys.stdout.flush()\n        p.terminate()\n        p.join()\n        sys.stdout.flush()\n\n\nif __name__ == '__main__':\n    version_error_msg = \"\"\"\nMindsDB server requires Python >= 3.6 to run\n\nOnce you have Python 3.6 installed you can tun mindsdb as follows:\n\n1. create and activate venv:\npython3.6 -m venv venv\nsource venv/bin/activate\n\n2. install MindsDB:\npip3 install mindsdb\n\n3. Run MindsDB\npython3.6 -m mindsdb\n\nMore instructions in https://docs.mindsdb.com\n    \"\"\"\n\n    if not (sys.version_info[0] >= 3 and sys.version_info[1] >= 6):\n        print(version_error_msg)\n        exit(1)\n\n    mp.freeze_support()\n\n    args = args_parse()\n\n    config_path = args.config\n    if config_path is None:\n        config_dir, _ = get_or_create_dir_struct()\n        config_path = os.path.join(config_dir, 'config.json')\n\n    config = Config(config_path)\n\n    from mindsdb.__about__ import __version__ as mindsdb_version\n\n    if args.version:\n        print(f'MindsDB {mindsdb_version}')\n        sys.exit(0)\n\n    try:\n        lightwood_version = get_distribution('lightwood').version\n    except Exception:\n        from lightwood.__about__ import __version__ as lightwood_version\n\n    try:\n        mindsdb_native_version = get_distribution('mindsdb_native').version\n    except Exception:\n        from mindsdb_native.__about__ import __version__ as mindsdb_native_version\n\n    if args.verbose:\n        config['log']['level']['console'] = 'INFO'\n\n    print(f'Configuration file:\\n   {config_path}')\n    print(f\"Storage path:\\n   {config.paths['root']}\")\n\n    print('Versions:')\n    print(f' - lightwood {lightwood_version}')\n    print(f' - MindsDB_native {mindsdb_native_version}')\n    print(f' - MindsDB {mindsdb_version}')\n\n    os.environ['MINDSDB_STORAGE_PATH'] = config.paths['predictors']\n    if args.verbose is True:\n        os.environ['DEFAULT_LOG_LEVEL'] = 'INFO'\n        os.environ['LIGHTWOOD_LOG_LEVEL'] = 'INFO'\n    else:\n        os.environ['DEFAULT_LOG_LEVEL'] = 'ERROR'\n        os.environ['LIGHTWOOD_LOG_LEVEL'] = 'ERROR'\n\n    update_versions_file(\n        config,\n        {\n            'lightwood': lightwood_version,\n            'mindsdb_native': mindsdb_native_version,\n            'mindsdb': mindsdb_version,\n            'python': sys.version.replace('\\n', '')\n        }\n    )\n\n    if args.api is None:\n        api_arr = ['http', 'mysql']\n    else:\n        api_arr = args.api.split(',')\n\n    api_arr = [{\n        'name': api,\n        'port': config['api'][api]['port'],\n        'started': False\n    } for api in api_arr]\n\n    for api in api_arr:\n        api_name = api['name']\n        if api_name not in config['api']:\n            print(f\"Trying run '{api_name}' API, but is no config for this api.\")\n            print(f\"Please, fill config['api']['{api_name}']\")\n            sys.exit(0)\n\n    start_functions = {\n        'http': start_http,\n        'mysql': start_mysql,\n        'mongodb': start_mongo\n    }\n\n    mdb = MindsdbNative(config)\n    cst = CustomModels(config)\n    # @TODO Maybe just use `get_model_data` directly here ? Seems like a useless abstraction\n    model_data_arr = [\n        {\n            'name': x['name'],\n            'predict': x['predict'],\n            'data_analysis': mdb.get_model_data(x['name'])['data_analysis_v2']\n        } for x in mdb.get_models()\n    ]\n\n    for m in model_data_arr:\n        if 'columns_to_ignore' in m['data_analysis']:\n            del m['data_analysis']['columns_to_ignore']\n        if 'train_std_dev' in m['data_analysis']:\n            del m['data_analysis']['train_std_dev']\n\n    model_data_arr.extend(cst.get_models())\n\n    dbw = DatabaseWrapper(config)\n    dbw.register_predictors(model_data_arr)\n\n    for broken_name in [name for name, connected in dbw.check_connections().items() if connected is False]:\n        print(f'Error failed to integrate with database aliased: {broken_name}')\n\n    p_arr = []\n    ctx = mp.get_context('spawn')\n\n    for api in api_arr:\n        api_name = api['name']\n        print(f'{api_name} API: starting...')\n        try:\n            p = ctx.Process(target=start_functions[api_name], args=(config_path, args.verbose))\n            p.start()\n            p_arr.append(p)\n        except Exception as e:\n            close_api_gracefully(p_arr)\n            print(f'Failed to start {api_name} API with exception {e}')\n            print(traceback.format_exc())\n            raise\n\n    atexit.register(close_api_gracefully, p_arr=p_arr)\n\n    timeout = 15\n    start_time = time.time()\n    all_started = False\n    while (time.time() - start_time) < timeout and all_started is False:\n        all_started = True\n        for i, api in enumerate(api_arr):\n            try:\n                in_use = api['started'] or is_port_in_use(api['port'])\n            except Exception:\n                # NOTE that hotfix for OSX: is_port_in_use will raise AccessDenied error if it runned not as sudo\n                in_use = True\n            if in_use and api['started'] != in_use:\n                api['started'] = in_use\n                print(f\"{api['name']} API: started on {api['port']}\")\n            all_started = all_started and in_use\n        time.sleep(0.5)\n\n    for p in p_arr:\n        p.join()\n", "path": "mindsdb/__main__.py"}]}