diff --git a/chalice/compat.py b/chalice/compat.py index eb2e07358..29f3ea751 100644 --- a/chalice/compat.py +++ b/chalice/compat.py @@ -11,10 +11,13 @@ def pip_import_string(): # type: () -> str import pip pip_major_version = pip.__version__.split('.')[0] - if pip_major_version == '10': - return 'from pip._internal import main' - else: + # Pip moved its internals to an _internal module in version 10. + # In order to be compatible with version 9 which has it at at the + # top level we need to figure out the correct import path here. + if pip_major_version == '9': return 'from pip import main' + else: + return 'from pip._internal import main' if os.name == 'nt': diff --git a/setup.py b/setup.py index 2ebacce05..535d52a22 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ 'botocore>=1.10.48,<2.0.0', 'typing==3.6.4', 'six>=1.10.0,<2.0.0', - 'pip>=9,<11', + 'pip>=9,<=18', 'attrs==17.4.0', 'enum-compat>=0.0.2', 'jmespath>=0.9.3,<1.0.0',