Skip to content

Commit d8752f4

Browse files
authored
fix: remove docker-compose as a required dependency. (#1128)
* Remove docker-compose as a required dependency. Throw an error if it is not installed. * Use distutils instead of shutil to support python2.
1 parent 6e4bf8a commit d8752f4

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def read_version():
4040
"scipy>=0.19.0",
4141
"urllib3>=1.21, <1.25",
4242
"protobuf3-to-dict>=0.1.5",
43-
"docker-compose>=1.23.0",
4443
"requests>=2.20.0, <2.21",
4544
"fabric>=2.0",
4645
]
@@ -87,6 +86,7 @@ def read_version():
8786
"black==19.3b0 ; python_version >= '3.6'",
8887
"stopit==1.1.2",
8988
"apache-airflow==1.10.5",
89+
"docker-compose>=1.23.0",
9090
]
9191
},
9292
entry_points={"console_scripts": ["sagemaker=sagemaker.cli.main:main"]},

src/sagemaker/local/image.py

+10
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import tarfile
3030
import tempfile
3131

32+
from distutils.spawn import find_executable
3233
from threading import Thread
3334
from six.moves.urllib.parse import urlparse
3435

@@ -77,6 +78,15 @@ def __init__(self, instance_type, instance_count, image, sagemaker_session=None)
7778
"""
7879
from sagemaker.local.local_session import LocalSession
7980

81+
# check if docker-compose is installed
82+
if find_executable("docker-compose") is None:
83+
raise ImportError(
84+
"'docker-compose' is not installed. "
85+
"Local Mode features will not work without docker-compose. "
86+
"For more information on how to install 'docker-compose', please, see "
87+
"https://docs.docker.com/compose/install/"
88+
)
89+
8090
self.sagemaker_session = sagemaker_session or LocalSession()
8191
self.instance_type = instance_type
8292
self.instance_count = instance_count

0 commit comments

Comments
 (0)