45

I'm trying to run a command to install bespinclient on my Windows laptop but every time I execute the command python bootstrap.py --no-site-packages, I get an error saying:

ImportError: No module named simplejson

I'm using Mozilla build tools to run these Linux commands.

Michael Petrotta
  • 56,954
  • 26
  • 136
  • 173
Tony
  • 459
  • 1
  • 4
  • 3

5 Answers5

89

That means you must install simplejson. On newer versions of python, it was included by default into python's distribution, and renamed to json. So if you are on python 2.6+ you should change all instances of simplejson to json.

For a quick fix you could also edit the file and change the line:

import simplejson

to:

import json as simplejson

and hopefully things will work.

mlissner
  • 14,662
  • 15
  • 82
  • 149
nosklo
  • 193,422
  • 54
  • 273
  • 281
9

@noskio is correct... it just means that simplejson isn't found on your system and you need to install it for Python older than 2.6. one way is to use the setuptools easy_install tool. with it, you can install it as easily as: easy_install simplejson

UPDATE (Feb 2014): this is probably old news to many of you, but pip is a more modern tool that works in a similar way (i.e., pip install simplejson), only it can also uninstall apps.

wescpy
  • 8,970
  • 2
  • 46
  • 43
  • Despite what nosklo said about newer versions of python... pip install simplejson worked perfectly. – Ray Foss Aug 25 '15 at 23:40
  • 1
    Oh yes, for sure, that will still work because simplejson still exists (It's the externally-maintained name.) The only "problem" for those on 2.6+ is that now you have two (nearly) identical libraries on your hard drive. – wescpy Sep 01 '15 at 23:51
5

On Ubuntu/Debian, you can install it with apt-get install python-simplejson

mjallday
  • 8,858
  • 8
  • 48
  • 70
Panco
  • 59
  • 1
  • 1
  • Whilst it can be troublesome to set it up, it is possible to use pip on windows. I know it can work as I've got pip running on my windows machine. Here are a couple of starting points: http://stackoverflow.com/questions/4750806/how-to-install-pip-on-windows http://arunrocks.com/guide-to-install-python-or-pip-on-windows/ – Andrew Calder Nov 30 '14 at 19:58
4

Sometimes there is permission errors. Try:

sudo pip install simplejson

Hope it helps.

0

For anyone coming across this years later:

TL;DR check your pip version (2 vs 3)

I had this same issue and it was not fixed by running pip install simplejson despite pip insisting that it was installed. Then I realized that I had both python 2 and python 3 installed.

> python -V
Python 2.7.12
> pip -V
pip 9.0.1 from /usr/local/lib/python3.5/site-packages (python 3.5)

Installing with the correct version of pip is as easy as using pip2:

> pip2 install simplejson

and then python 2 can import simplejson fine.

c0d3rman
  • 652
  • 6
  • 14