installation.rst 6.15 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Installing pre-built binaries
=============================

``torchaudio`` has binary distributions for PyPI (``pip``) and Anaconda (``conda``).

Please refer to https://pytorch.org/get-started/locally/ for the details.

.. note::

   Each ``torchaudio`` package is compiled against specific version of ``torch``.
   Please refer to the following table and install the correct pair of ``torch`` and ``torchaudio``.

.. note::

   Starting ``0.10``, torchaudio has CPU-only and CUDA-enabled binary distributions,
   each of which requires a corresponding PyTorch distribution.

.. note::
19
   This software was compiled against an unmodified copies of FFmpeg, with the specific rpath removed so as to enable the use of system libraries. The LGPL source can be downloaded from the following locations: `n4.1.8 <https://github.com/FFmpeg/FFmpeg/releases/tag/n4.4.4>`__ (`license <https://github.com/FFmpeg/FFmpeg/blob/n4.4.4/COPYING.LGPLv2.1>`__), `n5.0.3 <https://github.com/FFmpeg/FFmpeg/releases/tag/n5.0.3>`__ (`license <https://github.com/FFmpeg/FFmpeg/blob/n5.0.3/COPYING.LGPLv2.1>`__) and `n6.0 <https://github.com/FFmpeg/FFmpeg/releases/tag/n6.0>`__ (`license <https://github.com/FFmpeg/FFmpeg/blob/n6.0/COPYING.LGPLv2.1>`__).
20

21
22
23
24
25
26
27
Dependencies
------------

* `PyTorch <https://pytorch.org>`_

  Please refer to the compatibility matrix bellow for supported PyTorch versions.

28
29
.. _optional_dependencies:

30
31
32
Optional Dependencies
~~~~~~~~~~~~~~~~~~~~~

moto's avatar
moto committed
33
.. _ffmpeg_dependency:
34

35
* `FFmpeg <https://ffmpeg.org>`__
moto's avatar
moto committed
36

37
  Required to use :py:mod:`torchaudio.io` module. and ``backend="ffmpeg"`` in
moto's avatar
moto committed
38
  `I/O functions <./torchaudio.html#i-o>`__.
39

moto's avatar
moto committed
40
  Starting version 2.1, TorchAudio official binary distributions are compatible with
41
  FFmpeg version 6, 5 and 4. (>=4.4, <7). At runtime, TorchAudio first looks for FFmpeg 6,
moto's avatar
moto committed
42
  if not found, then it continues to looks for 5 and move on to 4.
43

44
45
46
47
48
49
  There are multiple ways to install FFmpeg libraries.
  Please refer to the official documentation for how to install FFmpeg.
  If you are using Anaconda Python distribution,
  ``conda install -c conda-forge 'ffmpeg<7'`` will install
  compatible FFmpeg libraries.

moto's avatar
moto committed
50
51
52
53
  If you need to specify the version of FFmpeg TorchAudio searches and links, you can
  specify it via the environment variable ``TORCHAUDIO_USE_FFMPEG_VERSION``. For example,
  by setting ``TORCHAUDIO_USE_FFMPEG_VERSION=5``, TorchAudio will only look for FFmpeg
  5.
54

moto's avatar
moto committed
55
56
57
58
  If for some reason, this search mechanism is causing an issue, you can disable
  the FFmpeg integration entirely by setting the environment variable
  ``TORCHAUDIO_USE_FFMPEG=0``.

59
60
61
62
63
  There are multiple ways to install FFmpeg libraries.
  If you are using Anaconda Python distribution,
  ``conda install -c conda-forge 'ffmpeg<7'`` will install
  compatible FFmpeg libraries.

moto's avatar
moto committed
64
65
66
67
68
69
70
71
72
73
74
  .. note::

     When searching for FFmpeg installation, TorchAudio looks for library files
     which have names with version numbers.
     That is, ``libavutil.so.<VERSION>`` for Linux, ``libavutil.<VERSION>.dylib``
     for macOS, and ``avutil-<VERSION>.dll`` for Windows.
     Many public pre-built binaries follow this naming scheme, but some distributions
     have un-versioned file names.
     If you are having difficulties detecting FFmpeg, double check that the library
     files you installed follow this naming scheme, (and then make sure
     that they are in one of the directories listed in library search path.)
