# Error: NotImplementedError: Cannot convert 'μ' to a tensor variable

**URL:** <https://discourse.pymc.io/t/error-notimplementederror-cannot-convert-to-a-tensor-variable/13355>\
**Category:** v5\
**Tags:** sampling\
**Created:** [November 21, 2023, 11:57pm UTC](https://discourse.pymc.io/t/error-notimplementederror-cannot-convert-to-a-tensor-variable/13355 "2023-11-21T23:57:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julian\_Bharadwaj](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/julian_bharadwaj/32/7424_2.png) [@Julian\_Bharadwaj](https://discourse.pymc.io/u/Julian_Bharadwaj)\
**Post date:** [November 21, 2023, 11:57pm UTC](https://discourse.pymc.io/t/error-notimplementederror-cannot-convert-to-a-tensor-variable/13355/1 "2023-11-21T23:57:13Z")

</div>

Hello: I am getting this error “NotImplementedError: Cannot convert ‘μ’ to a tensor variable.” when I try to run Code 8.2, page 237 in Bayesian Modeling and Computation in Python.

I’ve installed pymc5 - can you help please.

Thank you!

---

<div class="post-metadata">

**Author:** ![ricardoV94](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ricardov94/32/5775_2.png) [@ricardoV94](https://discourse.pymc.io/u/ricardoV94)\
**Post date:** [November 22, 2023, 5:24am UTC](https://discourse.pymc.io/t/error-notimplementederror-cannot-convert-to-a-tensor-variable/13355/2 "2023-11-22T05:24:44Z")

</div>

Make sure you use PyTensor and not Aesara or Theano

---

<div class="post-metadata">

**Author:** ![Julian\_Bharadwaj](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/julian_bharadwaj/32/7424_2.png) [@Julian\_Bharadwaj](https://discourse.pymc.io/u/Julian_Bharadwaj)\
**Post date:** [November 22, 2023, 3:14pm UTC](https://discourse.pymc.io/t/error-notimplementederror-cannot-convert-to-a-tensor-variable/13355/3 "2023-11-22T15:14:04Z")

</div>

Hi Ricardov94 -

I am not using either - I am trying to recreate [this](https://bayesiancomputationbook.com/notebooks/chp_08.html) example. (see Code 8.2 and 8.3). Neither the model code nor the imports import either PyTensor, Theano or Aesara.

Do I need to import PyTensor or add specific PyTensor lines here?

---

<div class="post-metadata">

**Author:** ![ricardoV94](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ricardov94/32/5775_2.png) [@ricardoV94](https://discourse.pymc.io/u/ricardoV94)\
**Post date:** [November 22, 2023, 3:40pm UTC](https://discourse.pymc.io/t/error-notimplementederror-cannot-convert-to-a-tensor-variable/13355/4 "2023-11-22T15:40:02Z")

</div>

That example uses the old pymc3 package, you may have installed the most recent pymc (without the 3) which is why you are seeing the errors.

---

<div class="post-metadata">

**Author:** ![Julian\_Bharadwaj](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/julian_bharadwaj/32/7424_2.png) [@Julian\_Bharadwaj](https://discourse.pymc.io/u/Julian_Bharadwaj)\
**Post date:** [November 22, 2023, 3:59pm UTC](https://discourse.pymc.io/t/error-notimplementederror-cannot-convert-to-a-tensor-variable/13355/5 "2023-11-22T15:59:55Z")

</div>

Ok - to get this working, do I need to just import PyTensor? From the PyMC example on [this page](https://www.pymc.io/projects/docs/en/stable/api/distributions/simulator.html), there is no mention of PyTensor either.

---

<div class="post-metadata">

**Author:** ![cluhmann](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/cluhmann/32/3083_2.png) [@cluhmann](https://discourse.pymc.io/u/cluhmann)\
**Post date:** [November 22, 2023, 8:56pm UTC](https://discourse.pymc.io/t/error-notimplementederror-cannot-convert-to-a-tensor-variable/13355/6 "2023-11-22T20:56:08Z")

</div>

[This notebook](https://www.pymc.io/projects/examples/en/latest/samplers/SMC-ABC_Lotka-Volterra_example.html#old-good-gaussian-fit) may get you on the right track.

---

<div class="post-metadata">

**Author:** ![Julian\_Bharadwaj](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/julian_bharadwaj/32/7424_2.png) [@Julian\_Bharadwaj](https://discourse.pymc.io/u/Julian_Bharadwaj)\
**Post date:** [November 23, 2023, 12:38am UTC](https://discourse.pymc.io/t/error-notimplementederror-cannot-convert-to-a-tensor-variable/13355/7 "2023-11-23T00:38:30Z")

</div>

That was very useful - thank you! I had an incorrect version and that’s now corrected
