aboutsummaryrefslogtreecommitdiff
path: root/launch.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-01-28 10:13:56 +0300
committerGitHub <noreply@github.com>2023-01-28 10:13:56 +0300
commit28c4c9b907fdb084a8e0c783caaeee6cc43e52b9 (patch)
tree09b136603cf6c3e354761ea3aa42b4d93bc283c0 /launch.py
parentce72af87d3b05c946bc82033786fc340f1c20512 (diff)
parent56c83e453a2ac333a0888ab3835ad4c82feacc25 (diff)
Merge pull request #7200 from Spaceginner/master
Add a Python version check
Diffstat (limited to 'launch.py')
-rw-r--r--launch.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/launch.py b/launch.py
index 9d6f4a8c..4f5a4bc4 100644
--- a/launch.py
+++ b/launch.py
@@ -17,6 +17,38 @@ stored_commit_hash = None
skip_install = False
+def check_python_version():
+ if not os.path.isfile("no_py_ver_warning"):
+ version = sys.version_info
+ version_range = None
+ if platform.system() == "Linux":
+ version_range = range(7 + 1, 11 + 1)
+ else:
+ version_range = range(7 + 1, 10 + 1)
+
+ try:
+ assert version.major == 3 and version.minor in version_range, f"""
+=== Warning ===
+This program was tested only with 3.10 Python, but you have {version.major}.{version.minor} Python.
+If you encounter an error with "RuntimeError: Couldn't install torch." message,
+or any other error regarding unsuccessful package (library) installation,
+please downgrade (or upgrade) to the latest version of 3.10 Python
+and delete current Python and "venv" folder in WebUI's directory.
+
+You can download 3.10 Python from here: https://www.python.org/downloads/release/python-3109/
+
+You will see this warning only once, delete file "no_py_ver_warning" file to show this warning again.
+=== Warning ===
+
+Press ENTER to continue...\
+"""
+ except AssertionError as e:
+ print(e)
+ with open("no_py_ver_warning", "w"):
+ pass
+ input()
+
+
def commit_hash():
global stored_commit_hash
@@ -321,5 +353,6 @@ def start():
if __name__ == "__main__":
+ check_python_version()
prepare_environment()
start()