Skip to content

Commit 377d9ef

Browse files
NicolasHugfacebook-github-bot
authored andcommitted
[fbsync] Skip building torchvision with ffmpeg when python==3.9 (#4417)
Summary: * Skip building torchvision with ffmpeg when python==3.9 * Add FIXME to comments Reviewed By: datumbox Differential Revision: D31268057 fbshipit-source-id: 71d3ee6c2e0f5cc373bf730804e1d5172a2d6a9d
1 parent 646d5e4 commit 377d9ef

File tree

4 files changed

+8
-15
lines changed

4 files changed

+8
-15
lines changed

setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,12 @@ def get_extensions():
351351

352352
ffmpeg_exe = distutils.spawn.find_executable('ffmpeg')
353353
has_ffmpeg = ffmpeg_exe is not None
354-
if sys.platform != 'linux':
354+
# FIXME: Building torchvision with ffmpeg on MacOS or with Python 3.9
355+
# FIXME: causes crash. See the following GitHub issues for more details.
356+
# FIXME: https://github.com/pytorch/pytorch/issues/65000
357+
# FIXME: https://github.com/pytorch/vision/issues/3367
358+
if sys.platform != 'linux' or (
359+
sys.version_info.major == 3 and sys.version_info.minor == 9):
355360
has_ffmpeg = False
356361
if has_ffmpeg:
357362
try:

test/common_utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
import numpy as np
2121
from PIL import Image
2222

23-
IS_PY39 = sys.version_info.major == 3 and sys.version_info.minor == 9
24-
PY39_SEGFAULT_SKIP_MSG = "Segmentation fault with Python 3.9, see https://github.com/pytorch/vision/issues/3367"
25-
PY39_SKIP = pytest.mark.skipif(IS_PY39, reason=PY39_SEGFAULT_SKIP_MSG)
23+
2624
IN_CIRCLE_CI = os.getenv("CIRCLECI", False) == 'true'
2725
IN_RE_WORKER = os.environ.get("INSIDE_RE_WORKER") is not None
2826
IN_FBCODE = os.environ.get("IN_FBCODE_TORCHVISION") == "1"

test/test_video_reader.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from numpy.random import randint
1313
from torchvision import set_video_backend
1414
from torchvision.io import _HAS_VIDEO_OPT
15-
from common_utils import PY39_SKIP, assert_equal
15+
from common_utils import assert_equal
1616

1717

1818
try:
@@ -423,7 +423,6 @@ def test_stress_test_read_video_from_file(self):
423423
audio_timebase_den,
424424
)
425425

426-
@PY39_SKIP
427426
def test_read_video_from_file(self):
428427
"""
429428
Test the case when decoder starts with a video file to decode frames.
@@ -469,7 +468,6 @@ def test_read_video_from_file(self):
469468
# compare decoding results
470469
self.compare_decoding_result(tv_result, pyav_result, config)
471470

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

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

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

896-
@PY39_SKIP
897892
def test_read_video_from_memory(self):
898893
"""
899894
Test the case when video is already in memory, and decoder reads data in memory
@@ -938,7 +933,6 @@ def test_read_video_from_memory(self):
938933
self.check_separate_decoding_result(tv_result, config)
939934
self.compare_decoding_result(tv_result, pyav_result, config)
940935

941-
@PY39_SKIP
942936
def test_read_video_from_memory_get_pts_only(self):
943937
"""
944938
Test the case when video is already in memory, and decoder reads data in memory.
@@ -1008,7 +1002,6 @@ def test_read_video_from_memory_get_pts_only(self):
10081002
assert not tv_result_pts_only[5].numel()
10091003
self.compare_decoding_result(tv_result, tv_result_pts_only)
10101004

1011-
@PY39_SKIP
10121005
def test_read_video_in_range_from_memory(self):
10131006
"""
10141007
Test the case when video is already in memory, and decoder reads data in memory.
@@ -1184,7 +1177,6 @@ def test_probe_video_from_memory_script(self):
11841177
probe_result = scripted_fun(video_tensor)
11851178
self.check_meta_result(probe_result, config)
11861179

1187-
@PY39_SKIP
11881180
def test_read_video_from_memory_scripted(self):
11891181
"""
11901182
Test the case when video is already in memory, and decoder reads data in memory

test/test_videoapi.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from torchvision.io import _HAS_VIDEO_OPT, VideoReader
1010
from torchvision.datasets.utils import download_url
1111

12-
from common_utils import PY39_SKIP
1312

1413
try:
1514
import av
@@ -65,7 +64,6 @@ def fate(name, path="."):
6564

6665

6766
@pytest.mark.skipif(_HAS_VIDEO_OPT is False, reason="Didn't compile with ffmpeg")
68-
@PY39_SKIP
6967
class TestVideoApi:
7068
@pytest.mark.skipif(av is None, reason="PyAV unavailable")
7169
def test_frame_reading(self):

0 commit comments

Comments
 (0)