cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Deploy model to AWS Sagemaker: ModuleNotFoundError: No module named 'docker'

Nikhil3107
New Contributor III

Greetings,

When trying to run the following command:

%sh
mlflow sagemaker build-and-push-container

I get the following error:

/databricks/python3/lib/python3.9/site-packages/click/core.py:2309: UserWarning: Virtualenv support is still experimental and may be changed in a future release without warning.
  value = self.callback(ctx, self, value)
2023/06/12 16:22:04 INFO mlflow.models.docker_utils: Building docker image with name mlflow-pyfunc
Traceback (most recent call last):
  File "/databricks/python3/bin/mlflow", line 8, in <module>
    sys.exit(cli())
  File "/databricks/python3/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/databricks/python3/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/databricks/python3/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/databricks/python3/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/databricks/python3/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/databricks/python3/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/databricks/python3/lib/python3.9/site-packages/mlflow/sagemaker/cli.py", line 605, in build_and_push_container
    mlflow.models.docker_utils._build_image(
  File "/databricks/python3/lib/python3.9/site-packages/mlflow/models/docker_utils.py", line 224, in _build_image
    _build_image_from_context(context_dir=cwd, image_name=image_name)
  File "/databricks/python3/lib/python3.9/site-packages/mlflow/models/docker_utils.py", line 228, in _build_image_from_context
    import docker
ModuleNotFoundError: No module named 'docker'

I installed docker by running the following command:

%pip install docker

But the error still persists. Please note that I am running the above code in a Databricks notebook.

Using the UI, I have also tried installing docker from Databricks' built-in package manager -- again to no avail.

Could I please get some assistance figuring this out?

1 REPLY 1

1 Driver

128 GB Memory, 32 CoresRuntime

12.2.x-cpu-ml-scala2.12

Unity Catalog

g4dn.8xlarge

5.7 DBU/h

Runtime version: 12.2 LTS ML (includes Apache Spark 3.3.2, Scala 2.12)

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group