From e277decd4c1c7589f079fb10db8d0851cbaed461 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 19 Jul 2015 19:00:48 -0700 Subject: [PATCH] Add a check to ensure pip is installed --- homeassistant/__main__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/homeassistant/__main__.py b/homeassistant/__main__.py index 658e64ad145..2514b35587f 100644 --- a/homeassistant/__main__.py +++ b/homeassistant/__main__.py @@ -21,6 +21,16 @@ def validate_python(): sys.exit() +def ensure_pip(): + """ Validate pip is installed so we can install packages on demand. """ + if importlib.find_loader('pip') is None: + print("Your Python installation did not bundle 'pip'") + print("Home Assistant requires 'pip' to be installed.") + print("Please install pip: " + "https://pip.pypa.io/en/latest/installing.html") + sys.exit() + + # Copy of homeassistant.util.package because we can't import yet def install_package(package): """Install a package on PyPi. Accepts pip compatible package strings. @@ -36,6 +46,8 @@ def install_package(package): def validate_dependencies(): """ Validate all dependencies that HA uses. """ + ensure_pip() + print("Validating dependencies...") import_fail = False