pymongo


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

Related Links

How to update Saved Document Extra data in GridFS
How do I deal with Error stated below?
pymongo query return in direct query not in pymongo
Displaying nested dictionaries in flask-admin
mongoengine slow serialization of embedded documents with reference fields
Pymongo error : 'Cursor' object has no attribute 'find' , how to filter it?
Spark Streaming: foreachRDD insert into mongoDB using python?
how to find right version of bson from pip for pymongo/mongoengine
How to enable `projection` in pymongo query class `find()`?
Variables don't hold value for very long pymongo ipython
pymongo upgrade to 3.0.3 causes this statement to fail
UUID to NUUID in Python
how to test for empty mongodb query in pymong
read video file from mongodb with pymongo
Get OperationFailure error with PyMongo 2.7.1
Inserting string as regular string in mongodb

Categories

HOME
hpoo
amazon-web-services
ionic2
android-studio
clearcase
schema.org
postgresql-9.4
scroll
message-queue
android-emulator
docker-cloud
cryptography
biztalk-2010
azure-mobile-services
bittorrent
gprs
hspi
yahoo
siesta
chromecast
corona
pinterest
closures
android-contacts
rpmbuild
word2vec
jaspersoft-studio
nose
significance
nullreferenceexception
hdl
kaggle
batch-rename
uislider
acl
raima
running-object-table
echosign
openbr
locks
es6-modules
netbios
python-2.x
sca
cloudera-manager
cups
cargo
imgur
grails-spring-security
uipickerview
hdiv
sendinput
non-linear-regression
redisson
android-webservice
winmerge
scala-collections
palindrome
clrs
alertify
.when
prefetch
mifos
ipywidgets
logical
dcount
system.web.optimization
clp
dmarc
django-testing
meld
powerpoint-2013
odp.net-managed
uibinder
facebook-ios-sdk
jeasyui
jemdoc
voronoi
odesk
cfwheels
netdatacontractserializer
swagger-maven-plugin
angular-amd
physicsjs
quercus
prism-4
nhibernate-criteria
utf8-decode
device-admin
multivariate-testing
nachos
prism.js
thruway
pageviews
iosched
mousemotionlistener
void-pointers
aero
linkbutton
lynx
story
playorm
pageheap
image-scanner
affinetransform
gwt-celltable
will-paginate
airprint
odac
pinax
self-tracking-entities
projectpier
xap
rootkit
account-management

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App