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

**URL:** <https://brian.discourse.group/t/typeerror-array-of-type-long-required-array-of-type-long-long-given/218>\
**Category:** Support\
**Created:** [25 November 2020 04:53 UTC](https://brian.discourse.group/t/typeerror-array-of-type-long-required-array-of-type-long-long-given/218 "2020-11-25T04:53:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![chatterboy](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/chatterboy/32/104_2.png) [@chatterboy](https://brian.discourse.group/u/chatterboy)\
**Post date:** [25 November 2020 04:53 UTC](https://brian.discourse.group/t/typeerror-array-of-type-long-required-array-of-type-long-long-given/218/1 "2020-11-25T04:53:30Z")

</div>

# 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](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.

```auto
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)

```auto
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

```

---

<div class="post-metadata">

**Author:** ![mstimberg](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/mstimberg/32/11_2.png) [@mstimberg](https://brian.discourse.group/u/mstimberg)\
**Post date:** [25 November 2020 08:59 UTC](https://brian.discourse.group/t/typeerror-array-of-type-long-required-array-of-type-long-long-given/218/2 "2020-11-25T08:59:32Z")

</div>

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](https://briansimulator.org) and [https://brian2.readthedocs.io](https://brian2.readthedocs.io). Brian 2’s [CUBA example](https://brian2.readthedocs.io/en/stable/examples/CUBA.html) 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.

---

<div class="post-metadata">

**Author:** ![chatterboy](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/chatterboy/32/104_2.png) [@chatterboy](https://brian.discourse.group/u/chatterboy)\
**Post date:** [26 November 2020 09:07 UTC](https://brian.discourse.group/t/typeerror-array-of-type-long-required-array-of-type-long-long-given/218/3 "2020-11-26T09:07:04Z")

</div>

Okay. Thank you 🙂

I will do something in Brian 2.

---

<div class="post-metadata">

**Author:** ![GEB72](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/geb72/32/566_2.png) [@GEB72](https://brian.discourse.group/u/GEB72)\
**Post date:** [23 February 2023 01:25 UTC](https://brian.discourse.group/t/typeerror-array-of-type-long-required-array-of-type-long-long-given/218/4 "2023-02-23T01:25:31Z")

</div>

Hey @mstimberg I actually need to run some code that uses Brian1, [GitHub - peter-u-diehl/stdp-mnist](https://github.com/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?

---

<div class="post-metadata">

**Author:** ![mstimberg](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/mstimberg/32/11_2.png) [@mstimberg](https://brian.discourse.group/u/mstimberg)\
**Post date:** [23 February 2023 09:21 UTC](https://brian.discourse.group/t/typeerror-array-of-type-long-required-array-of-type-long-long-given/218/5 "2023-02-23T09:21:04Z")

</div>

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](https://brian2.readthedocs.io/en/latest/introduction/brian1_to_2/container.html)? 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"](https://github.com/sdpenguin/Brian2STDPMNIST) – 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](https://brian.discourse.group/t/unsupervised-learning-of-digit-recognition-using-spike-timing-dependent/189)

---

<div class="post-metadata">

**Author:** ![GEB72](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/geb72/32/566_2.png) [@GEB72](https://brian.discourse.group/u/GEB72)\
**Post date:** [23 February 2023 22:20 UTC](https://brian.discourse.group/t/typeerror-array-of-type-long-required-array-of-type-long-long-given/218/6 "2023-02-23T22:20:23Z")

</div>

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