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

Try to get Nengo working with PyPy #1166

wants to merge 1 commit into from

Try to get Nengo working with PyPy #1166

wants to merge 1 commit into from


Copy link

@jgosmann jgosmann commented Sep 7, 2016

Motivation and context:
These are just explaratory changes to see if we can get Nengo working with PyPy. So far I commented out all setflags calls which are not supported by PyPy's NumPy, but are only used to prevent writing of things that should be readonly. So commenting this out should not be a problem, though for a production version we might find a better solution.

With these changes I'm hitting this NotImplementedError:

Traceback (most recent call last):
  File "", line 9, in <module>
    with nengo.Simulator(model) as sim:
  File "/home/jgosmann/Documents/projects/nengo/nengo/", line 132, in __init__
  File "/home/jgosmann/Documents/projects/nengo/nengo/builder/", line 119, in build
    return, obj, *args, **kwargs)
  File "/home/jgosmann/Documents/projects/nengo/nengo/builder/", line 211, in build
    return[obj_cls](model, obj, *args, **kwargs)
  File "/home/jgosmann/Documents/projects/nengo/nengo/builder/", line 91, in build_network
  File "/home/jgosmann/Documents/projects/nengo/nengo/builder/", line 119, in build
    return, obj, *args, **kwargs)
  File "/home/jgosmann/Documents/projects/nengo/nengo/builder/", line 211, in build
    return[obj_cls](model, obj, *args, **kwargs)
  File "/home/jgosmann/Documents/projects/nengo/nengo/builder/", line 273, in build_connection
    signal =, signal)
  File "/home/jgosmann/Documents/projects/nengo/nengo/builder/", line 119, in build
    return, obj, *args, **kwargs)
  File "/home/jgosmann/Documents/projects/nengo/nengo/builder/", line 211, in build
    return[obj_cls](model, obj, *args, **kwargs)
  File "/home/jgosmann/Documents/projects/nengo/nengo/builder/", line 149, in build_synapse
    synapse, sig_in, sig_out, model.time, mode='update'))
  File "/home/jgosmann/Documents/projects/nengo/nengo/builder/", line 107, in add_op
    op.make_step(signals, self.dt, np.random)
  File "/home/jgosmann/Documents/projects/nengo/nengo/builder/", line 80, in make_step
    step_f = self.process.make_step(shape_in, shape_out, dt, rng)
  File "/home/jgosmann/Documents/projects/nengo/nengo/", line 361, in make_step
    shape_in, shape_out, dt, rng, y0=y0, dtype=dtype, **kwargs)
  File "/home/jgosmann/Documents/projects/nengo/nengo/", line 219, in make_step
    num, den, _ = cont2discrete((num, den), dt, method=method)
  File "/home/jgosmann/Documents/projects/nengo/nengo/utils/", line 451, in cont2discrete
    return ss2tf(sysd[0], sysd[1], sysd[2], sysd[3]) + (dt,)
  File "/home/jgosmann/Documents/projects/nengo/nengo/utils/", line 326, in ss2tf
    den = poly(A)
  File "/home/jgosmann/.virtualenvs/pypy/site-packages/numpy/lib/", line 143, in poly
  File "/home/jgosmann/.virtualenvs/pypy/site-packages/numpy/core/", line 1005, in convolve
    return multiarray.correlate(a, v[::-1], mode)
  File "/home/jgosmann/.virtualenvs/pypy/site-packages/numpy/core/", line 83, in tmp
    raise NotImplementedError("%s not implemented yet" % func)
NotImplementedError: correlate not implemented yet

I'm not familiar enough with the filtering code to figure out how it could be implemented without using that missing function. So if no one else takes a stab at it, we probably have to wait until the PyPy people implement it.

How has this been tested?
To test this, I used PyEnv to install PyPy. These are the steps:

  1. pyenv install pypy-5.4.0
  2. mkvirtualenv -p pypy pypy
  3. workon pypy
  4. git clone
  5. cd numpy; pypy install
  6. Go to nengo directory and pypy develop

Then I ran this script:

import nengo

with nengo.Network() as model:
    a = nengo.Ensemble(10, 1)
    b = nengo.Ensemble(10, 1)
    nengo.Connection(a, b)

with nengo.Simulator(model) as sim:

How long should this take to review?

Not ready for review.

Where should a reviewer start?

Types of changes:

  • New feature (non-breaking change which adds functionality)


  • I have read the CONTRIBUTING.rst document.
  • I have updated the documentation accordingly.
  • I have included a changelog entry.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Still to do:

Copy link
Collaborator Author

@jgosmann jgosmann commented Oct 6, 2017

PyPy v5.9 was just released and claims to support NumPy. Maybe it's time to give this another shot.

Copy link
Collaborator Author

@jgosmann jgosmann commented Nov 7, 2018

@drasmuss I don't think I'll invest time into this in the foreseeable future.

Copy link

@drasmuss drasmuss commented Nov 7, 2018

Sounds good. I'll close it for now, but anyone interested in working on this feel free to re-open.

@drasmuss drasmuss closed this Nov 7, 2018
@tbekolay tbekolay deleted the pypy branch Sep 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Successfully merging this pull request may close these issues.

None yet

4 participants