Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

importing json_utils issues ImportError #19

Closed
lhonda opened this issue Sep 6, 2012 · 9 comments
Closed

importing json_utils issues ImportError #19

lhonda opened this issue Sep 6, 2012 · 9 comments

Comments

@lhonda
Copy link

lhonda commented Sep 6, 2012

In [2]: from bson import json_util

ImportError Traceback (most recent call last)
in ()
----> 1 from bson import json_util

/home/lhonda/.virtualenvs/test/local/lib/python2.7/site-packages/bson/json_util.py in ()
84
85 import bson
---> 86 from bson import EPOCH_AWARE
87 from bson.binary import Binary
88 from bson.code import Code

ImportError: cannot import name EPOCH_AWARE

In [3]:

@elimisteve
Copy link

I'm having this problem as well. Anyone find a fix?

@koalalorenzo
Copy link

The same problem here! With pymongo it works fine, but when I installed bson directly via pip ( pip install bson ) it gave me this problem!

to fix this I've uninstalled bson and pymongo and then reinstalled only pymongo! This is just a workaround... not a real fix 👎

@merwok
Copy link

merwok commented Mar 8, 2013

The problem is that there are two projects (i.e. things you install with pip install project) that have a conflict in Python package names (things you import). pymongo installs pymongo, gridfs and bson, and this bson project also installs a bson package. PyPI does not detect these conflicts; installers could but I think they don’t.

The best thing for users would be for this bson project to rename the Python package it installs.

@wshayes
Copy link

wshayes commented Feb 4, 2015

@merwok's response is correct. To fix ...

Uninstall and reinstall:

pip uninstall bson
pip uninstall pymongo
pip install pymongo

The conflicting bson package overwrites the pymongo bson package. Need to clean it and re-install pymongo.

@cosimino81
Copy link

cosimino81 commented May 23, 2018

Hi @wshayes ,
I followe your procedure:
pip uninstall bson
pip uninstall pymongo
pip install pymongo

But I get a new error:

`ImportError Traceback (most recent call last)
in ()
1 import boto3
2 import json
----> 3 from bson import json_util

~\Anaconda3\lib\site-packages\bson\json_util.py in ()
123 import json
124
--> 125 from pymongo.errors import ConfigurationError
126
127 import bson

~\Anaconda3\lib\site-packages\pymongo_init_.py in ()
75 """Current version of PyMongo."""
76
---> 77 from pymongo.collection import ReturnDocument
78 from pymongo.common import (MIN_SUPPORTED_WIRE_VERSION,
79 MAX_SUPPORTED_WIRE_VERSION)

~\Anaconda3\lib\site-packages\pymongo\collection.py in ()
21 from bson.code import Code
22 from bson.objectid import ObjectId
---> 23 from bson.py3compat import (_unicode,
24 abc,
25 integer_types,

ImportError: cannot import name 'abc'`

From here I don't know how to move forward.
Do you have any suggestion?
Thanks!

@merwok
Copy link

merwok commented May 23, 2018

That’s a different error that would need its own ticket to catch the attention of maintainers.

@Parkayun
Copy link
Member

pybson has not json_util. You may confuse with mongo's bson.
#41 will help you.

@onemadgeek
Copy link

If you're still getting this error:
uninstall pymongo and bson
install bson then pymongo

Anyone knows a better solution please add.

@arunima76
Copy link

pip install python -bsonstream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants