# Error when importing PyMC3 3.9.3

**URL:** <https://discourse.pymc.io/t/error-when-importing-pymc3-3-9-3/5823>\
**Category:** Development\
**Tags:** bug\
**Created:** [September 21, 2020, 11:54pm UTC](https://discourse.pymc.io/t/error-when-importing-pymc3-3-9-3/5823 "2020-09-21T23:54:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yurong](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/yurong/32/8120_2.png) [@yurong](https://discourse.pymc.io/u/yurong)\
**Post date:** [September 21, 2020, 11:54pm UTC](https://discourse.pymc.io/t/error-when-importing-pymc3-3-9-3/5823/1 "2020-09-21T23:54:05Z")

</div>

Hi,

I’ve been using PyMC3 3.9.3 for a while. But very recently (within a week) I am not able to import the package because of below error. Is it a bug?

Thanks,  
Yurong

**Update:**  
Downgrading xarray to an earlier version (0.15.1) fixed the error. So it seems the latest xarray version (0.16.1) installed automatically when installing pymc3==3.9.3 is not compatible.

> > > import pymc3  
> > > Traceback (most recent call last):  
> > > File “”, line 1, in   
> > > File “/home/ubuntu/.local/lib/python3.6/site-packages/pymc3/ **init**.py”, line 41, in   
> > > from .distributions import \*  
> > > File “/home/ubuntu/.local/lib/python3.6/site-packages/pymc3/distributions/ **init**.py”, line 15, in   
> > > from . import timeseries  
> > > File “/home/ubuntu/.local/lib/python3.6/site-packages/pymc3/distributions/timeseries.py”, line 22, in   
> > > from pymc3.util import get\_variable\_name  
> > > File “/home/ubuntu/.local/lib/python3.6/site-packages/pymc3/util.py”, line 20, in   
> > > import arviz  
> > > File “/home/ubuntu/.local/lib/python3.6/site-packages/arviz/ **init**.py”, line 28, in   
> > > from .data import \*  
> > > File “/home/ubuntu/.local/lib/python3.6/site-packages/arviz/data/ **init**.py”, line 2, in   
> > > from .inference\_data import InferenceData, concat  
> > > File “/home/ubuntu/.local/lib/python3.6/site-packages/arviz/data/inference\_data.py”, line 15, in   
> > > from …utils import \_subset\_list, HtmlTemplate  
> > > File “/home/ubuntu/.local/lib/python3.6/site-packages/arviz/utils.py”, line 670, in   
> > > class HtmlTemplate:  
> > > File “/home/ubuntu/.local/lib/python3.6/site-packages/arviz/utils.py”, line 696, in HtmlTemplate  
> > > css\_template = f" {xr.core.formatting\_html.CSS\_STYLE}{specific\_style} "  
> > > AttributeError: module ‘xarray.core.formatting\_html’ has no attribute ‘CSS\_STYLE’

---

<div class="post-metadata">

**Author:** ![OriolAbril](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/oriolabril/32/2497_2.png) [@OriolAbril](https://discourse.pymc.io/u/OriolAbril)\
**Post date:** [September 22, 2020, 4:14am UTC](https://discourse.pymc.io/t/error-when-importing-pymc3-3-9-3/5823/2 "2020-09-22T04:14:50Z")

</div>

This issue is due to ArviZ using part of the private xarray API for the html repr of InferenceData objects. This has already been fixed in [https://github.com/arviz-devs/arviz/pull/1389](https://github.com/arviz-devs/arviz/pull/1389) so there are now 2 ways to solve the issue

- Use latest PyMC3 and ArviZ releases (should also work with older releases) and xarray\<=0.16, its only xarray 0.16.1 the one that is incompatible
- Update to xarray 0.16.1 and to ArviZ’s development version. A new ArviZ release will be available soon after which the latest release will already work with xarray 0.16.1

---

<div class="post-metadata">

**Author:** ![OriolAbril](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/oriolabril/32/2497_2.png) [@OriolAbril](https://discourse.pymc.io/u/OriolAbril)\
**Post date:** [September 24, 2020, 10:18am UTC](https://discourse.pymc.io/t/error-when-importing-pymc3-3-9-3/5823/3 "2020-09-24T10:18:47Z")

</div>

ArviZ 0.10.0 is already available in pypi and conda forge, everything works again with xarray 0.16.1
