# The "exprel" function needs C99 compiler support while running COBAHH example

**URL:** https://brian.discourse.group/t/the-exprel-function-needs-c99-compiler-support-while-running-cobahh-example/275
**Category:** Support
**Created:** [30 January 2021 05:30 UTC](https://brian.discourse.group/t/the-exprel-function-needs-c99-compiler-support-while-running-cobahh-example/275 "2021-01-30T05:30:12Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![SudeshnaBora](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/sudeshnabora/32/140_2.png) [@SudeshnaBora](https://brian.discourse.group/u/SudeshnaBora)
#### Post date: [30 January 2021 05:30 UTC](https://brian.discourse.group/t/the-exprel-function-needs-c99-compiler-support-while-running-cobahh-example/275/1 "2021-01-30T05:30:12Z")

</div>

# Description of problem

While trying to run the COBAHH example getting the above stated error.

# Minimal code to reproduce problem

[https://brian2.readthedocs.io/en/stable/examples/COBAHH.html](https://brian2.readthedocs.io/en/stable/examples/COBAHH.html)

# What you have already tried

Tried this solution : [ZeroDivisionError when changing synaptic weights of large network with HH neurons](https://brian.discourse.group/t/zerodivisionerror-when-changing-synaptic-weights-of-large-network-with-hh-neurons/232)

**My OS:** Windows  
\*\*Brian2 version: \*\* brian2 2.4.2 py39h2e07f2f\_1  
\*\*gcc version: \*\* gcc version 8.1.0 (x86\_64-posix-seh-rev0, Built by MinGW-W64 project)

# Actual output (if relevant)

If adding :-

import brian2.codegen.cpp\_prefs  
brian2.codegen.cpp\_prefs.\_compiler\_supports\_c99 = True

Getting the output.

# Full traceback of error (if relevant)

ERROR Brian 2 encountered an unexpected error. If you think this is a bug in Brian 2, please report this issue either to the discourse forum at , or to the issue tracker at . Please include this file with debug information in your report: C:\Users\sudes\AppData\Local\Temp\brian\_debug\_cno58ko1.log Additionally, you can also include a copy of the script that was run, available at: C:\Users\sudes\AppData\Local\Temp\brian\_script\_gooe7wzq.py Thanks! [brian2]  
Traceback (most recent call last):  
File “E:\Programs\Anaconda\envs\venv\lib\site-packages\brian2\core\network.py”, line 897, in before\_run  
obj.before\_run(run\_namespace)  
File “E:\Programs\Anaconda\envs\venv\lib\site-packages\brian2\groups\group.py”, line 1143, in before\_run  
self.create\_code\_objects(run\_namespace)  
File “E:\Programs\Anaconda\envs\venv\lib\site-packages\brian2\groups\group.py”, line 1136, in create\_code\_objects  
code\_object = self.create\_default\_code\_object(run\_namespace)  
File “E:\Programs\Anaconda\envs\venv\lib\site-packages\brian2\groups\group.py”, line 1118, in create\_default\_code\_object  
self.codeobj = create\_runner\_codeobj(group=self.group,  
File “E:\Programs\Anaconda\envs\venv\lib\site-packages\brian2\codegen\codeobject.py”, line 441, in create\_runner\_codeobj  
return device.code\_object(owner=group,  
File “E:\Programs\Anaconda\envs\venv\lib\site-packages\brian2\devices\device.py”, line 297, in code\_object  
scalar\_code, vector\_code, kwds = generator.translate(abstract\_code,  
File “E:\Programs\Anaconda\envs\venv\lib\site-packages\brian2\codegen\generators\base.py”, line 262, in translate  
translated = self.translate\_statement\_sequence(scalar\_statements,  
File “E:\Programs\Anaconda\envs\venv\lib\site-packages\brian2\codegen\generators\cython\_generator.py”, line 208, in translate\_statement\_sequence  
kwds = self.determine\_keywords()  
File “E:\Programs\Anaconda\envs\venv\lib\site-packages\brian2\codegen\generators\cython\_generator.py”, line 364, in determine\_keywords  
user\_func = self.\_add\_user\_function(varname, var, added)  
File “E:\Programs\Anaconda\envs\venv\lib\site-packages\brian2\codegen\generators\cython\_generator.py”, line 220, in \_add\_user\_function  
func\_code = impl.get\_code(self.owner)  
File “E:\Programs\Anaconda\envs\venv\lib\site-packages\brian2\core\functions.py”, line 280, in get\_code  
self.availability\_check()  
File “E:\Programs\Anaconda\envs\venv\lib\site-packages\brian2\codegen\cpp\_prefs.py”, line 278, in **call**  
raise NotImplementedError('The “{}” function needs C99 compiler ’  
NotImplementedError: The “exprel” function needs C99 compiler support

The above exception was the direct cause of the following exception:

Traceback (most recent call last):  
File “E:\Documents\Sprekeler\cobahh.py”, line 57, in   
run(1 \* second, report=‘text’)  
File “E:\Programs\Anaconda\envs\venv\lib\site-packages\brian2\units\fundamentalunits.py”, line 2434, in new\_f  
result = f(\*args, \*\*kwds)  
File “E:\Programs\Anaconda\envs\venv\lib\site-packages\brian2\core\magic.py”, line 373, in run  
return magic\_network.run(duration, report=report, report\_period=report\_period,  
File “E:\Programs\Anaconda\envs\venv\lib\site-packages\brian2\core\magic.py”, line 231, in run  
Network.run(self, duration, report=report, report\_period=report\_period,  
File “E:\Programs\Anaconda\envs\venv\lib\site-packages\brian2\core\base.py”, line 278, in device\_override\_decorated\_function  
return func(\*args, \*\*kwds)  
File “E:\Programs\Anaconda\envs\venv\lib\site-packages\brian2\units\fundamentalunits.py”, line 2434, in new\_f  
result = f(_args, \*\*kwds)  
File “E:\Programs\Anaconda\envs\venv\lib\site-packages\brian2\core\network.py”, line 1008, in run  
self.before\_run(namespace)  
File “E:\Programs\Anaconda\envs\venv\lib\site-packages\brian2\core\base.py”, line 278, in device\_override\_decorated\_function  
return func(args, \*\*kwds)  
File “E:\Programs\Anaconda\envs\venv\lib\site-packages\brian2\core\network.py”, line 899, in before\_run  
raise BrianObjectException(“An error occurred when preparing an object.”, obj) from ex  
brian2.core.base.BrianObjectException: Error encountered with object named “neurongroup\_stateupdater”.  
Object was created here (most recent call only, full details in debug log):  
File “E:\Documents\Sprekeler\cobahh.py”, line 41, in   
P = NeuronGroup(4000, model=eqs, threshold='v\>-20mV’, refractory=3_ms,

An error occurred when preparing an object. (See above for original error message and traceback.)

# Doubt (if relevant)

I am not sure if my anaconda is linking to my gcc compiler path.

---

<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: [1 February 2021 10:28 UTC](https://brian.discourse.group/t/the-exprel-function-needs-c99-compiler-support-while-running-cobahh-example/275/2 "2021-02-01T10:28:36Z")

</div>

Hi Sudeshna. Just to be clear I understand correctly: if you apply the workaround where you set `_compilter_supports_c99 = True`, it works correctly?

Under Windows, we do not directly support `gcc`, because our code is generated as a C extension for Python, and these have to use the same compiler as the one that was used for building Python itself, which is Microsoft Visual Studio. So the compilation and the C99 check will try to find out which MSVC you have installed and use that. Could you add

```auto
print(brian2.codegen.cpp_prefs.get_msvc_env())

```

to figure out what that does for you?

But the C99 check should then only fail for very old MSVC versions (\< 2013).

---

<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: [1 February 2021 10:32 UTC](https://brian.discourse.group/t/the-exprel-function-needs-c99-compiler-support-while-running-cobahh-example/275/3 "2021-02-01T10:32:17Z")

</div>

Oh, wait, I completely forgot that there was actually a bug in the C99 detection on Windows 🤦‍♂️

See [Fix C99 Windows check by kjohnsen · Pull Request #1257 · brian-team/brian2 · GitHub](https://github.com/brian-team/brian2/pull/1257)

For now the workaround setting `_compiler_supports_c99` manually should work, but you could also try using the latest Brian 2 version from git (we did not make a new release yet), e.g. with:

```auto
pip install git+https://github.com/brian-team/brian.git

```
