奇怪的`ArviZ`安装问题
strange `ArviZ` installation issue
以明显的方式安装 ArviZ
后 (conda install -c conda-forge arviz
),我遇到以下故障。如果有人能阐明如何解决这个问题,那就太好了。
>>> import arviz as az
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/igor/anaconda3/lib/python3.7/site-packages/arviz/__init__.py", line 32, in <module>
from .data import *
File "/Users/igor/anaconda3/lib/python3.7/site-packages/arviz/data/__init__.py", line 2, in <module>
from .base import CoordSpec, DimSpec, dict_to_dataset, numpy_to_data_array
File "/Users/igor/anaconda3/lib/python3.7/site-packages/arviz/data/base.py", line 10, in <module>
import xarray as xr
File "/Users/igor/anaconda3/lib/python3.7/site-packages/xarray/__init__.py", line 3, in <module>
from . import testing, tutorial, ufuncs
File "/Users/igor/anaconda3/lib/python3.7/site-packages/xarray/testing.py", line 8, in <module>
from xarray.core import duck_array_ops, formatting, utils
File "/Users/igor/anaconda3/lib/python3.7/site-packages/xarray/core/duck_array_ops.py", line 15, in <module>
from . import dask_array_compat, dask_array_ops, dtypes, npcompat, nputils
File "/Users/igor/anaconda3/lib/python3.7/site-packages/xarray/core/dask_array_compat.py", line 5, in <module>
from .pycompat import dask_version
File "/Users/igor/anaconda3/lib/python3.7/site-packages/xarray/core/pycompat.py", line 55, in <module>
dsk = DuckArrayModule("dask")
File "/Users/igor/anaconda3/lib/python3.7/site-packages/xarray/core/pycompat.py", line 25, in __init__
duck_array_type = (import_module("dask.array").Array,)
File "/Users/igor/anaconda3/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Users/igor/anaconda3/lib/python3.7/site-packages/dask/array/__init__.py", line 3, in <module>
from . import backends, fft, lib, linalg, ma, overlap, random
File "/Users/igor/anaconda3/lib/python3.7/site-packages/dask/array/fft.py", line 13, in <module>
from .core import concatenate as _concatenate
File "/Users/igor/anaconda3/lib/python3.7/site-packages/dask/array/core.py", line 20, in <module>
from fsspec import get_mapper
File "/Users/igor/anaconda3/lib/python3.7/site-packages/fsspec/__init__.py", line 13, in <module>
from .core import get_fs_token_paths, open, open_files, open_local
File "/Users/igor/anaconda3/lib/python3.7/site-packages/fsspec/core.py", line 18, in <module>
from .compression import compr
File "/Users/igor/anaconda3/lib/python3.7/site-packages/fsspec/compression.py", line 139, in <module>
snappy.compress
AttributeError: module 'snappy' has no attribute 'compress'
按照@merv 的建议,我得到以下内容,它解释了问题(它是一个名为 snappy 的 不同 包,用于计算拓扑)。但是我该如何修复它(显而易见的解决方案是拥有不同的环境,但我有点困惑如何让两个同名的 pypi 包开始。
# packages in environment at /Users/igor/anaconda3:
#
# Name Version Build Channel
arviz 0.11.2 pyhd8
dask 2021.8.0 pyhd3eb1b0_0
dask-core 2021.8.0 pyhd3eb1b0_0
fsspec 2021.7.0 pyhd3eb1b0_0
snappy 3.0.1 pypi_0 pypi
snappy-15-knots 1.1 pypi_0 pypi
snappy-manifolds 1.1.2 pypi_0 pypi
xarray 0.19.0 pyhd3eb1b0_1
查看已安装的软件包,您没有安装 python-snappy
。我刚刚验证了安装它似乎可以正常工作,尽管从技术上讲 python-snappy
和 snappy
正在碰撞模块命名空间 snappy
.
是正确的
conda install python-snappy
或
pip install python-snappy
如您所述,最好使用一个新环境,避免在同一环境中安装 snappy
和 python-snappy
。
以明显的方式安装 ArviZ
后 (conda install -c conda-forge arviz
),我遇到以下故障。如果有人能阐明如何解决这个问题,那就太好了。
>>> import arviz as az
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/igor/anaconda3/lib/python3.7/site-packages/arviz/__init__.py", line 32, in <module>
from .data import *
File "/Users/igor/anaconda3/lib/python3.7/site-packages/arviz/data/__init__.py", line 2, in <module>
from .base import CoordSpec, DimSpec, dict_to_dataset, numpy_to_data_array
File "/Users/igor/anaconda3/lib/python3.7/site-packages/arviz/data/base.py", line 10, in <module>
import xarray as xr
File "/Users/igor/anaconda3/lib/python3.7/site-packages/xarray/__init__.py", line 3, in <module>
from . import testing, tutorial, ufuncs
File "/Users/igor/anaconda3/lib/python3.7/site-packages/xarray/testing.py", line 8, in <module>
from xarray.core import duck_array_ops, formatting, utils
File "/Users/igor/anaconda3/lib/python3.7/site-packages/xarray/core/duck_array_ops.py", line 15, in <module>
from . import dask_array_compat, dask_array_ops, dtypes, npcompat, nputils
File "/Users/igor/anaconda3/lib/python3.7/site-packages/xarray/core/dask_array_compat.py", line 5, in <module>
from .pycompat import dask_version
File "/Users/igor/anaconda3/lib/python3.7/site-packages/xarray/core/pycompat.py", line 55, in <module>
dsk = DuckArrayModule("dask")
File "/Users/igor/anaconda3/lib/python3.7/site-packages/xarray/core/pycompat.py", line 25, in __init__
duck_array_type = (import_module("dask.array").Array,)
File "/Users/igor/anaconda3/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Users/igor/anaconda3/lib/python3.7/site-packages/dask/array/__init__.py", line 3, in <module>
from . import backends, fft, lib, linalg, ma, overlap, random
File "/Users/igor/anaconda3/lib/python3.7/site-packages/dask/array/fft.py", line 13, in <module>
from .core import concatenate as _concatenate
File "/Users/igor/anaconda3/lib/python3.7/site-packages/dask/array/core.py", line 20, in <module>
from fsspec import get_mapper
File "/Users/igor/anaconda3/lib/python3.7/site-packages/fsspec/__init__.py", line 13, in <module>
from .core import get_fs_token_paths, open, open_files, open_local
File "/Users/igor/anaconda3/lib/python3.7/site-packages/fsspec/core.py", line 18, in <module>
from .compression import compr
File "/Users/igor/anaconda3/lib/python3.7/site-packages/fsspec/compression.py", line 139, in <module>
snappy.compress
AttributeError: module 'snappy' has no attribute 'compress'
按照@merv 的建议,我得到以下内容,它解释了问题(它是一个名为 snappy 的 不同 包,用于计算拓扑)。但是我该如何修复它(显而易见的解决方案是拥有不同的环境,但我有点困惑如何让两个同名的 pypi 包开始。
# packages in environment at /Users/igor/anaconda3:
#
# Name Version Build Channel
arviz 0.11.2 pyhd8
dask 2021.8.0 pyhd3eb1b0_0
dask-core 2021.8.0 pyhd3eb1b0_0
fsspec 2021.7.0 pyhd3eb1b0_0
snappy 3.0.1 pypi_0 pypi
snappy-15-knots 1.1 pypi_0 pypi
snappy-manifolds 1.1.2 pypi_0 pypi
xarray 0.19.0 pyhd3eb1b0_1
查看已安装的软件包,您没有安装 python-snappy
。我刚刚验证了安装它似乎可以正常工作,尽管从技术上讲 python-snappy
和 snappy
正在碰撞模块命名空间 snappy
.
conda install python-snappy
或
pip install python-snappy
如您所述,最好使用一个新环境,避免在同一环境中安装 snappy
和 python-snappy
。