Skip to content

Commit 06d8284

Browse files
Modify installation instructions (#4081)
1 parent 4ef8525 commit 06d8284

File tree

5 files changed

+3
-165
lines changed

5 files changed

+3
-165
lines changed

docs/source/build.jetson.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ Verify the installation by checking the version and CUDA device accessibility.
128128

129129
.. code-block::
130130
131-
sudo apt install ffmpeg libavformat-dev libavcodec-dev libavutil-dev libavdevice-dev libavfilter-dev
131+
sudo apt install libavformat-dev libavcodec-dev libavutil-dev libavdevice-dev libavfilter-dev
132132
133133
3. Build TorchAudio
134134
~~~~~~~~~~~~~~~~~~~

docs/source/build.linux.rst

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,3 @@ Here, we install nightly build.
4444
To use ``pip``, please use ``--no-use-pep517`` option.
4545

4646
``pip install -v -e . --no-use-pep517``
47-
48-
[Optional] Build TorchAudio with a custom built FFmpeg
49-
------------------------------------------------------
50-
51-
By default, torchaudio tries to build FFmpeg extension with support for multiple FFmpeg versions. This process uses pre-built FFmpeg libraries compiled for specific CPU architectures like ``x86_64`` and ``aarch64`` (``arm64``).
52-
53-
If your CPU is not one of those, then the build process can fail. To workaround, one can disable FFmpeg integration (by setting the environment variable ``USE_FFMPEG=0``) or switch to the single version FFmpeg extension.
54-
55-
To build single version FFmpeg extension, FFmpeg binaries must be provided by user and available in the build environment. To do so, install FFmpeg and set ``FFMPEG_ROOT`` environment variable to specify the location of FFmpeg.
56-
57-
.. code-block::
58-
59-
conda install -c conda-forge ffmpeg
60-
FFMPEG_ROOT=${CONDA_PREFIX} pip install -e . -v --no-build-isolation

docs/source/build.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Building from source
22
====================
33

4-
TorchAudio integrates PyTorch for numerical computation and third party libraries for multimedia I/O. It requires the following tools to build from source.
4+
TorchAudio integrates PyTorch for numerical computation. It requires the following tools to build from source.
55

66
- `PyTorch <https://pytorch.org>`_
77
- `CMake <https://cmake.org/>`_
@@ -22,15 +22,12 @@ TorchAudio integrates PyTorch for numerical computation and third party librarie
2222
Customizing the build
2323
---------------------
2424

25-
TorchAudio's integration with third party libraries can be enabled/disabled via
25+
Optional features of torchaudio can be enabled/disabled via
2626
environment variables.
2727

2828
They can be enabled by passing ``1`` and disabled by ``0``.
2929

30-
- ``BUILD_SOX``: Enable/disable I/O features based on libsox.
31-
- ``BUILD_KALDI``: Enable/disable feature extraction based on Kaldi.
3230
- ``BUILD_RNNT``: Enable/disable custom RNN-T loss function.
33-
- ``USE_FFMPEG``: Enable/disable I/O features based on FFmpeg libraries.
3431
- ``USE_ROCM``: Enable/disable AMD ROCm support.
3532
- ``USE_CUDA``: Enable/disable CUDA support.
3633

docs/source/build.windows.rst

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -131,102 +131,3 @@ Now that we have everything ready, we can build TorchAudio.
131131
To use ``pip``, please use ``--no-use-pep517`` option.
132132

133133
``pip install -v -e . --no-use-pep517``
134-
135-
[Optional] Build TorchAudio with a custom FFmpeg
136-
------------------------------------------------
137-
138-
By default, torchaudio tries to build FFmpeg extension with support for multiple FFmpeg versions. This process uses pre-built FFmpeg libraries compiled for specific CPU architectures like ``x86_64``.
139-
140-
If your CPU is different, then the build process can fail. To workaround, one can disable FFmpeg integration (by setting the environment variable ``USE_FFMPEG=0``) or switch to the single version FFmpeg extension.
141-
142-
To build single version FFmpeg extension, FFmpeg binaries must be provided by user and available in the build environment. To do so, install FFmpeg and set ``FFMPEG_ROOT`` environment variable to specify the location of FFmpeg.
143-
144-
.. code-block::
145-
146-
conda install -c conda-forge ffmpeg
147-
FFMPEG_ROOT=${CONDA_PREFIX}/Library pip install -e . -v --no-build-isolation
148-
149-
150-
[Optional] Building FFmpeg from source
151-
--------------------------------------
152-
153-
The following section illustrates a way to build FFmpeg libraries from source.
154-
155-
Conda-forge's FFmpeg package comes with support for major codecs and GPU decoders, so regular users and developers do not need to build FFmpeg from source.
156-
157-
If you are not using Conda, then you can either find a pre-built binary distribution or build FFmpeg by yourself.
158-
159-
Also, in case torchaudio developer needs to update and customize the CI for FFmpeg build, this section might be helpful.
160-
161-
1. Install MSYS2
162-
~~~~~~~~~~~~~~~~
163-
164-
To build FFmpeg in a way it is usable from the TorchAudio development environment, we need to build binaries native to ``MINGW64``. To do so, we need tools required by FFmpeg's build process, such as ``pkg-config`` and ``make``, that work in ``MINGW64`` environment. For this purpose, we use MSYS2.
165-
166-
FFmpeg's official documentation touches this https://trac.ffmpeg.org/wiki/CompilationGuide/MinGW
167-
168-
Please follow the instruction at https://www.msys2.org/ to install MSYS2.
169-
170-
.. note::
171-
172-
In CI environment, often `Chocolatery <https://chocolatey.org/>`_ can be used to install MSYS2.
173-
174-
2. Launch MSYS2
175-
~~~~~~~~~~~~~~~
176-
177-
Use the shortcut to launch MSYS2 (MINGW64).
178-
179-
.. image:: https://download.pytorch.org/torchaudio/doc-assets/windows-msys2.png
180-
:width: 360px
181-
182-
.. note::
183-
184-
The Bash environment in MSYS2 does not play well with Conda env, so do not add Conda initialization script in ``~/.bashrc`` of MSYS2 environment. (i.e. ``C:\msys2\home\USER\.bashrc``) Instead, add it in ``C:\Users\USER\.bashrc``)
185-
186-
3. Install build tools
187-
~~~~~~~~~~~~~~~~~~~~~~
188-
189-
.. code-block::
190-
191-
$ pacman -S mingw-w64-x86_64-make
192-
$ pacman -S mingw-w64-x86_64-yasm
193-
194-
After the installation, you should have packages similar to the following;
195-
196-
.. code-block::
197-
198-
$ pacman -Qe
199-
base 2020.12-1
200-
base-devel 2022.01-2
201-
filesystem 2023.01-2
202-
mingw-w64-x86_64-make 4.3-1
203-
mingw-w64-x86_64-pkgconf 1.8.0-2
204-
mingw-w64-x86_64-yasm 1.3.0-4
205-
msys2-runtime 3.4.3-5
206-
207-
4. Build FFmpeg
208-
~~~~~~~~~~~~~~~
209-
210-
Check out FFmpeg source code.
211-
212-
.. code-block::
213-
214-
git clone https://github.com/ffmpeg/ffmpeg
215-
cd ffmpeg
216-
git checkout <VERSION>
217-
218-
Build
219-
220-
.. code-block::
221-
222-
./configure --toolchain=msvc
223-
make -j
224-
225-
If the build succeeds, ``ffmpeg.exe`` should be found in the same directory. Make sure that you can run it.
226-
227-
5. Verify the build
228-
~~~~~~~~~~~~~~~~~~~
229-
230-
Check that the resulting FFmpeg binary is accessible from Conda env
231-
232-
Now launch a new command prompt and enable the TorchAudio development environment. Make sure that you can run the ``ffmpeg.exe`` command generated in the previous step.

