How to install torchaudio from source?

username: CracKCatZ
cooked: <p>Hey guys,</p>
<p>I need to install the torchaudio library via source because I had to install pytorch via source too(NPACK problem).<br>
So my question is how to install  torchaudio via source becuase when I try to install this library via <code>conda</code> or <code>pip</code>  my pytorch source build is being deleted and the normal pytorch is being downloaded.<br>
In order to avoid the deinstallation of my pytorch build I have to install torchaudio via source.</p>
<p>Thank’s for every suggestion and help in advance:)</p>

username: ptrblck
cooked: <p>The install instructions are found <a href="https://github.com/pytorch/audio#from-source">here</a>. Let us know, if you encounter any issues.</p>

username: CracKCatZ
cooked: <p>Hey <a class="mention" href="/u/ptrblck">@ptrblck</a>,<br>
firstly thank you very very much for your help:)</p>
<p>I am running in the first seconds of the installation process in this error:<br>
(after typing the command for the linux installation: <code>BUILD_SOX=1 python setup.py install</code>)</p>
<pre><code class="lang-auto">-- 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 -&gt; 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 &lt;module&gt;
    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', '-
</code></pre>
<p>It would be very nice if you or someone else could help me out with this:)<br>
Thanks in advance:)</p>

username: vincentqb
cooked: <p>do you have ninja cmake generator installed on your linux machine? see for instance <a href="https://stackoverflow.com/questions/38658014/ninja-not-found-by-cmake" rel="noopener nofollow ugc">here</a></p>
<p>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 <a href="https://github.com/pytorch/audio#from-source" rel="noopener nofollow ugc">readme</a>.</p>

username: CracKCatZ
cooked: <p>Hey <a class="mention" href="/u/vincentqb">@vincentqb</a>,<br>
my machine is freezing at the end of the installation.<br>
But thank you very very much:)<br>
That fixed it for me:)</p>

username: CracKCatZ
cooked: <p>Hey <a class="mention" href="/u/vincentqb">@vincentqb</a>,<br>
It’s a ultimate pain to install torchaudio using <code>BUILD_SOX=1</code>.<br>
It is nearly impossible to install torchaudio on systems that performing not that good:/<br>
(my installation is breaking down at step 2 of 20)</p>

username: vincentqb
cooked: <p>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.</p>
<p>Do you have a link to the NPACK issue you mentioned in the description that made you install pytorch from source?</p>