Question

I am trying to use pypy. My python scripts are using numpy. So when I used pypy 1.9.0 it showed me this:

"The 'numpy' module of PyPy is in-development and not complete. "
ImportError: The '`numpy' module` of PyPy is in-development and not complete. To try it out anyway, you can either import from 'numpypy', or just write 'import numpypy' first in your program and then import from 'numpy' as usual.

So I used import numpypy and then ran my script. I got this error:

File "customecode.py", line 97, in dist_new
    dlat = radians(p2[..., 0] - p1[..., 0])
TypeError: expected integer, got Ellipsis object

I couldn't find anything on this kind of error. Although script is running fine when I use python. So my guess is that may be pypy still don't support everything which is there on numpy.

I found this link on pypy-numpy update. So I install pypy 2.2.1 http://morepypy.blogspot.in/2013/11/numpy-status-update.html In this link following instructions are given for installing numpy for pypy:

git clone https://bitbucket.org/pypy/numpy.git
cd numpy
pypy setup.py install

after running pypy setup.py installI got this type error:

Traceback (most recent call last):
  File "app_main.py", line 51, in run_toplevel
  File "setup.py", line 239, in <module>
    setup_package()
  File "setup.py", line 231, in setup_package
    setup(**metadata)
  File "/home/administrator/numpy/numpy/distutils/core.py", line 169, in setup
    return old_setup(**new_attr)
  File "/usr/lib/pypy/lib-python/2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/pypy/lib-python/2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/pypy/lib-python/2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/administrator/numpy/numpy/distutils/command/install.py", line 57, in run
    r = old_install.run(self)
  File "/usr/lib/pypy/lib-python/2.7/distutils/command/install.py", line 613, in run
    self.run_command('build')
  File "/usr/lib/pypy/lib-python/2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/pypy/lib-python/2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/administrator/numpy/numpy/distutils/command/build.py", line 39, in run
    old_build.run(self)
  File "/usr/lib/pypy/lib-python/2.7/distutils/command/build.py", line 127, in run
    self.run_command(cmd_name)
  File "/usr/lib/pypy/lib-python/2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/pypy/lib-python/2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/administrator/numpy/numpy/distutils/command/build_src.py", line 153, in run
    self.build_sources()
  File "/home/administrator/numpy/numpy/distutils/command/build_src.py", line 164, in build_sources
    self.build_library_sources(*libname_info)
  File "/home/administrator/numpy/numpy/distutils/command/build_src.py", line 299, in build_library_sources
    sources = self.generate_sources(sources, (lib_name, build_info))
  File "/home/administrator/numpy/numpy/distutils/command/build_src.py", line 386, in generate_sources
    source = func(extension, build_dir)
  File "numpy/core/setup.py", line 678, in get_mathlib_info
    st = config_cmd.try_link('int main(void) { return 0;}')
  File "/usr/lib/pypy/lib-python/2.7/distutils/command/config.py", line 248, in try_link
    self._check_compiler()
  File "/home/administrator/numpy/numpy/distutils/command/config.py", line 46, in _check_compiler
    old_config._check_compiler(self)
  File "/usr/lib/pypy/lib-python/2.7/distutils/command/config.py", line 103, in _check_compiler
    customize_compiler(self.compiler)
  File "/usr/lib/pypy/lib-python/2.7/distutils/ccompiler.py", line 44, in customize_compiler
    cpp = cc + " -E"           # not always
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

I want to use pypy 2.2.1 with whatever development of numpy provided there. Any help with the installation of numpy for pypy is appreciated.

Was it helpful?

Solution

In PyPy 2.2.1, the file lib-python/2.7/distutils/ccompiler.py does not contain any function called customize_compiler() and line 44 is not like that. My guess is that your version of PyPy's standard library has been tweaked by your Linux distribution in a way that makes it crash in your particular case.

I can only suggest that you try to get the "official" PyPy 2.2.1 and compare the results.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top