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 setup.py 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/version.py -> 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 "setup.py", line 91, in <module>
    zip_safe=False,
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/jan/anaconda3/envs/pytorch-build/lib/python3.7/site-packages/setuptools/command/install.py", line 67, in run
    self.do_egg_install()
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/site-packages/setuptools/command/install.py", line 109, in do_egg_install
    self.run_command('bdist_egg')
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", 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/bdist_egg.py", line 150, in call_command
    self.run_command(cmdname)
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/site-packages/setuptools/command/install_lib.py", line 11, in run
    self.build()
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/command/install_lib.py", line 107, in build
    self.run_command('build_ext')
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/pytorch-audio/audio/build_tools/setup_helpers/extension.py", line 55, in run
    super().run()
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 79, in run
    _build_ext.run(self)
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
    self._build_extensions_serial()
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
    self.build_extension(ext)
  File "/home/pytorch-audio/audio/build_tools/setup_helpers/extension.py", line 109, in build_extension
    ["cmake", str(_ROOT_DIR)] + cmake_args, cwd=self.build_temp)
  File "/home/anaconda3/envs/pytorch-build/lib/python3.7/subprocess.py", 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?