1. Installation#

1.1. Using conda#

The easiest way to install tslearn is probably via conda (preferably in a dedicated environment):

conda install -c conda-forge tslearn

1.2. Using PyPI#

Using pip should also work fine (preferably in a dedicated virtual environment):

python -m pip install tslearn

1.3. Using latest github-hosted version#

If you want to get tslearn’s latest version, you can refer to the repository hosted at github:

python -m pip install https://github.com/tslearn-team/tslearn/archive/main.zip

1.4. A note on requirements#

tslearn builds on (and hence depends on) scikit-learn, numpy and scipy libraries. It also depends on the numba and joblib libraries.

Dependency

Version specifiers

scikit-learn

>=1.4

numpy

>=1.24.3

scipy

>=1.10.1

numba

>=0.61

joblib

>=1.2

Those should automatically be pulled on a standard tslearn installation.

If you plan to use the tslearn.shapelets module from tslearn, keras (v3+) and a dedicated backend should also be installed. See the shapelets section for more information.

pytorch can also be used as a computational backend for some metrics. See the backend section for more information.

h5py is required for reading or writing models using the hdf5 file format.

The cesium and pandas libraries may also be required if you plan on integrating with some other python packages.

You can use the [all_features] extra to enjoy all the features provided in the tslearn package:

python -m pip install tslearn[all_features]