# ModuleNotFoundError: No module named 'pymongo'

**URL:** <https://forum.rasa.com/t/modulenotfounderror-no-module-named-pymongo/10392>\
**Category:** Rasa Open Source\
**Created:** [May 26, 2019, 7:25am UTC](https://forum.rasa.com/t/modulenotfounderror-no-module-named-pymongo/10392 "2019-05-26T07:25:30Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![azharameen](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/azharameen/32/3104_2.png) [@azharameen](https://forum.rasa.com/u/azharameen)\
**Post date:** [May 26, 2019, 7:25am UTC](https://forum.rasa.com/t/modulenotfounderror-no-module-named-pymongo/10392/1 "2019-05-26T07:25:30Z")

</div>

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/executor.py", line 175, in register_package
    action_server_1 | self._import_submodules(package)
    action_server_1 | File "/app/rasa_sdk/executor.py", 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/ __init__.py", 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/personal_info_form.py", 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.

Thanks

---

<div class="post-metadata">

**Author:** ![tmbo](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tmbo/32/19_2.png) [@tmbo](https://forum.rasa.com/u/tmbo)\
**Post date:** [June 18, 2019, 6:42pm UTC](https://forum.rasa.com/t/modulenotfounderror-no-module-named-pymongo/10392/2 "2019-06-18T18:42:26Z")

</div>

What is the command you are using to start this?

---

<div class="post-metadata">

**Author:** ![azharameen](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/azharameen/32/3104_2.png) [@azharameen](https://forum.rasa.com/u/azharameen)\
**Post date:** [July 9, 2019, 5:13am UTC](https://forum.rasa.com/t/modulenotfounderror-no-module-named-pymongo/10392/4 "2019-07-09T05:13:35Z")

</div>

> [@azharameen](#):
>
> pip install pymongo

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

---

<div class="post-metadata">

**Author:** ![azharameen](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/azharameen/32/3104_2.png) [@azharameen](https://forum.rasa.com/u/azharameen)\
**Post date:** [July 9, 2019, 6:15am UTC](https://forum.rasa.com/t/modulenotfounderror-no-module-named-pymongo/10392/5 "2019-07-09T06:15:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JulianGerhard](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/juliangerhard/32/3781_2.png) [@JulianGerhard](https://forum.rasa.com/u/JulianGerhard)\
**Post date:** [July 9, 2019, 6:57am UTC](https://forum.rasa.com/t/modulenotfounderror-no-module-named-pymongo/10392/6 "2019-07-09T06:57:45Z")

</div>

Hi @azharameen

what does the following commands output?

```
pip --version
pip show pymongo

```

Regards Julian

---

<div class="post-metadata">

**Author:** ![Bunny99](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@Bunny99](https://forum.rasa.com/u/Bunny99)\
**Post date:** [July 9, 2019, 7:01am UTC](https://forum.rasa.com/t/modulenotfounderror-no-module-named-pymongo/10392/7 "2019-07-09T07:01:10Z")

</div>

Importing the package in your action.py like import pymongo

---

<div class="post-metadata">

**Author:** ![azharameen](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/azharameen/32/3104_2.png) [@azharameen](https://forum.rasa.com/u/azharameen)\
**Post date:** [July 9, 2019, 8:06am UTC](https://forum.rasa.com/t/modulenotfounderror-no-module-named-pymongo/10392/8 "2019-07-09T08:06:54Z")

</div>

`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 [http://www.mongodb.org](http://www.mongodb.org) Home-page: [http://github.com/mongodb/mongo-python-driver](http://github.com/mongodb/mongo-python-driver) Author: Mike Dirolf Author-email: [mongodb-user@googlegroups.com](mailto:mongodb-user@googlegroups.com) License: Apache License, Version 2.0 Location: /home/ameen/Documents/ej-bot/rasaenv/lib/python3.6/site-packages Requires: Required-by: rasa

---

<div class="post-metadata">

**Author:** ![JulianGerhard](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/juliangerhard/32/3781_2.png) [@JulianGerhard](https://forum.rasa.com/u/JulianGerhard)\
**Post date:** [July 9, 2019, 9:48am UTC](https://forum.rasa.com/t/modulenotfounderror-no-module-named-pymongo/10392/9 "2019-07-09T09:48:11Z")

</div>

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

ENTRYPOINT ["rasa"]

```

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.

Regards

---

<div class="post-metadata">

**Author:** ![azharameen](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/azharameen/32/3104_2.png) [@azharameen](https://forum.rasa.com/u/azharameen)\
**Post date:** [July 9, 2019, 12:15pm UTC](https://forum.rasa.com/t/modulenotfounderror-no-module-named-pymongo/10392/10 "2019-07-09T12:15:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![xitun1234](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/xitun1234/32/8224_2.png) [@xitun1234](https://forum.rasa.com/u/xitun1234)\
**Post date:** [April 11, 2020, 11:30am UTC](https://forum.rasa.com/t/modulenotfounderror-no-module-named-pymongo/10392/11 "2020-04-11T11:30:46Z")

</div>

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