5

I try to run dtaidistance but when running the following code according example :

from dtaidistance import dtw
import numpy as np
timeseries = np.array([
     [0., 0, 1, 2, 1, 0, 1, 0, 0],
     [0., 1, 2, 0, 0, 0, 0, 0, 0],
     [1., 2, 0, 0, 0, 0, 0, 1, 1],
     [0., 0, 1, 2, 1, 0, 1, 0, 0],
     [0., 1, 2, 0, 0, 0, 0, 0, 0],
     [1., 2, 0, 0, 0, 0, 0, 1, 1]])
ds = dtw.distance_matrix_fast(timeseries, block=((1, 4), (3, 5)))

I get the following error:

The compiled dtaidistance C library is not available.
See the documentation for alternative installation options.

I tried different IDEs (Jupyter Notebook, PyCharm, Visual Studio Code), different Laptops, older version of dtaidistance,..

Is it even possible to install the library on windows? -.-

I tried troubleshooting according: https://dtaidistance.readthedocs.io/en/latest/usage/installation.html

I tried everything according:

However, none of it was successful. I am in need of this library..

When running dtw.try_import_c() I get the following output:

Cannot import OMP-based library (dtw_cc_omp)
Cannot import Numpy-based library (dtw_cc_numpy)

Not all libraries are available in your installation. Share the following information when submitting a bug report:
- Cannot import OMP-based library (dtw_cc_omp)
- cannot import name 'dtw_cc_omp' from 'dtaidistance' (C:\Users\admin\anaconda3\lib\site-packages\dtaidistance\__init__.py)
- Cannot import Numpy-based library (dtw_cc_numpy)
- cannot import name 'dtw_cc_numpy' from 'dtaidistance' (C:\Users\admin\anaconda3\lib\site-packages\dtaidistance\__init__.py)
- System information:
  namespace(cache_tag='cpython-38', hexversion=50857456, name='cpython', version=sys.version_info(major=3, minor=8, micro=5, releaselevel='final', serial=0))
Additionally, you can rerun the compilation from source or pip install in verbose mode:
pip install -vvv --upgrade --force-reinstall --no-deps --no-binary :all: dtaidistance

Any ideas? Thanks a lot!

4

2 回答 2

1

我遇到了类似的问题,这就是我解决它们的方法。

  1. 确保/site_packages以前的安装尝试中没有与 dtaidistance 相关的文件夹。
  2. 按照https://dtaidistance.readthedocs.io/en/latest/usage/installation.html从源代码编译包。如果 OpenMP 不可用,请安装gcc并使用该--forcegnugcc参数。
  3. 构建包后,将文件夹/dtaidistance 手动复制到文件/site_packages夹中。这一步很重要:奇怪的是,使用python setup.py install对我不起作用。

这些步骤已使用版本 2.3.2 进行了测试。

于 2021-12-13T07:56:02.277 回答
0

现在有通过 Conda 可用于 Windows/Macos/Linux 的编译二进制文件:https ://anaconda.org/conda-forge/dtaidistance

希望这可以更轻松地访问 Windows 上的快速 DTW 实现。

于 2022-01-17T10:45:03.470 回答