diff --git a/pi_mqtt_gpio/server.py b/pi_mqtt_gpio/server.py index 59d5b86392dd3074a5f1114dbccca9d524764355..d194b4b632293c7d4ae7cf1a7cc7cfb5382f2208 100644 --- a/pi_mqtt_gpio/server.py +++ b/pi_mqtt_gpio/server.py @@ -212,14 +212,15 @@ def install_missing_requirements(module): if pkgs_installed.find(pkg_resources.Requirement.parse(req)) is None: pkgs_required.append(req) if pkgs_required: - from pip.commands.install import InstallCommand - from pip.status_codes import SUCCESS - cmd = InstallCommand() - result = cmd.main(pkgs_required) - if result != SUCCESS: + from subprocess import check_call, CalledProcessError + try: + check_call(['/usr/bin/env', 'pip', 'install'] + pkgs_required) + except CalledProcessError as err: raise CannotInstallModuleRequirements( - "Unable to install packages for module %r (%s)..." % ( - module, pkgs_required)) + "Unable to install packages for module %r (%s): %s" % ( + module, pkgs_required, err + ) + ) def output_name_from_topic(topic, topic_prefix, suffix):