diff --git a/docs/docs/faq.md b/docs/docs/faq.md index da2b8c4f69..5056fc0c57 100644 --- a/docs/docs/faq.md +++ b/docs/docs/faq.md @@ -51,6 +51,12 @@ Most likely you are trying to run the InvenTree server from outside the context Always activate the virtual environment before running server commands! +### 'str' object has no attribute 'removeSuffix' + +This error occurs because your installed python version is not up to date. We [require Python v3.9 or newer](./start/intro.md#python-requirements) + +You (or your system administrator) needs to update python to meet the minimum requirements for InvenTree. + ## Update Issues Sometimes, users may encounter unexpected error messages when updating their InvenTree installation to a newer version. diff --git a/tasks.py b/tasks.py index 5627b281af..4558117b6c 100644 --- a/tasks.py +++ b/tasks.py @@ -13,6 +13,35 @@ from platform import python_version from invoke import task +def checkPythonVersion(): + """Check that the installed python version meets minimum requirements. + + If the python version is not sufficient, exits with a non-zero exit code. + """ + + REQ_MAJOR = 3 + REQ_MINOR = 9 + + version = sys.version.split(" ")[0] + + valid = True + + if sys.version_info.major < REQ_MAJOR: + valid = False + + elif sys.version_info.major == REQ_MAJOR and sys.version_info.minor < REQ_MINOR: + valid = False + + if not valid: + print(f"The installed python version ({version}) is not supported!") + print(f"InvenTree requires Python {REQ_MAJOR}.{REQ_MINOR} or above") + sys.exit(1) + + +if __name__ in ['__main__', 'tasks']: + checkPythonVersion() + + def apps(): """Returns a list of installed apps.""" return [