Skip to content

Skip building torchvision with ffmpeg when python==3.9 #4417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,12 @@ def get_extensions():

ffmpeg_exe = distutils.spawn.find_executable('ffmpeg')
has_ffmpeg = ffmpeg_exe is not None
if sys.platform != 'linux':
# FIXME: Building torchvision with ffmpeg on MacOS or with Python 3.9
# FIXME: causes crash. See the following GitHub issues for more details.
# FIXME: https://github.com/pytorch/pytorch/issues/65000
# FIXME: https://github.com/pytorch/vision/issues/3367
if sys.platform != 'linux' or (
sys.version_info.major == 3 and sys.version_info.minor == 9):
has_ffmpeg = False
if has_ffmpeg:
try:
Expand Down
4 changes: 1 addition & 3 deletions test/common_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
import numpy as np
from PIL import Image

IS_PY39 = sys.version_info.major == 3 and sys.version_info.minor == 9
PY39_SEGFAULT_SKIP_MSG = "Segmentation fault with Python 3.9, see https://github.com/pytorch/vision/issues/3367"
PY39_SKIP = pytest.mark.skipif(IS_PY39, reason=PY39_SEGFAULT_SKIP_MSG)

IN_CIRCLE_CI = os.getenv("CIRCLECI", False) == 'true'
IN_RE_WORKER = os.environ.get("INSIDE_RE_WORKER") is not None
IN_FBCODE = os.environ.get("IN_FBCODE_TORCHVISION") == "1"
Expand Down
10 changes: 1 addition & 9 deletions test/test_video_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from numpy.random import randint
from torchvision import set_video_backend
from torchvision.io import _HAS_VIDEO_OPT
from common_utils import PY39_SKIP, assert_equal
from common_utils import assert_equal


try:
Expand Down Expand Up @@ -423,7 +423,6 @@ def test_stress_test_read_video_from_file(self):
audio_timebase_den,
)

@PY39_SKIP
def test_read_video_from_file(self):
"""
Test the case when decoder starts with a video file to decode frames.
Expand Down Expand Up @@ -469,7 +468,6 @@ def test_read_video_from_file(self):
# compare decoding results
self.compare_decoding_result(tv_result, pyav_result, config)

@PY39_SKIP
def test_read_video_from_file_read_single_stream_only(self):
"""
Test the case when decoder starts with a video file to decode frames, and
Expand Down Expand Up @@ -770,7 +768,6 @@ def test_read_video_from_file_rescale_width_and_height(self):
assert tv_result[0].size(1) == height
assert tv_result[0].size(2) == width

@PY39_SKIP
def test_read_video_from_file_audio_resampling(self):
"""
Test the case when decoder starts with a video file to decode frames, and
Expand Down Expand Up @@ -826,7 +823,6 @@ def test_read_video_from_file_audio_resampling(self):
)
assert aframes.size(0) == approx(int(duration * asample_rate.item()), abs=0.1 * asample_rate.item())

@PY39_SKIP
def test_compare_read_video_from_memory_and_file(self):
"""
Test the case when video is already in memory, and decoder reads data in memory
Expand Down Expand Up @@ -893,7 +889,6 @@ def test_compare_read_video_from_memory_and_file(self):
# finally, compare results decoded from memory and file
self.compare_decoding_result(tv_result_memory, tv_result_file)

@PY39_SKIP
def test_read_video_from_memory(self):
"""
Test the case when video is already in memory, and decoder reads data in memory
Expand Down Expand Up @@ -938,7 +933,6 @@ def test_read_video_from_memory(self):
self.check_separate_decoding_result(tv_result, config)
self.compare_decoding_result(tv_result, pyav_result, config)

@PY39_SKIP
def test_read_video_from_memory_get_pts_only(self):
"""
Test the case when video is already in memory, and decoder reads data in memory.
Expand Down Expand Up @@ -1008,7 +1002,6 @@ def test_read_video_from_memory_get_pts_only(self):
assert not tv_result_pts_only[5].numel()
self.compare_decoding_result(tv_result, tv_result_pts_only)

@PY39_SKIP
def test_read_video_in_range_from_memory(self):
"""
Test the case when video is already in memory, and decoder reads data in memory.
Expand Down Expand Up @@ -1184,7 +1177,6 @@ def test_probe_video_from_memory_script(self):
probe_result = scripted_fun(video_tensor)
self.check_meta_result(probe_result, config)

@PY39_SKIP
def test_read_video_from_memory_scripted(self):
"""
Test the case when video is already in memory, and decoder reads data in memory
Expand Down
2 changes: 0 additions & 2 deletions test/test_videoapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from torchvision.io import _HAS_VIDEO_OPT, VideoReader
from torchvision.datasets.utils import download_url

from common_utils import PY39_SKIP

try:
import av
Expand Down Expand Up @@ -65,7 +64,6 @@ def fate(name, path="."):


@pytest.mark.skipif(_HAS_VIDEO_OPT is False, reason="Didn't compile with ffmpeg")
@PY39_SKIP
class TestVideoApi:
@pytest.mark.skipif(av is None, reason="PyAV unavailable")
def test_frame_reading(self):
Expand Down