how to find right version of bson from pip for pymongo/mongoengine
I am working on a (python 2.7) flask-mongoengine application which uses bson's ObjectId. The project requires bson in one or another way. I don't have root access on the host i'm trying to deploy the application and pip install bson fails: -bash-4.1$ pip install bson Collecting bson Using cached bson-1.1.0.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-build-BBOawV/bson/setup.py", line 24, in <module> import bson File "bson/__init__.py", line 66, in <module> from . import codec File "bson/codec.py", line 28, in <module> from .objects import * File "bson/objects.py", line 36 class BSONObject(object, metaclass=ABCMeta): ^ SyntaxError: invalid syntax ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-BBOawV/bson/ On the other hand, https://api.mongodb.org/python/current/installation.html states that i shouldn't use this version of bson and rely on pymongo's implementation. However, on my computer where I have pymongo-3.2.1 installed, I cannot import pymongo.objectId - so what am I doing wrong and how can I get bson to work with my setup? Thank you soo much!
I had a similar issue. Just download the tarball from https://pypi.python.org/pypi/bson/0.4.3 and do a manual install: python setup.py install
Since I don't have root access and can't install a distribution version of bson, I chose to drop the object in my DB document definition. This solves it for me, since it's also cleaner but the truth is as Mihai stated: pip install bson seems to be limited to python3 projects.
I had the same issue and re-installing PyMongo fixed the BSON dependencies: pip install --upgrade --force-reinstall pymongo
read video file from mongodb with pymongo
Get OperationFailure error with PyMongo 2.7.1
Inserting string as regular string in mongodb
Mongos + Pymongo 2.5 ==>No suitable hosts found
pymongo collection add item using update
How to convert objectid to string
Conditional atomic mongo remove with different results
python script to connect to mongodb master
flask-admin and pymongo search
Running code when mongoengine loads a document
Can't replace mongo document
How do I call a function with pymongo using webpy?
python motor offers fetch_next exception on aggregation
python motor mongo cursor length or peek next
PyMongo check if update succeeded
insert and query an OrderedDict in MongoHQ