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

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

Categories

HOME
apache-nifi
functional-programming
long-integer
enums
key
celery
yql
gentelella
vue-resource
navigation
jint
openfoam
wagtail
timber
lc3
erd
fbloginview
phpstorm-2017.1
vimeo
sslhandshakeexception
freertos
google-tasks-api
jaspersoft-studio
renderscript
home
error-logging
jpa-2.1
tortoisemerge
onchange
npoi
laravel-4.2
cloveretl
autoencoder
buildforge
testlink
installanywhere
microkernel
stat
game-center
raytracing
android-5.0-lollipop
supertest
uiautomatorviewer
non-linear-regression
amazon-elastic-beanstalk
htmlspecialchars
algebra
nivo-slider
logical
fuzzer
right-to-left
facebook-ios-sdk
persistent-object-store
flipclock
univocity
variable-length-array
html.actionlink
directx-9
espresso
wicked-gem
mgwt
rfc5545
mxe
python-c-extension
tkx
nhibernate-criteria
juttle
adhoc-polymorphism
vs-unit-testing-framework
window-resize
inputbox
lumia-imaging-sdk
category-theory
coding-efficiency
code-complexity
.htpasswd
hyperloglog
reference-counting
proxy-server
san
notifyjs
insertion
jquery-cycle
xalan
django-apps
expression-web
motodev-studio
datacontracts
principles
iphone-sdk-4.3
google-translator-toolkit
fxruby
sqlsitemapprovider
parentid

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App