docs/source/installation.rst

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ Please refer to https://pytorch.org/get-started/locally/ for the details.
1515
Starting ``0.10``, torchaudio has CPU-only and CUDA-enabled binary distributions,
1616
each of which requires a corresponding PyTorch distribution.
1717

18-
.. 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-
2118
Dependencies
2219
------------
2320

@@ -30,49 +27,6 @@ Dependencies
3027
Optional Dependencies
3128
~~~~~~~~~~~~~~~~~~~~~
3229

33-
.. _ffmpeg_dependency:
34-
35-
* `FFmpeg <https://ffmpeg.org>`__
36-
37-
Starting version 2.1, TorchAudio official binary distributions are compatible with
38-
FFmpeg version 6, 5 and 4. (>=4.4, <7). At runtime, TorchAudio first looks for FFmpeg 6,
39-
if not found, then it continues to looks for 5 and move on to 4.
40-
41-
There are multiple ways to install FFmpeg libraries.
42-
Please refer to the official documentation for how to install FFmpeg.
43-
If you are using Anaconda Python distribution,
44-
``conda install -c conda-forge 'ffmpeg<7'`` will install
45-
compatible FFmpeg libraries.
46-
47-
If you need to specify the version of FFmpeg TorchAudio searches and links, you can
48-
specify it via the environment variable ``TORIO_USE_FFMPEG_VERSION``. For example,
49-
by setting ``TORIO_USE_FFMPEG_VERSION=5``, TorchAudio will only look for FFmpeg
50-
5.
51-
52-
If for some reason, this search mechanism is causing an issue, you can disable
53-
the FFmpeg integration entirely by setting the environment variable
54-
``TORIO_USE_FFMPEG=0``.
55-
56-
There are multiple ways to install FFmpeg libraries.
57-
If you are using Anaconda Python distribution,
58-
``conda install -c conda-forge 'ffmpeg<7'`` will install
59-
compatible FFmpeg libraries.
60-
61-
.. note::
62-
63-
When searching for FFmpeg installation, TorchAudio looks for library files
64-
which have names with version numbers.
65-
That is, ``libavutil.so.<VERSION>`` for Linux, ``libavutil.<VERSION>.dylib``
66-
for macOS, and ``avutil-<VERSION>.dll`` for Windows.
67-
Many public pre-built binaries follow this naming scheme, but some distributions
68-
have un-versioned file names.
69-
If you are having difficulties detecting FFmpeg, double check that the library
70-
files you installed follow this naming scheme, (and then make sure
71-
that they are in one of the directories listed in library search path.)
72-
73-
* `SoundFile <https://pypi.org/project/PySoundFile/>`__
74-
75-
Required to use ``backend="soundfile"`` in `I/O functions <./torchaudio.html#i-o>`__.
7630

7731
* `sentencepiece <https://pypi.org/project/sentencepiece/>`__
7832

0 commit comments

Comments
 (0)