How to install torchvision from source?

Vedant_Roy: <p>I’m trying to build torchvision from source in order to use its video functions.<br>
Following the instructions in the README, I just need to do:</p>
<pre><code class="lang-auto">conda install -c conda-forge ffmpeg
python setup.py install
</code></pre>
<p>I have a virtual environment with ffmpeg installed through conda.<br>
FFMPEG version:</p>
<pre><code class="lang-auto">ffmpeg version 9c33b2f Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 9.3.0 (crosstool-NG 1.24.0.133_b0863d8_dirty)
configuration: --prefix=/home/vedant/miniconda3/envs/video-rec --cc=/home/conda/feedstock_root/build_artifacts/ffmpeg_1627813612080/_build_env/bin/x86_64-conda-linux-gnu-cc --disable-doc --disable-openssl --enable-avresample --enable-gnutls --enable-gpl --enable-hardcoded-tables --enable-libfreetype --enable-libopenh264 --enable-libx264 --enable-pic --enable-pthreads --enable-shared --enable-static --enable-version3 --enable-zlib --enable-libmp3lame --pkg-config=/home/conda/feedstock_root/build_artifacts/ffmpeg_1627813612080/_build_env/bin/pkg-config
libavutil      56. 51.100 / 56. 51.100
libavcodec     58. 91.100 / 58. 91.100
libavformat    58. 45.100 / 58. 45.100
libavdevice    58. 10.100 / 58. 10.100
libavfilter     7. 85.100 /  7. 85.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  7.100 /  5.  7.100
libswresample   3.  7.100 /  3.  7.100
libpostproc    55.  7.100 / 55.  7.100
</code></pre>
<p>After activating my environment with ffmpeg, I then build torchvision using <code>python3 setup.py install</code>.</p>
<p>However, this has 2 problems:</p>
<ol>
<li>The build output indicates that FFMPEG is not actually being used</li>
</ol>
<pre><code class="lang-auto">Compiling extensions with following flags:
  WITH_CPP_MODELS_TEST: False
  FORCE_CUDA: False
  DEBUG: False
  TORCHVISION_USE_PNG: True
  TORCHVISION_USE_JPEG: True
  TORCHVISION_USE_NVJPEG: True
  TORCHVISION_USE_FFMPEG: True
  TORCHVISION_USE_VIDEO_CODEC: True
  NVCC_FLAGS: 
Found PNG library
Building torchvision with PNG image support
  libpng version: 1.6.37
  libpng include path: /home/vedant/miniconda3/envs/video-rec/include/libpng16
Running build on conda-build: False
Running build on conda: True
Building torchvision with JPEG image support
Building torchvision without NVJPEG image support
Building torchvision without ffmpeg support
Building torchvision without video codec support
running build
</code></pre>
<ol start="2">
<li>Afterwards, I run <code>pip show torchvision</code> and the version is <code>0.13.1</code>, even though the install output indicates I am building version: <code>torchvision-0.14.0a0+c0ba3ec</code>.</li>
</ol>
<p>Anyone have thoughts on how to install torchvision from source?</p>

chirvo: <p>I came up with this while trying to compile vision from sources, hope it works for somebody who finds the same problem, at least on any Ubuntu (and possibly Debian) installation:</p>
<p>For enabling jpeg, png, and ffmpeg support for vision, run:</p>
<pre><code class="lang-auto">apt install ffmpeg libavutil-dev libavcodec-dev libavformat-dev libavdevice-dev libavfilter-dev libswscale-dev libswresample-dev libswresample-dev libpostproc-dev libjpeg-dev libpng-dev
</code></pre>