PyMongo import error

I am trying to deploy my Flask app on my Linode server. All my files are on that server, but when I run it, I get:

ModuleNotFoundError: No module named 'flask_pymongo'

I check the documentation to see how I can verify if PyMongo is installed, and it suggests:

python -c "import sys; print(sys.version)"

When I run that command, I get this in return:

2.7.17 (default, Nov 7 2019, 10:07:09)
[GCC 9.2.1 20191008]

To me, that suggests that PyMongo is indeed installed. The app runs fine on my local server. I have a requirements.txt file that has the line:

Flask-PyMongo==2.7.17

No idea what's wrong or how to fix. Any suggestions?

1 Reply

As I'm not an expert on PyMongo, I did some digging online to see if I could come up with some answers for you.

This item I found on Stack Overflow may help. It's not associated with Flask, but the solution may still be relevant:

Not able to resolve ModuleNotFoundError: No module named 'pymongo'

Another Stack Overflow article gives potential solutions to a similar issue:

How to fix “ImportError: No module named …” error in Python?

I hope this gets you pointed in the right direction. I've also added some tags to this post to improve its visibility to members of our Community who may have experienced something similar.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct