# Arviz error when using plot functions of pymc3

**URL:** <https://discourse.pymc.io/t/arviz-error-when-using-plot-functions-of-pymc3/3257>\
**Category:** Questions\
**Created:** [May 13, 2019, 10:36pm UTC](https://discourse.pymc.io/t/arviz-error-when-using-plot-functions-of-pymc3/3257 "2019-05-13T22:36:08Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![madarshahian](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/madarshahian/32/722_2.png) [@madarshahian](https://discourse.pymc.io/u/madarshahian)\
**Post date:** [May 13, 2019, 10:36pm UTC](https://discourse.pymc.io/t/arviz-error-when-using-plot-functions-of-pymc3/3257/1 "2019-05-13T22:36:08Z")

</div>

Have you ever had this error when calling pm.traceplot? This not gonna resolve even if I use “pip install arviz”. Any hints that I can resolve it?

> ImportError: ArviZ is not installed. In order to use `plot_trace`:

---

<div class="post-metadata">

**Author:** ![chartl](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/chartl/32/1515_2.png) [@chartl](https://discourse.pymc.io/u/chartl)\
**Post date:** [May 14, 2019, 2:02am UTC](https://discourse.pymc.io/t/arviz-error-when-using-plot-functions-of-pymc3/3257/2 "2019-05-14T02:02:26Z")

</div>

Update to python3 and the newest version of pymc3

---

<div class="post-metadata">

**Author:** ![madarshahian](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/madarshahian/32/722_2.png) [@madarshahian](https://discourse.pymc.io/u/madarshahian)\
**Post date:** [May 14, 2019, 9:12pm UTC](https://discourse.pymc.io/t/arviz-error-when-using-plot-functions-of-pymc3/3257/3 "2019-05-14T21:12:09Z")

</div>

I did, it did not work. Then I installed anaconda again, the error changed " cannot import name ‘moduleTNC’ ". Then I changed the name of the file “moduletnc” in the folder showed in the error to the “moduleTNC”, and it worked.

---

<div class="post-metadata">

**Author:** ![sharsenij14](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@sharsenij14](https://discourse.pymc.io/u/sharsenij14)\
**Post date:** [June 1, 2019, 2:15pm UTC](https://discourse.pymc.io/t/arviz-error-when-using-plot-functions-of-pymc3/3257/4 "2019-06-01T14:15:49Z")

</div>

Ran into this as well after installing the newest PyMC version from anaconda forge. Installing -arviz restores plotting functionality, but the graphs look different (less aesthetically pleasing, in my opinion). Also, I don’t seem to have the moduletnc file on my computer and “conda update --all” did not help. I guess a complete anaconda reinstall is always an option, I will report back if I go that route.

---

<div class="post-metadata">

**Author:** ![madarshahian](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/madarshahian/32/722_2.png) [@madarshahian](https://discourse.pymc.io/u/madarshahian)\
**Post date:** [June 3, 2019, 1:45pm UTC](https://discourse.pymc.io/t/arviz-error-when-using-plot-functions-of-pymc3/3257/5 "2019-06-03T13:45:54Z")

</div>

This happened again for me when I updated pymc3 from version 3.6 to 3.7. After having error I also installed arviz successfully, but it gives me the same error, even after installing arviz.

> pm.traceplot(trace\_2)  
> Traceback (most recent call last):
> 
> File “”, line 1, in   
> pm.traceplot(trace\_2)
> 
> File “C:\Users\xxxxx\AppData\Local\Continuum\anaconda3\envs\pymc3env\lib\site-packages\pymc3\plots\__init_\_.py”, line 42, in wrapped  
> return func(\*args, \*\*kwargs)
> 
> File “C:\Users\xxxxx\AppData\Local\Continuum\anaconda3\envs\pymc3env\lib\site-packages\pymc3\plots\__init_\_.py”, line 22, in **call**  
> “ArviZ is not installed. In order to use `{0.attr}`:\npip install arviz”.format(self)
> 
> ImportError: ArviZ is not installed. In order to use `plot_trace`:  
> pip install arviz

---

<div class="post-metadata">

**Author:** ![sharsenij14](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@sharsenij14](https://discourse.pymc.io/u/sharsenij14)\
**Post date:** [June 3, 2019, 4:12pm UTC](https://discourse.pymc.io/t/arviz-error-when-using-plot-functions-of-pymc3/3257/6 "2019-06-03T16:12:33Z")

</div>

Just to clarify, I also encountered the error after updating to 3.7. The error went away after I installed arviz via conda, but the graphs are now formatted differently. @madarshahian, did you install -arviz via pip? I guess that should not matter. Maybe someone can shed more light on the dependencies that .traceplot() needs?

---

<div class="post-metadata">

**Author:** ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)\
**Post date:** [June 3, 2019, 6:07pm UTC](https://discourse.pymc.io/t/arviz-error-when-using-plot-functions-of-pymc3/3257/7 "2019-06-03T18:07:55Z")

</div>

If you install arviz and pymc3 master, a PR just pushed to have the same style traceplot as before (i.e., a compacted one).

---

<div class="post-metadata">

**Author:** ![madarshahian](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/madarshahian/32/722_2.png) [@madarshahian](https://discourse.pymc.io/u/madarshahian)\
**Post date:** [June 3, 2019, 6:24pm UTC](https://discourse.pymc.io/t/arviz-error-when-using-plot-functions-of-pymc3/3257/8 "2019-06-03T18:24:39Z")

</div>

This is the latest update on a test code ( I installed pymc3 after cloning it using this command: “`python setup.py install`” and it installed without any error.)

 ![arviz](https://canada1.discourse-cdn.com/flex036/uploads/pymc3/original/2X/d/d9d84dac171541badbeb0b25e7aeb3cafa411ace.png)

---

<div class="post-metadata">

**Author:** ![madarshahian](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/madarshahian/32/722_2.png) [@madarshahian](https://discourse.pymc.io/u/madarshahian)\
**Post date:** [June 3, 2019, 6:27pm UTC](https://discourse.pymc.io/t/arviz-error-when-using-plot-functions-of-pymc3/3257/9 "2019-06-03T18:27:55Z")

</div>

yes I used pip, if I use conda, it gives me “PackagesNotFoundError”

---

<div class="post-metadata">

**Author:** ![madarshahian](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/madarshahian/32/722_2.png) [@madarshahian](https://discourse.pymc.io/u/madarshahian)\
**Post date:** [June 3, 2019, 6:31pm UTC](https://discourse.pymc.io/t/arviz-error-when-using-plot-functions-of-pymc3/3257/10 "2019-06-03T18:31:47Z")

</div>

@junpenglao any suggestion?

---

<div class="post-metadata">

**Author:** ![madarshahian](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/madarshahian/32/722_2.png) [@madarshahian](https://discourse.pymc.io/u/madarshahian)\
**Post date:** [June 3, 2019, 6:50pm UTC](https://discourse.pymc.io/t/arviz-error-when-using-plot-functions-of-pymc3/3257/11 "2019-06-03T18:50:37Z")

</div>

OK I guess I got the reason of the latest error. We should call variables in quotation mark. like: `pm.traceplot(trace, ['b1','b2']);`

---

<div class="post-metadata">

**Author:** ![sharsenij14](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@sharsenij14](https://discourse.pymc.io/u/sharsenij14)\
**Post date:** [June 3, 2019, 7:06pm UTC](https://discourse.pymc.io/t/arviz-error-when-using-plot-functions-of-pymc3/3257/12 "2019-06-03T19:06:44Z")

</div>

Thank you, @junpenglao. I tried “pip install pymc3” and “pip install git+https://github.com/pymc-devs/pymc3” + installing / re-installing arviz with pip. It still gives me the new style plots. These are the master branches? What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![madarshahian](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/madarshahian/32/722_2.png) [@madarshahian](https://discourse.pymc.io/u/madarshahian)\
**Post date:** [June 3, 2019, 7:08pm UTC](https://discourse.pymc.io/t/arviz-error-when-using-plot-functions-of-pymc3/3257/13 "2019-06-03T19:08:22Z")

</div>

have you removed pymc3 before installing it using git?

---

<div class="post-metadata">

**Author:** ![sharsenij14](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@sharsenij14](https://discourse.pymc.io/u/sharsenij14)\
**Post date:** [June 3, 2019, 7:37pm UTC](https://discourse.pymc.io/t/arviz-error-when-using-plot-functions-of-pymc3/3257/14 "2019-06-03T19:37:47Z")

</div>

Yes! I re-installed both packages with

> pip install git+https://github.com/pymc-devs/pymc3  
> pip install git+git://github.com/arviz-devs/arviz.git

I now get this plot style (from [Traceplot fixes by OriolAbril · Pull Request #679 · arviz-devs/arviz · GitHub](https://github.com/arviz-devs/arviz/pull/679)):

 ![](https://canada1.discourse-cdn.com/flex036/uploads/pymc3/original/2X/c/c388a7ec4bb2cd9e285d5b56de28d07e24af11e5.png)

It looks like the font and figure sizes are increased a bit and a barcode plot is added on the bottom (compared to what it was on my PC in the prior PyMC version). I could not figure out from PR discussions if these changes are intentional, and if the above look is the desired “compact” style, or not.

---

<div class="post-metadata">

**Author:** ![madarshahian](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/madarshahian/32/722_2.png) [@madarshahian](https://discourse.pymc.io/u/madarshahian)\
**Post date:** [June 4, 2019, 9:14pm UTC](https://discourse.pymc.io/t/arviz-error-when-using-plot-functions-of-pymc3/3257/15 "2019-06-04T21:14:19Z")

</div>

I have similar problem and I don’t like new plots on pymc3 neither. The previous format was much better.

---

<div class="post-metadata">

**Author:** ![sharsenij14](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@sharsenij14](https://discourse.pymc.io/u/sharsenij14)\
**Post date:** [June 4, 2019, 11:51pm UTC](https://discourse.pymc.io/t/arviz-error-when-using-plot-functions-of-pymc3/3257/16 "2019-06-04T23:51:06Z")

</div>

@madarshahian, that was my initial reaction also. I think a lot of these things are a matter of personal preference though. Perhaps there will be a more flexible interface in the future, where plot style could be passed as an argument to pymc plotting function. Or better yet, plot customization will be done in a separate library, like arviz, or other. As a probabilistic programming newbie, I am just in continuous awe of how easy PyMC is to use and how well it works. I think a big part of that is an active developer community that constantly improves it. Though the rapid changes may seem like an inconvenience at times, I think they are precisely what makes this library so great.

---

<div class="post-metadata">

**Author:** ![madarshahian](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/madarshahian/32/722_2.png) [@madarshahian](https://discourse.pymc.io/u/madarshahian)\
**Post date:** [June 5, 2019, 1:14pm UTC](https://discourse.pymc.io/t/arviz-error-when-using-plot-functions-of-pymc3/3257/17 "2019-06-05T13:14:29Z")

</div>

Yea, can’t agree more. For plot, I think more flexibility would help a lot. Another thing I did not like about new plot package is forest plot, which previously R\_hat was added on the right, and also you can enter label. Now to do that I need to write more lines of code.

---

<div class="post-metadata">

**Author:** ![Turanga1](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/turanga1/32/1936_2.png) [@Turanga1](https://discourse.pymc.io/u/Turanga1)\
**Post date:** [August 9, 2019, 7:15pm UTC](https://discourse.pymc.io/t/arviz-error-when-using-plot-functions-of-pymc3/3257/18 "2019-08-09T19:15:10Z")

</div>

I had a similar issue and followed the advice in the error code: “pip install arviz”, but that didn’t help. Finally I did “pip uninstall arviz”, followed by “conda install -c conda-forge arviz”, restarted my kernel and then it worked fine.
