question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ModuleNotFoundError: No module named 'docker'

See original GitHub issue

I guess this is in reference to this? https://github.com/spulec/moto/issues/3297 Getting a docker import error from within moto.

bash-4.2# pytest -vv test/
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/var/lang/lib/python3.6/site-packages/aws_xray_sdk/core/models/subsegment.py:58: in __call__
    meta_processor=None,
/var/lang/lib/python3.6/site-packages/aws_xray_sdk/core/recorder.py:435: in record_subsegment
    return_value = wrapped(*args, **kwargs)
[INTERNAL_CODE].py
    DelaySeconds=kwargs.get('wait', 0),
/var/lang/lib/python3.6/site-packages/botocore/client.py:357: in _api_call
    return self._make_api_call(operation_name, kwargs)
/var/lang/lib/python3.6/site-packages/botocore/client.py:663: in _make_api_call
    operation_model, request_dict, request_context)
/var/lang/lib/python3.6/site-packages/botocore/client.py:682: in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
/var/lang/lib/python3.6/site-packages/botocore/endpoint.py:102: in make_request
    return self._send_request(request_dict, operation_model)
/var/lang/lib/python3.6/site-packages/botocore/endpoint.py:137: in _send_request
    success_response, exception):
/var/lang/lib/python3.6/site-packages/botocore/endpoint.py:256: in _needs_retry
    caught_exception=caught_exception, request_dict=request_dict)
/var/lang/lib/python3.6/site-packages/botocore/hooks.py:356: in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
/var/lang/lib/python3.6/site-packages/botocore/hooks.py:228: in emit
    return self._emit(event_name, kwargs)
/var/lang/lib/python3.6/site-packages/botocore/hooks.py:211: in _emit
    response = handler(**kwargs)
/var/lang/lib/python3.6/site-packages/botocore/retryhandler.py:183: in __call__
    if self._checker(attempts, response, caught_exception):
/var/lang/lib/python3.6/site-packages/botocore/retryhandler.py:251: in __call__
    caught_exception)
/var/lang/lib/python3.6/site-packages/botocore/retryhandler.py:269: in _should_retry
    return self._checker(attempt_number, response, caught_exception)
/var/lang/lib/python3.6/site-packages/botocore/retryhandler.py:317: in __call__
    caught_exception)
/var/lang/lib/python3.6/site-packages/botocore/retryhandler.py:223: in __call__
    attempt_number, caught_exception)
/var/lang/lib/python3.6/site-packages/botocore/retryhandler.py:359: in _check_caught_exception
    raise caught_exception
/var/lang/lib/python3.6/site-packages/botocore/endpoint.py:197: in _do_get_response
    responses = self._event_emitter.emit(event_name, request=request)
/var/lang/lib/python3.6/site-packages/botocore/hooks.py:356: in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
/var/lang/lib/python3.6/site-packages/botocore/hooks.py:228: in emit
    return self._emit(event_name, kwargs)
/var/lang/lib/python3.6/site-packages/botocore/hooks.py:211: in _emit
    response = handler(**kwargs)
/var/lang/lib/python3.6/site-packages/moto/core/models.py:342: in __call__
    request, request.url, request.headers
/var/lang/lib/python3.6/site-packages/moto/core/responses.py:202: in dispatch
    return cls()._dispatch(*args, **kwargs)
/var/lang/lib/python3.6/site-packages/moto/core/responses.py:312: in _dispatch
    return self.call_action()
/var/lang/lib/python3.6/site-packages/moto/core/utils.py:250: in _wrapper
    response = f(*args, **kwargs)
/var/lang/lib/python3.6/site-packages/moto/core/utils.py:282: in _wrapper
    response = f(*args, **kwargs)
/var/lang/lib/python3.6/site-packages/moto/sqs/responses.py:71: in call_action
    status_code, headers, body = super(SQSResponse, self).call_action()
/var/lang/lib/python3.6/site-packages/moto/core/responses.py:397: in call_action
    response = method()
/var/lang/lib/python3.6/site-packages/moto/sqs/responses.py:243: in send_message
    group_id=message_group_id,
/var/lang/lib/python3.6/site-packages/moto/sqs/models.py:690: in send_message
    queue.add_message(message)
/var/lang/lib/python3.6/site-packages/moto/sqs/models.py:483: in add_message
    from moto.awslambda import lambda_backends
/var/lang/lib/python3.6/site-packages/moto/awslambda/__init__.py:2: in <module>
    from .models import lambda_backends
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    from __future__ import unicode_literals

    import base64
    import time
    from collections import defaultdict
    import copy
    import datetime
    from gzip import GzipFile

>   import docker
E   ModuleNotFoundError: No module named 'docker'

/var/lang/lib/python3.6/site-packages/moto/awslambda/models.py:10: ModuleNotFoundError
===============================================================================================
bash-4.2# pip freeze | grep moto
moto-ext==1.3.15.45

There is no 1.3.16.0 version from pip for moto-ext as suggested in the moto package referenced above.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

3reactions
bblommerscommented, Jan 9, 2021

Hi @chris-erickson, one thing to note that we are in the process of changing the installation. In order to reduce the number of dependencies, you should specify which service you’re using: moto[s3]==.. or moto[all]==... There’s more info in the README.

0reactions
bblommerscommented, Oct 19, 2021

If you manage to create a reproducible example in a public CI, I’d be happy to look into it @antarr, but I haven’t managed to reproduce this myself I’m afraid

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Fixed] ModuleNotFoundError: No module named 'docker'
How to Fix “ModuleNotFoundError: No module named 'docker'” in PyCharm · Open File > Settings > Project from the PyCharm menu. · Select...
Read more >
Failed to import docker or docker-py - No module named docker
The python3-docker module must be installed on the Target machine. I always tried to fix it on my local machine where the runbooks...
Read more >
Ansible No module named 'docker' error - Bobcares
Let us see what causes this error. Ansible uses python to deploy changes in the target machine. Because of that any module you...
Read more >
No module named docker · Issue #844 - GitHub
To me it looks like that you install docker-py for python 2 and you are trying to import it in python 3. Or...
Read more >
Fix ModuleNotFoundError (No Module Named docker) Python ...
In this tutorial I'll show you how to install and import docker package in your python program if you get ModuleNotFoundError no module...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found