# AttributeError on VSCode, Mac

**URL:** <https://brian.discourse.group/t/attributeerror-on-vscode-mac/1498>\
**Category:** Support\
**Created:** [15 October 2025 14:49 UTC](https://brian.discourse.group/t/attributeerror-on-vscode-mac/1498 "2025-10-15T14:49:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lpiovano](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@lpiovano](https://brian.discourse.group/u/lpiovano)\
**Post date:** [15 October 2025 14:49 UTC](https://brian.discourse.group/t/attributeerror-on-vscode-mac/1498/1 "2025-10-15T14:49:02Z")

</div>

# Description of problem

I was trying to model a simple group of 3 neurons with a sinusoidal input current, based on the [example from the brian2 documentation](https://brian2.readthedocs.io/en/stable/user/input.html#explicit-equations). I’m using Visual Studio Code (version 1.91.1) on a Mac (Sonoma 14.6.1). I get an AttributeError as soon as I try to do this (add an expression for the input current), while networks with no input run just fine. The same code works on Google Colab.

# Minimal code to reproduce problem

```auto
import numpy as np
import matplotlib.pyplot as plt
from brian2 import *

start_scope()

G = NeuronGroup(3, '''dv/dt = (-v + I)/(10*ms) : 1
                        rates : Hz # each neuron's input has a different rate
                        size : 1 # and a different amplitude
                        I = size*sin(2*pi*rates*t) : 1''')
G.rates = '10*Hz + i*Hz'
G.size = '(100-i)/100. + 0.1'

m = StateMonitor(G, ('v'), record=True)

net = Network(G)
net.add(m)

net.run(3*second)

m.v

```

# What you have aready tried

Updating brian2.

# Expected output (if relevant)

The code should return an array like this:

> array([[ 0.00000000e+00, 0.00000000e+00, 6.91145836e-05, …,  
> -5.11718061e-01, -5.06808213e-01, -5.01878357e-01],  
> [ 0.00000000e+00, 0.00000000e+00, 7.53347921e-05, …,  
> -5.26665557e-01, -5.21624891e-01, -5.16559308e-01],  
> [ 0.00000000e+00, 0.00000000e+00, 8.14293100e-05, …,  
> -5.36499500e-01, -5.31378774e-01, -5.26227840e-01]])

This is what happens on Colab.

# Actual output (if relevant)

(See error message below.)

# Full traceback of error (if relevant)

> File ~/Library/Python/3.9/lib/python/site-packages/brian2/parsing/rendering.py:64 in render\_node  
> return getattr(self, methname)(node)
> 
> File ~/Library/Python/3.9/lib/python/site-packages/brian2/parsing/rendering.py:100 in render\_Call  
> if node.func.id in self.auto\_vectorise:
> 
> AttributeError: ‘Attribute’ object has no attribute ‘id’
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
> 
> File ~/Library/Python/3.9/lib/python/site-packages/IPython/core/interactiveshell.py:3550 in run\_code  
> exec(code\_obj, self.user\_global\_ns, self.user\_ns)
> 
> Cell In[5], line 11  
> G.rates = ‘10_Hz + i_Hz’
> 
> File ~/Library/Python/3.9/lib/python/site-packages/brian2/groups/neurongroup.py:904 in **setattr**  
> Group. **setattr** (self, key, value, level=1)
> 
> File ~/Library/Python/3.9/lib/python/site-packages/brian2/groups/group.py:457 in **setattr**  
> var.get\_addressable\_value\_with\_unit(name, self).set\_item(
> 
> File ~/Library/Python/3.9/lib/python/site-packages/brian2/core/variables.py:976 in set\_item  
> self.set\_with\_expression\_conditional(
> 
> File ~/Library/Python/3.9/lib/python/site-packages/brian2/core/base.py:335 in device\_override\_decorated\_function  
> return func(\*args, \*\*kwds)
> 
> File ~/Library/Python/3.9/lib/python/site-packages/brian2/core/variables.py:1141 in set\_with\_expression\_conditional  
> codeobj = create\_runner\_codeobj(
> 
> File ~/Library/Python/3.9/lib/python/site-packages/brian2/codegen/codeobject.py:484 in create\_runner\_codeobj  
> return device.code\_object(
> 
> File ~/Library/Python/3.9/lib/python/site-packages/brian2/devices/device.py:324 in code\_object  
> scalar\_code, vector\_code, kwds = generator.translate(
> 
> File ~/Library/Python/3.9/lib/python/site-packages/brian2/codegen/generators/base.py:303 in translate  
> translated = self.translate\_statement\_sequence(
> 
> File ~/Library/Python/3.9/lib/python/site-packages/brian2/codegen/generators/base.py:142 in translate\_statement\_sequence  
> scalar\_code[name] = self.translate\_one\_statement\_sequence(
> 
> File ~/Library/Python/3.9/lib/python/site-packages/brian2/codegen/generators/numpy\_generator.py:319 in translate\_one\_statement\_sequence  
> line = self.translate\_statement(stmt)
> 
> File ~/Library/Python/3.9/lib/python/site-packages/brian2/codegen/generators/numpy\_generator.py:73 in translate\_statement  
> code = f"{var} {op} {self.translate\_expression(expr)}"
> 
> File ~/Library/Python/3.9/lib/python/site-packages/brian2/codegen/generators/numpy\_generator.py:38 in translate\_expression  
> NumpyNodeRenderer(auto\_vectorise=self.auto\_vectorise)
> 
> File ~/Library/Python/3.9/lib/python/site-packages/brian2/parsing/rendering.py:58 in render\_expr  
> return self.render\_node(node.body)
> 
> File ~/Library/Python/3.9/lib/python/site-packages/brian2/parsing/rendering.py:64 in render\_node  
> return getattr(self, methname)(node)
> 
> File ~/Library/Python/3.9/lib/python/site-packages/brian2/parsing/rendering.py:147 in render\_BinOp  
> return self.render\_BinOp\_parentheses(node.left, node.right, node.op)
> 
> File ~/Library/Python/3.9/lib/python/site-packages/brian2/parsing/rendering.py:141 in render\_BinOp\_parentheses  
> f"{self.render\_element\_parentheses(left)} "
> 
> File ~/Library/Python/3.9/lib/python/site-packages/brian2/parsing/rendering.py:118 in render\_element\_parentheses  
> return self.render\_node(node)
> 
> File ~/Library/Python/3.9/lib/python/site-packages/brian2/parsing/rendering.py:78 in render\_node  
> raise SyntaxError(
> 
> File  
> SyntaxError: Brian equations/expressions do not support the ‘Call’ syntax.

---

<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:** [15 October 2025 15:07 UTC](https://brian.discourse.group/t/attributeerror-on-vscode-mac/1498/2 "2025-10-15T15:07:57Z")

</div>

Hi @lpiovano. Thank you for the clear and detailed report. The issue is most likely an incompatibility with Python 3.9, which we no longer support in Brian. The last version that still supported Python 3.9 was Brian 2.6 – you’d either have to use that version of Brian or upgrade your Python version.

---

<div class="post-metadata">

**Author:** ![lpiovano](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@lpiovano](https://brian.discourse.group/u/lpiovano)\
**Post date:** [16 October 2025 12:03 UTC](https://brian.discourse.group/t/attributeerror-on-vscode-mac/1498/3 "2025-10-16T12:03:55Z")

</div>

Thank you for the swift response! After trying different python versions, I found that 3.11 solved the issue. It should be noted for anyone having the same problem, though, that any python 3.12+ won’t work due to the removal of distutils.

---

<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:** [16 October 2025 12:18 UTC](https://brian.discourse.group/t/attributeerror-on-vscode-mac/1498/4 "2025-10-16T12:18:27Z")

</div>

> [@lpiovano](#):
>
> It should be noted for anyone having the same problem, though, that any python 3.12+ won’t work due to the removal of distutils.

Could you give more details about why you think this is the case? Which version of Brian are you using? The latest Brian version (2.9.0) works with all Python versions ≥3.11 (for 3.14, we do not yet have a stable release with wheel files, but it can be installed from source).

---

<div class="post-metadata">

**Author:** ![lpiovano](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@lpiovano](https://brian.discourse.group/u/lpiovano)\
**Post date:** [16 October 2025 12:50 UTC](https://brian.discourse.group/t/attributeerror-on-vscode-mac/1498/5 "2025-10-16T12:50:09Z")

</div>

I was trying to use 2.9 with python 3.14 in a virtual environment but ended up being unable to install the distutils package (which was required by some brian2 functions). After looking into it, [I read that distutils was removed in 3.12](https://stackoverflow.com/questions/77233855/why-did-i-get-an-error-modulenotfounderror-no-module-named-distutils) so I assumed I had the same problem. Perhaps it’s something else specific to VSCode, macOS or my venv (made with uv)?

---

<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:** [16 October 2025 13:08 UTC](https://brian.discourse.group/t/attributeerror-on-vscode-mac/1498/6 "2025-10-16T13:08:46Z")

</div>

The situation with `distutils` is a bit confusing: Brian _does_ import `distutils` in a few places, but it doesn’t need the `distutils` _package_ – instead, it depends on `setuptools`, which distributes a patched version of `distutils` ([9. API Reference - setuptools 80.9.0 documentation](https://setuptools.pypa.io/en/latest/deprecated/distutils/apiref.html)). Did your virtual environment have `setuptools` installed ? I am on Linux, but for me `uv venv --python 3.14`, activating the venv and then using `uv pip install brian2` worked, and Brian ran without issues.
