flask-mongoalchemy
flask-mongoalchemy copied to clipboard
mongoalchemy import error
I installed flask-mongoalchemy today but keep getting the error: ImportError: No module named mongoalchemy.
I saw that this issue was fixed in one of the previous releases but I am still getting this.
Hi, thanks for reporting.
Which version of flask-mongoalchemy? Last one? You just ran pip install flask-mongoalchemy?
Here is what I got running this:
% pip install flask-mongoalchemy
Downloading/unpacking flask-mongoalchemy
Downloading Flask-MongoAlchemy-0.5.3.tar.gz
Running setup.py egg_info for package flask-mongoalchemy
Downloading/unpacking Flask>=0.7 (from flask-mongoalchemy)
Downloading Flask-0.8.tar.gz (494Kb): 494Kb downloaded
Running setup.py egg_info for package Flask
warning: no files found matching '*' under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
warning: no previously-included files matching '*.pyc' found under directory 'tests'
warning: no previously-included files matching '*.pyo' found under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'examples'
warning: no previously-included files matching '*.pyo' found under directory 'examples'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'docs/_themes/.git'
Downloading/unpacking MongoAlchemy>=0.9 (from flask-mongoalchemy)
Downloading MongoAlchemy-0.12.tar.gz
Running setup.py egg_info for package MongoAlchemy
Downloading/unpacking pymongo>=1.10.1 (from flask-mongoalchemy)
Downloading pymongo-2.2.tar.gz (228Kb): 228Kb downloaded
Running setup.py egg_info for package pymongo
Downloading/unpacking Werkzeug>=0.6.1 (from Flask>=0.7->flask-mongoalchemy)
Downloading Werkzeug-0.8.3.tar.gz (1.1Mb): 1.1Mb downloaded
Running setup.py egg_info for package Werkzeug
warning: no files found matching '*' under directory 'werkzeug/debug/templates'
warning: no files found matching '*' under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
warning: no previously-included files matching '*.pyc' found under directory 'tests'
warning: no previously-included files matching '*.pyo' found under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'examples'
warning: no previously-included files matching '*.pyo' found under directory 'examples'
no previously-included directories found matching 'docs/_build'
Downloading/unpacking Jinja2>=2.4 (from Flask>=0.7->flask-mongoalchemy)
Downloading Jinja2-2.6.tar.gz (389Kb): 389Kb downloaded
Running setup.py egg_info for package Jinja2
warning: no previously-included files matching '*' found under directory 'docs/_build'
warning: no previously-included files matching '*.pyc' found under directory 'jinja2'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'jinja2'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
Installing collected packages: flask-mongoalchemy, Flask, MongoAlchemy, pymongo, Werkzeug, Jinja2
Running setup.py install for flask-mongoalchemy
Skipping installation of /Users/f/.virtualenvs/flma/lib/python2.7/site-packages/flaskext/__init__.py (namespace package)
Installing /Users/f/.virtualenvs/flma/lib/python2.7/site-packages/Flask_MongoAlchemy-0.5.3-py2.7-nspkg.pth
Running setup.py install for Flask
warning: no files found matching '*' under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
warning: no previously-included files matching '*.pyc' found under directory 'tests'
warning: no previously-included files matching '*.pyo' found under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'examples'
warning: no previously-included files matching '*.pyo' found under directory 'examples'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'docs/_themes/.git'
Running setup.py install for MongoAlchemy
Running setup.py install for pymongo
building 'bson._cbson' extension
/usr/bin/clang -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -I/usr/local/include/ -arch i386 -arch x86_64 -pipe -Ibson -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c bson/_cbsonmodule.c -o build/temp.macosx-10.7-intel-2.7/bson/_cbsonmodule.o
/usr/bin/clang -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -I/usr/local/include/ -arch i386 -arch x86_64 -pipe -Ibson -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c bson/time64.c -o build/temp.macosx-10.7-intel-2.7/bson/time64.o
/usr/bin/clang -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -I/usr/local/include/ -arch i386 -arch x86_64 -pipe -Ibson -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c bson/buffer.c -o build/temp.macosx-10.7-intel-2.7/bson/buffer.o
/usr/bin/clang -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -I/usr/local/include/ -arch i386 -arch x86_64 -pipe -Ibson -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c bson/encoding_helpers.c -o build/temp.macosx-10.7-intel-2.7/bson/encoding_helpers.o
llvm-gcc-4.2 -Wl,-F. -bundle -undefined dynamic_lookup -Wl,-F. -arch i386 -arch x86_64 -L/usr/local/lib/ -I/usr/local/include/ build/temp.macosx-10.7-intel-2.7/bson/_cbsonmodule.o build/temp.macosx-10.7-intel-2.7/bson/time64.o build/temp.macosx-10.7-intel-2.7/bson/buffer.o build/temp.macosx-10.7-intel-2.7/bson/encoding_helpers.o -o build/lib.macosx-10.7-intel-2.7/bson/_cbson.so
building 'pymongo._cmessage' extension
/usr/bin/clang -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -I/usr/local/include/ -arch i386 -arch x86_64 -pipe -Ibson -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pymongo/_cmessagemodule.c -o build/temp.macosx-10.7-intel-2.7/pymongo/_cmessagemodule.o
/usr/bin/clang -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -I/usr/local/include/ -arch i386 -arch x86_64 -pipe -Ibson -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c bson/buffer.c -o build/temp.macosx-10.7-intel-2.7/bson/buffer.o
llvm-gcc-4.2 -Wl,-F. -bundle -undefined dynamic_lookup -Wl,-F. -arch i386 -arch x86_64 -L/usr/local/lib/ -I/usr/local/include/ build/temp.macosx-10.7-intel-2.7/pymongo/_cmessagemodule.o build/temp.macosx-10.7-intel-2.7/bson/buffer.o -o build/lib.macosx-10.7-intel-2.7/pymongo/_cmessage.so
Running setup.py install for Werkzeug
warning: no files found matching '*' under directory 'werkzeug/debug/templates'
warning: no files found matching '*' under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
warning: no previously-included files matching '*.pyc' found under directory 'tests'
warning: no previously-included files matching '*.pyo' found under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'examples'
warning: no previously-included files matching '*.pyo' found under directory 'examples'
no previously-included directories found matching 'docs/_build'
Running setup.py install for Jinja2
warning: no previously-included files matching '*' found under directory 'docs/_build'
warning: no previously-included files matching '*.pyc' found under directory 'jinja2'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'jinja2'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
Successfully installed flask-mongoalchemy Flask MongoAlchemy pymongo Werkzeug Jinja2
Cleaning up...
When do you get the error?
I'm also able to run a simple example (library.py, in the examples directory):
% pwd
<projects>/flask-mongoalchemy/examples/library
% python library.py
* Running on http://127.0.0.1:5000/
* Restarting with reloader
What steps are you following?
I did a pip install which went smooth. I din't notice any errors while installing. From the python prompt I imported flaskext and that works but when I say import flaskext.mongoalchemy it gives me errors out saying ImportError: No module named mongoalchemy I should mention that I am running all of this on virtualenv.
So do I:
% which python
/Users/f/.virtualenvs/flma/bin/python
% python
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import flaskext.mongoalchemy
>>>
Did you run pip with --no-deps
flag? Is MongoAlchemy installed? What does pip freeze
output?
Here is my output:
% pip freeze
Flask==0.8
Flask-MongoAlchemy==0.5.3
Jinja2==2.6
MongoAlchemy==0.12
Werkzeug==0.8.3
pymongo==2.2
wsgiref==0.1.2
Here's what I get:
[msahni@msahni-ld ~]$ python Python 2.6.6 (r266:84292, Apr 11 2011, 15:50:32) [GCC 4.4.4 20100726 (Red Hat 4.4.4-13)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import flaskext.mongoalchemy Traceback (most recent call last): File "
", line 1, in ImportError: No module named mongoalchemy
And pip freeze gives me all of the items you listed with the same versions except 'wsgiref'.
I did not run with with any flags.
Are you sure you're running Python from virtualenv? What does sys.path
returns?
% python
...
>>> import sys
>>> print sys.path
@fsouza Please close this issue as this is dead now :)
Worked for me after changing this (from docs):
from flask.ext.mongoalchemy import MongoAlchemy
To this:
from flask_mongoalchemy import MongoAlchemy
thanks @stevula , it worked