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!

Adler Müller
  • 248
  • 1
  • 14

2 Answers2

1

I faced similar problems and this is how I solved them.

  1. Make sure that no dtaidistance related folders are in /site_packages from previous installation attemps.
  2. Follow https://dtaidistance.readthedocs.io/en/latest/usage/installation.html and compile the package from source. If OpenMP is not available, install gcc and use the --forcegnugcc argument.
  3. After building the package copy the folder /dtaidistance manually into the /site_packages folder. This step is important: Strangly, using python setup.py install did not work for me.

The steps were tested with version 2.3.2.

Phun
  • 121
  • 5
0

There are now compiled binaries available for Windows/Macos/Linux via Conda: https://anaconda.org/conda-forge/dtaidistance

Hope this makes it easier to get access to the fast DTW implementation on Windows.

wannesm
  • 116
  • 1
  • 4