Search code examples
pythonmacosnspr

Mac OS - Failed to install python-spidermonkey because nspr not found


Trying to install python-spidermonkey using pip on my Mac OS, failed to do so because it's missing nspr:

$ pip install python-spidermonkey
Downloading/unpacking python-spidermonkey
  Running setup.py egg_info for package python-spidermonkey
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/Users/smin/ENV/build/python-spidermonkey/setup.py", line 186, in <module>
        **platform_config()
      File "/Users/smin/ENV/build/python-spidermonkey/setup.py", line 143, in platform_config
        return nspr_config(config=config)
      File "/Users/smin/ENV/build/python-spidermonkey/setup.py", line 87, in nspr_config
        return pkg_config("nspr", config)
      File "/Users/smin/ENV/build/python-spidermonkey/setup.py", line 59, in pkg_config
        raise RuntimeError("No package configuration found for: %s" % pkg_name)
    RuntimeError: No package configuration found for: nspr
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/Users/shengjiemin/work/Ceilo-ENV/build/python-spidermonkey/setup.py", line 186, in <module>

    **platform_config()

  File "/Users/smin/rmonkey/setup.py", line 143, in platform_config

    return nspr_config(config=config)

  File "/Users/smin/ENV/build/python-spidermonkey/setup.py", line 87, in nspr_config

    return pkg_config("nspr", config)

  File "/Users/smin/ENV/build/python-spidermonkey/setup.py", line 59, in pkg_config

    raise RuntimeError("No package configuration found for: %s" % pkg_name)

RuntimeError: No package configuration found for: nspr

----------------------------------------
Command python setup.py egg_info failed with error code 1 in /Users/smin/ENV/build/python-spidermonkey

I then tried to install nspr:

sudo port install nspr

but it didn't make any difference, still the same error. Any ideas?


Solution

  • Finally I got this fixed by myself by following the thread here :

    http://davisp.lighthouseapp.com/projects/26898/tickets/38-trouble-installing-on-mac-os-x-107

    Two steps:

    1.move the files from the Darwin-XXX folder inside spidermonkey to spider monkey/libjs to get through this error.

    cd /home/smin/virt-ENV/build/python-spidermonkey/spidermonkey
    mv Darwin-i386/* libjs/
    

    2.Make the change below in the file: libjs/jsutil

    from:

    typedef int js_static_assert_line##line[(condition) ? 1 : -1]
    

    to:

    typedef int js_static_assert_line##line[(condition) ? 1 : 0]