Closed fish-galaxy closed 9 months ago
Hi, what python version and arviz version do you have?
I use the version is python 3.10.9 and arviz 0.16.1
This looks very similar, perhaps identical, to an issue that came up in CI when wrapping arviz with Julia (https://github.com/JuliaRegistries/General/pull/88578#issuecomment-1671179381). Note that the error traces back to the same line of Python code: https://github.com/JuliaRegistries/General/actions/runs/5808545587/job/15745534758#step:16:885 . This was with a fresh Conda environment built with micromamba with only the constraint "arviz >= 0.14.0".
similar question UnicodeDecodeError: 'gbk' codec can't decode byte 0xba in position 2367: illegal multibyte sequence
import arviz Traceback (most recent call last): File "", line 1, in File "D:\anacoda\envs\pymc4\Lib\site-packages\arvizinit.py", line 33, in from .data import * File "D:\anacoda\envs\pymc4\Lib\site-packages\arviz\datainit.py", line 2, in from .base import CoordSpec, DimSpec, dict_to_dataset, numpy_to_dataarray File "D:\anacoda\envs\pymc4\Lib\site-packages\arviz\data\base.py", line 20, in from .. import version, utils File "D:\anacoda\envs\pymc4\Lib\site-packages\arviz\utils.py", line 667, in class HtmlTemplate: File "D:\anacoda\envs\pymc4\Lib\site-packages\arviz\utils.py", line 692, in HtmlTemplate , css_style = _load_static_files() # pylint: disable=protected-access ^^^^^^^^^^^^^^^^^^^^ File "D:\anacoda\envs\pymc4\Lib\site-packages\arviz\utils.py", line 662, in _load_static_files return [ ^ File "D:\anacoda\envs\pymc4\Lib\site-packages\arviz\utils.py", line 663, in importlib.resources.files("arviz").joinpath(fname).read_text() for fname in STATIC_FILES ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\anacoda\envs\pymc4\Lib\pathlib.py", line 1059, in read_text return f.read() ^^^^^^^^ UnicodeDecodeError: 'gbk' codec can't decode byte 0xba in position 2367: illegal multibyte sequence
python 3.11.4 arivz 0.16.0
using arivz 0.15 non error
@sethaxen Thanks, i find arviz can successfully run if the version<0.16.0 when i try to change the version. @vitwei You can try to ues the arviz0.15.1 or lower version.
How did you install arviz?
Conda or pip?
This also came up here. The issue there was that the user was on windows. The system encoding there isn't utf-8, if I remember correctly it's Latin1, so when they try to read the contents of the file that has utf-8 special characters, the system level encoding can't understand them and errors out. To fix that, you'll need to explicitly pass encoding="utf-8"
when calling read_text
.
We need to add the encoding argument in https://github.com/arviz-devs/arviz/blob/6b1b2be60cca804d4b0ec43a3303820bfa8785c6/arviz/utils.py#L671 then. Thanks @lucianopaz!
Holle, I want to run:
What do I need to do to solve this problem? Looking forward to your answer!