Synapse function error message

Description of problem

I was having problems adding synapses into a neural network I am working on. So, I went back to the tutorials on brian2 website to see if I was missing something, I didn’t see anything different so I ran the code from the synapse tutorial page, and I got the same error message: “ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject”

Not sure what this means.

Minimal code to reproduce problem

S = Synapses(G, G, on_pre=‘v_post += 0.2’)
This is the line of code which is apparently producing that error message.

What you have aready tried

Checked the lengths of the arrays to see if they match (they do), not sure what else I can do, this line of code is off the brian2 tutorial page too.
Any help greatly appreciated!

Expected output (if relevant)

Actual output (if relevant)

Full traceback of error (if relevant)

Hi Lann,

I think this error has to do with your brian install rather than any specific code.
Check out Marcel’s solution in this other thread:

-Adam

2 Likes

Hi @lann591 , it actually turns out there was a bug in the Python wheel (the file used for install if you use pip) which made it incompatible with numpy versions < 1.22. If you used pip to install brian2, and your numpy version is not the most recent one, this would explain your error. In that case, you can use one of the two workarounds I posted on this github issue.

1 Like