2

Trying to play with some jupyter notebook, I have an issue with the bson module which seams not available as reported in the error: "ImportError: No module named 'bson'"

I'm running jupyter notebook 4.3.0 over a python 2.7 kernel which is available in a dedicated virtual environment. I tried to install manually the bson module through a simple "conda install bson" but it's not in the official/standard repo so I had to install OpenMDAO/bson. Finally, it didn't change the issue. I understand that the module might come from the pymongo package so I tried to install with the same result.

Any hint here? What's the link between bson and pymongo?

vestland
  • 55,229
  • 37
  • 187
  • 305
gdupont
  • 1,660
  • 18
  • 27

1 Answers1

5

You can advise this answer: import error: no module named bson

Which states that:

If you don't get the no module named bson error but the EPOCH_AWARE import error, this is due to a name clash between bson and pymongo.
In this case, you should do these in order:

sudo pip uninstall bson
sudo pip uninstall pymongo
sudo pip install pymongo

In your case, try to start with a fresh virtualenv and do the above mentioned in the given order

That also answers the link between bson and pymongo.

John Moutafis
  • 22,254
  • 11
  • 68
  • 112
  • Already seen that question and tested this. Tht'a why I created the question ;-). I didn't tried on a fresh virtualenv though. – gdupont Mar 14 '17 at 16:08
  • Do that and comment if it goes as planed :) – John Moutafis Mar 14 '17 at 17:59
  • Gave it another try and finally I got it to work by starting again from a fresh virtual env and triple checking this one was correctly installed within jupyter notebook with this http://help.pythonanywhere.com/pages/IPythonNotebookVirtualenvs – gdupont Mar 15 '17 at 22:24
  • Good to know mate :) Happy coding! – John Moutafis Mar 15 '17 at 22:25