75
76
77

* `SoX <https://sox.sourceforge.net/>`__

moto's avatar
moto committed
78
  Required to use ``backend="sox"`` in `I/O functions <./torchaudio.html#i-o>`__.
79

moto's avatar
moto committed
80
  Starting version 2.1, TorchAudio requires separately installed libsox.
81
82
83
84

  If dynamic linking is causing an issue, you can set the environment variable
  ``TORCHAUDIO_USE_SOX=0``, and TorchAudio won't use SoX.

moto's avatar
moto committed
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
  .. note::

     TorchAudio looks for a library file with unversioned name, that is ``libsox.so``
     for Linux, and ``libsox.dylib`` for macOS. Some package managers install the library
     file with different name. For example, aptitude on Ubuntu installs ``libsox.so.3``.
     To have TorchAudio link against it, you can create a symbolic link to it with name
     ``libsox.so`` (and put the symlink in a library search path).

  .. note::
     TorchAudio is tested on libsox 14.4.2. (And it is unlikely that other
     versions would work.)

* `SoundFile <https://pysoundfile.readthedocs.io/>`__

  Required to use ``backend="soundfile"`` in `I/O functions <./torchaudio.html#i-o>`__.

101
* `sentencepiece <https://pypi.org/project/sentencepiece/>`__
102
103

  Required for performing automatic speech recognition with :ref:`Emformer RNN-T<RNNT>`.
104
  You can install it by running ``pip install sentencepiece``.
105

106
* `deep-phonemizer <https://pypi.org/project/deep-phonemizer/>`__
107
108
109

  Required for performing text-to-speech with :ref:`Tacotron2`.

110
* `kaldi_io <https://pypi.org/project/kaldi-io/>`__
111
112
113
114

  Required to use :py:mod:`torchaudio.kaldi_io` module.

   
115
116
117
Compatibility Matrix
--------------------

118
119
120
121
122
123
The official binary distributions of TorchAudio contain extension modules
which are written in C++ and linked against specific versions of PyTorch.

TorchAudio and PyTorch from different releases cannot be used together.
Please refer to the following table for the matching versions.

124
125
126
.. list-table::
   :header-rows: 1

127
128
129
   * - ``PyTorch``
     - ``TorchAudio``
     - ``Python``
130
131
132
   * - ``2.0.1``
     - ``2.0.2``
     - ``>=3.8``, ``<=3.11``
133
   * - ``2.0.0``
moto's avatar
moto committed
134
     - ``2.0.1``
135
     - ``>=3.8``, ``<=3.11``
136
137
138
   * - ``1.13.1``
     - ``0.13.1``
     - ``>=3.7``, ``<=3.10``
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
   * - ``1.13.0``
     - ``0.13.0``
     - ``>=3.7``, ``<=3.10``
   * - ``1.12.1``
     - ``0.12.1``
     - ``>=3.7``, ``<=3.10``
   * - ``1.12.0``
     - ``0.12.0``
     - ``>=3.7``, ``<=3.10``
   * - ``1.11.0``
     - ``0.11.0``
     - ``>=3.7``, ``<=3.9``
   * - ``1.10.0``
     - ``0.10.0``
     - ``>=3.6``, ``<=3.9``
   * - ``1.9.1``
     - ``0.9.1``
     - ``>=3.6``, ``<=3.9``
   * - ``1.8.1``
     - ``0.8.1``
     - ``>=3.6``, ``<=3.9``
   * - ``1.7.1``
     - ``0.7.2``
     - ``>=3.6``, ``<=3.9``
   * - ``1.7.0``
     - ``0.7.0``
     - ``>=3.6``, ``<=3.8``
   * - ``1.6.0``
     - ``0.6.0``
     - ``>=3.6``, ``<=3.8``
   * - ``1.5.0``
     - ``0.5.0``
     - ``>=3.5``, ``<=3.8``
   * - ``1.4.0``
     - ``0.4.0``
     - ``==2.7``, ``>=3.5``, ``<=3.8``