How to install torchaudio from source?

Hey guys,

I need to install the torchaudio library via source because I had to install pytorch via source too(NPACK problem).
So my question is how to install torchaudio via source becuase when I try to install this library via conda or pip my pytorch source build is being deleted and the normal pytorch is being downloaded.
In order to avoid the deinstallation of my pytorch build I have to install torchaudio via source.

Thank’s for every suggestion and help in advance:)

The install instructions are found here. Let us know, if you encounter any issues.

Hey @ptrblck,
firstly thank you very very much for your help:)

I am running in the first seconds of the installation process in this error:
(after typing the command for the linux installation: BUILD_SOX=1 python install)

-- Building version 0.9.0a0+b5d8027
running install
running bdist_egg
running egg_info
writing torchaudio.egg-info/PKG-INFO
writing dependency_links to torchaudio.egg-info/dependency_links.txt
writing requirements to torchaudio.egg-info/requires.txt
writing top-level names to torchaudio.egg-info/top_level.txt
reading manifest file 'torchaudio.egg-info/SOURCES.txt'
writing manifest file 'torchaudio.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
copying torchaudio/ -> build/lib.linux-x86_64-3.7/torchaudio
running build_ext
CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "/home/pytorch-audio/audio/build/temp.linux-x86_64-3.7/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
  File "", line 91, in <module>
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/site-packages/setuptools/", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/", line 148, in setup
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/", line 966, in run_commands
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/", line 985, in run_command
  File "/home/jan/anaconda3/envs/pytorch-build/lib/python3.7/site-packages/setuptools/command/", line 67, in run
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/site-packages/setuptools/command/", line 109, in do_egg_install
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/", line 313, in run_command
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/", line 985, in run_command
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/site-packages/setuptools/command/", line 164, in run
    cmd = self.call_command('install_lib', warn_dir=0)
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/site-packages/setuptools/command/", line 150, in call_command
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/", line 313, in run_command
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/", line 985, in run_command
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/site-packages/setuptools/command/", line 11, in run
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/command/", line 107, in build
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/", line 313, in run_command
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/", line 985, in run_command
  File "/home/pytorch-audio/audio/build_tools/setup_helpers/", line 55, in run
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/site-packages/setuptools/command/", line 79, in run
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/command/", line 340, in run
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/command/", line 449, in build_extensions
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/command/", line 474, in _build_extensions_serial
  File "/home/pytorch-audio/audio/build_tools/setup_helpers/", line 109, in build_extension
    ["cmake", str(_ROOT_DIR)] + cmake_args, cwd=self.build_temp)
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/", line 347, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '/home/pytorch-audio/audio', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_PREFIX_PATH=/home/anaconda3/envs/pytorch-build/lib/python3.7/site-packages/torch/share/cmake', '-DCMAKE_INSTALL_PREFIX=/home/pytorch-audio/audio/build/lib.linux-x86_64-3.7/torchaudio/', '-DCMAKE_VERBOSE_MAKEFILE=ON', '-

It would be very nice if you or someone else could help me out with this:)
Thanks in advance:)

do you have ninja cmake generator installed on your linux machine? see for instance here

if this is indeed needed, please feel free to open an issue on torchaudio’s github and suggesting to add this to the requirements in the readme.

Hey @vincentqb,
my machine is freezing at the end of the installation.
But thank you very very much:)
That fixed it for me:)

Hey @vincentqb,
It’s a ultimate pain to install torchaudio using BUILD_SOX=1.
It is nearly impossible to install torchaudio on systems that performing not that good:/
(my installation is breaking down at step 2 of 20)

Based on what you are saying, I recommend that you submit an issue directly on github with steps to reproduce and error output. We’ll be in a better position to investigate the issue.

Do you have a link to the NPACK issue you mentioned in the description that made you install pytorch from source?