0

I'm having a problem importing flask-mongoengine. The error I'm getting is:

ImportError: No module named flask_mongoengine

I am using a virtual environment (installed using sudo), with the following requirements.txt:

click==6.7
Flask==0.12.2
Flask-Login==0.4.0
flask-mongoengine==0.9.3
Flask-WTF==0.14.2
itsdangerous==0.24
Jinja2==2.9.6
MarkupSafe==1.0
mongoengine==0.13.0
pymongo==3.4.0
requests==2.2.1
six==1.10.0
Werkzeug==0.12.2
WTForms==2.1

I installed these using:

sudo -H pip install -r requirements.txt

Everything else seems to be imported and working fine, but flask-mongoengine is giving me issues. I've searched for answers, uninstalled and reinstalled many times, but cannot find the problem. I feel like it may be a problem with my PYTHONPATH? Or with virtualenv? But for now I am at a loss.

Essentially: pip recognizes that it's installed, but I can't import it in my app.py.

Any help with this is greatly appreciated. If you need more info, I will provide to the best of my ability.

Thanks!

3 Answers3

1

Try installing

pip install flask-mongoengine
skr
  • 2,146
  • 19
  • 22
0

You shouldn't use sudo in virtual environments. Just

pip install -r requirements.txt

after activating the virtual environment.

phd
  • 82,685
  • 13
  • 120
  • 165
0

Probably you need update something, try pip install -U -r requirements.txt

Juliano Petronetto
  • 1,067
  • 13
  • 15