# BayesFlow incompatible with keras==3.13.1

**URL:** https://discuss.bayesflow.org/t/bayesflow-incompatible-with-keras-3-13-1/229
**Category:** General
**Created:** [January 26, 2026, 5:06pm UTC](https://discuss.bayesflow.org/t/bayesflow-incompatible-with-keras-3-13-1/229 "2026-01-26T17:06:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![nbrawand](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.bayesflow.org/nbrawand/32/160_2.png) [@nbrawand](https://discuss.bayesflow.org/u/nbrawand)
#### Post date: [January 26, 2026, 5:06pm UTC](https://discuss.bayesflow.org/t/bayesflow-incompatible-with-keras-3-13-1/229/1 "2026-01-26T17:06:38Z")

</div>

Hey BF Team,

I am a first time user of BF and I followed the install section on the readme and tried to run the first example but it failed with a Keras error:

**python3.11/site-packages/keras/src/layers/core/dense.py", line 101, in \__init_\_**

```
**raise ValueError(**

```

**ValueError: Received an invalid value for `units`, expected a positive integer. Received: units=None**

**Workaround** : I uninstalled the default keras 3.13.1 (installed with pip install bayesflow) and replaced it with 3.10.0.

I am not sure the best fix but the issue is not mentioned on the bayesflow readme maybe update the requirements keras\<3.13?

Let me know if I can help.

Thanks!

Nick

---

<div class="post-metadata">

### Author: ![KLDivergence](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.bayesflow.org/kldivergence/32/15_2.png) [@KLDivergence](https://discuss.bayesflow.org/u/KLDivergence)
#### Post date: [January 26, 2026, 5:23pm UTC](https://discuss.bayesflow.org/t/bayesflow-incompatible-with-keras-3-13-1/229/2 "2026-01-26T17:23:18Z")

</div>

Hi Nick,

Welcome to our forums! Yes, upstream `keras` created a few incompatibilities. This issue will be solved in the upcoming `2.0.8` version which will be merged this week: [Version 2.0.8 by stefanradev93 · Pull Request #615 · bayesflow-org/bayesflow · GitHub](https://github.com/bayesflow-org/bayesflow/pull/615)

For now, can you please install from `dev` and let me know if the issue persists?

`pip install git+https://github.com/bayesflow-org/bayesflow.git@dev`

---

<div class="post-metadata">

### Author: ![KLDivergence](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.bayesflow.org/kldivergence/32/15_2.png) [@KLDivergence](https://discuss.bayesflow.org/u/KLDivergence)
#### Post date: [January 29, 2026, 3:15pm UTC](https://discuss.bayesflow.org/t/bayesflow-incompatible-with-keras-3-13-1/229/3 "2026-01-29T15:15:17Z")

</div>

The new release was published yesterday. Let us know if there are any problems!
