TypeError: Array of type 'long' required. Array of type 'long long' given

Description of problem

I installed python(2.7.18), brian(1.4.4), and scipy(1.2.3) and then I tried to run a code in https://brian.readthedocs.io/en/stable/introduction.html. The error “TypeError: Array of type ‘long’ required. Array of type ‘long long’ given” is occurred.

Minimal code to reproduce problem

This is a code in the above link.

from brian import *
eqs='''
dv/dt = (ge+gi-(v+49*mV))/(20*ms) : volt
dge/dt = -ge/(5*ms) : volt
dgi/dt = -gi/(10*ms) : volt
'''
P=NeuronGroup(4000,model=eqs,threshold=-50*mV,reset=-60*mV)
P.v=-60*mV
Pe=P.subgroup(3200)
Pi=P.subgroup(800)
Ce=Connection(Pe,P,'ge',weight=1.62*mV,sparseness=0.02)
Ci=Connection(Pi,P,'gi',weight=-9*mV,sparseness=0.02)
M=SpikeMonitor(P)
run(1*second)
raster_plot(M)
show()

What you have aready tried

I tried to change the versions of python, brian, and scipy. But, I cannot resolve this issue.

Full traceback of error (if relevant)

Traceback (most recent call last):
  File "C:/Users/chansik/github/test_brian/main.py", line 14, in <module>
    run(1*second)
  File "C:\ProgramData\Anaconda3\envs\brian\lib\site-packages\brian\network.py", line 938, in run
    report=report, report_period=report_period)
  File "C:\ProgramData\Anaconda3\envs\brian\lib\site-packages\brian\network.py", line 574, in run
    self.update()
  File "C:\ProgramData\Anaconda3\envs\brian\lib\site-packages\brian\network.py", line 518, in update
    f()
  File "C:\ProgramData\Anaconda3\envs\brian\lib\site-packages\brian\neurongroup.py", line 516, in update
    self.LS.push(spikes) # Store spikes
  File "C:\ProgramData\Anaconda3\envs\brian\lib\site-packages\brian\utils\ccircular\ccircular.py", line 128, in push
    def push(self, *args): return _ccircular.SpikeContainer_push(self, *args)
TypeError: Array of type 'long' required.  Array of type 'long long' given

Hi @chatterboy. The version of Brian you are using (Brian 1.x) has not been updated any more since a couple of years. It has been replaced by Brian 2, which comes with a range of new features and clearer syntax, while keeping most of it backwards-compatible. Therefore, if this is not about running some old existing Brian 1 code, please install Brian 2 instead. You can find more information on https://briansimulator.org and https://brian2.readthedocs.io. Brian 2’s CUBA example is very similar to the example code from the Brian 1 introduction.

Also note that Brian 1 only works on Python 2 whereas the recent versions of Brian 2 require Python 3.

1 Like

Okay. Thank you :slight_smile:

I will do something in Brian 2.

Hey @mstimberg I actually need to run some code that uses Brian1, GitHub - peter-u-diehl/stdp-mnist. I tried refactoring to Python 3 and Brian2 but that was a nightmare. I am getting the same error. Any ideas?

Hi @GEB72. Unfortunately I won’t be able to help with the specific error – from the error message I’d say it has to do with an incompatibility of the code for a 64bit Windows, but I can’t dig into this any further. Did you try using the Brian1 docker image: Container image for Brian 1 — Brian 2 2.5.1.post0.dev88 documentation? I think it should fix the issue (since in the docker container runs on Linux), but I am not 100% sure either.

All that said, several users have tried adapting that code to Brian 2, see e.g. GitHub - sdpenguin/Brian2STDPMNIST: Brian 2 version of Paper "Unsupervised Learning of digit recognition using STDP" – it might be worth using that straight away. Also have a look at the discussion here: Unsupervised learning of digit recognition using spike-timing-dependent

Thanks for the reply, this makes my life so much easier! Always great to have people in these communities who know their shit.

1 Like