ModuleNotFoundError: No module named 'pymongo'

I need to update slots value after collecting them, so i need to insert data to mongodb. I have installed pymongo but still i am getting error that no module named ‘pymongo’.

pip install pymongo

i get the error shown below

    action_server_1  | Traceback (most recent call last):
    action_server_1  |   File "/app/rasa_sdk/", line 175, in register_package
    action_server_1  |     self._import_submodules(package)
    action_server_1  |   File "/app/rasa_sdk/", line 169, in _import_submodules
    action_server_1  |     results[full_name] = importlib.import_module(full_name)
    action_server_1  |   File "/usr/local/lib/python3.6/importlib/", line 126, in import_module
    action_server_1  |     return _bootstrap._gcd_import(name[level:], package, level)
    action_server_1  |   File "<frozen importlib._bootstrap>", line 994, in _gcd_import
    action_server_1  |   File "<frozen importlib._bootstrap>", line 971, in _find_and_load
    action_server_1  |   File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
    action_server_1  |   File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
    action_server_1  |   File "<frozen importlib._bootstrap_external>", line 678, in exec_module
    action_server_1  |   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
    action_server_1  |   File "/app/actions/", line 9, in <module>
    action_server_1  |     from pymongo import MongoClient
    action_server_1  | ModuleNotFoundError: No module named 'pymongo'

I am running the server with docker

can any one help me in this.


What is the command you are using to start this?

i am using the above command to install, still i am facing the same issue No Module name pymongo

installed pymongo version 3.8.0 and python version v3.6

can any one help me in this

I need to fetch data from MongoDB, can i use existing rasa mongo connection for custom actions sever.

Hi @azharameen

what does the following commands output?

pip --version
pip show pymongo

Regards Julian

Importing the package in your like import pymongo

pip --version

pip 19.1.1 from /home/ameen/Documents/ej-bot/rasaenv/lib/python3.6/site-packages/pip (python 3.6)

pip show pymongo

Name: pymongo Version: 3.0.3 Summary: Python driver for MongoDB Home-page: Author: Mike Dirolf Author-email: [email protected] License: Apache License, Version 2.0 Location: /home/ameen/Documents/ej-bot/rasaenv/lib/python3.6/site-packages Requires: Required-by: rasa

Hi @azharameen

ok - I guess the following happens:

You are actually using Docker to run your bot and you are maybe deriving it from the official rasa images. If so, pymongo is not natively part of the environment, the Dockerfile/compose-file creates. If you want to use it, you could, e.g. extend the currently used rasa image with:

FROM rasa/rasa:latest-full

RUN pip install pymongo


The background is, that your pip enviroment is started locally, whereas docker creates its own environment in which your local pip/environment is not natively reachable.


DockerFile installation didn’t work for me, but i logged into the container and manually installed pymongo. This worked for me.

@JulianGerhard Thanks for the solution.

Hi @azharameen . I had a same problem. Can you show me how fix issue? Thank you very much