how to find right version of bson from pip for pymongo/mongoengine
Question: 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!


Answer: 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
    

