Skip to content

Commit 2f40a48

Browse files
authored
[v0.8.X] .circleci: Add Python 3.9 to CI (#3063)
1 parent e0e99c5 commit 2f40a48

File tree

13 files changed

+805
-35
lines changed

13 files changed

+805
-35
lines changed

.circleci/config.yml

Lines changed: 748 additions & 14 deletions
Large diffs are not rendered by default.

.circleci/config.yml.in

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ binary_common: &binary_common
4848
build_version:
4949
description: "version number of release binary; by default, build a nightly"
5050
type: string
51-
default: "0.8.0"
51+
default: "0.8.2"
5252
pytorch_version:
5353
description: "PyTorch version to build against; by default, use a nightly"
5454
type: string
55-
default: "1.7.0"
55+
default: "1.7.1"
5656
# Don't edit these
5757
python_version:
5858
description: "Python version to build against (e.g., 3.7)"
@@ -368,7 +368,11 @@ jobs:
368368
set -x
369369
eval "$('/C/tools/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
370370
conda env remove -n python${PYTHON_VERSION} || true
371-
conda create -yn python${PYTHON_VERSION} python=${PYTHON_VERSION}
371+
CONDA_CHANNEL_FLAGS=""
372+
if [[ "${PYTHON_VERSION}" = 3.9 ]]; then
373+
CONDA_CHANNEL_FLAGS="-c=conda-forge"
374+
fi
375+
conda create ${CONDA_CHANNEL_FLAGS} -yn python${PYTHON_VERSION} python=${PYTHON_VERSION}
372376
conda activate python${PYTHON_VERSION}
373377
conda install Pillow
374378
conda install -v -y -c pytorch-nightly pytorch
@@ -393,7 +397,11 @@ jobs:
393397
command: |
394398
set -x
395399
eval "$('/C/tools/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
396-
conda env remove -n python${PYTHON_VERSION} || true
400+
CONDA_CHANNEL_FLAGS=""
401+
if [[ "${PYTHON_VERSION}" = 3.9 ]]; then
402+
CONDA_CHANNEL_FLAGS="-c=conda-forge"
403+
fi
404+
conda create ${CONDA_CHANNEL_FLAGS} -yn python${PYTHON_VERSION} python=${PYTHON_VERSION}
397405
conda create -yn python${PYTHON_VERSION} python=${PYTHON_VERSION}
398406
conda activate python${PYTHON_VERSION}
399407
pip install $(ls ~/workspace/torchvision*.whl) --pre -f https://download.pytorch.org/whl/nightly/torch_nightly.html
@@ -464,7 +472,7 @@ jobs:
464472
{% endraw %}
465473
- run:
466474
name: Setup
467-
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/setup_env.sh
475+
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e PYTHON_VERSION "${image_name}" .circleci/unittest/linux/scripts/setup_env.sh
468476
- save_cache:
469477
{% raw %}
470478
key: env-v2-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".circleci-weekly" }}
@@ -474,7 +482,7 @@ jobs:
474482
- env
475483
- run:
476484
name: Install torchvision
477-
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL "${image_name}" .circleci/unittest/linux/scripts/install.sh
485+
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux/scripts/install.sh
478486
- run:
479487
name: Run tests
480488
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/run_test.sh

.circleci/regenerate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import os.path
2020

2121

22-
PYTHON_VERSIONS = ["3.6", "3.7", "3.8"]
22+
PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]
2323

2424

2525
def build_workflows(prefix='', filter_branch=None, upload=False, indentation=6, windows_latest_only=False):

.circleci/unittest/linux/scripts/environment.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
channels:
22
- pytorch
33
- defaults
4+
# using conda-forge for python v3.9+
5+
- conda-forge
46
dependencies:
57
- numpy
68
- pytest
79
- pytest-cov
810
- codecov
911
- pip
1012
- libpng
11-
- jpeg
13+
- jpeg <= 9b
1214
- ca-certificates
15+
- av
1316
- pip:
1417
- future
1518
- pillow>=4.1.1
1619
- scipy
17-
- av

.circleci/unittest/linux/scripts/install.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,14 @@ else
2222
version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
2323
cudatoolkit="cudatoolkit=${version}"
2424
fi
25+
26+
CONDA_CHANNEL_FLAGS=""
27+
if [[ "$(python --version)" = *3.9* ]]; then
28+
CONDA_CHANNEL_FLAGS="-c=conda-forge"
29+
fi
30+
2531
printf "Installing PyTorch with %s\n" "${cudatoolkit}"
26-
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" pytorch "${cudatoolkit}"
32+
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" ${CONDA_CHANNEL_FLAGS} pytorch "${cudatoolkit}"
2733

2834
printf "* Installing torchvision\n"
2935
python setup.py develop

.circleci/unittest/linux/scripts/run_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ eval "$(./conda/bin/conda shell.bash hook)"
66
conda activate ./env
77

88
python -m torch.utils.collect_env
9-
pytest --cov=torchvision --junitxml=test-results/junit.xml -v --durations 20 test --ignore=test/test_datasets_download.py
9+
pytest --cov=torchvision --junitxml=test-results/junit.xml -v --durations 20 test --ignore=test/test_datasets_download.py
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
channels:
22
- pytorch
33
- defaults
4+
# use conda-forge for python v3.9+
5+
- conda-forge
46
dependencies:
57
- numpy
68
- pytest
79
- pytest-cov
810
- codecov
911
- pip
1012
- libpng
11-
- jpeg
13+
- jpeg <= 9b
1214
- ca-certificates
15+
- av
1316
- pip:
1417
- future
1518
- pillow>=4.1.1
16-
- scipy==1.4.1
17-
- av
19+
- scipy>=1.4.1
1820
- dataclasses

.circleci/unittest/windows/scripts/install.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,14 @@ else
2424
version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
2525
cudatoolkit="cudatoolkit=${version}"
2626
fi
27+
28+
CONDA_CHANNEL_FLAGS=""
29+
if [[ "$(python --version)" = *3.9* ]]; then
30+
CONDA_CHANNEL_FLAGS="-c=conda-forge"
31+
fi
32+
2733
printf "Installing PyTorch with %s\n" "${cudatoolkit}"
28-
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" pytorch "${cudatoolkit}"
34+
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" ${CONDA_CHANNEL_FLAGS} pytorch "${cudatoolkit}"
2935

3036
printf "* Installing torchvision\n"
3137
"$this_dir/vc_env_helper.bat" python setup.py develop

packaging/pkg_helpers.bash

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,13 @@ setup_wheel_python() {
179179
if [[ "$(uname)" == Darwin || "$OSTYPE" == "msys" ]]; then
180180
eval "$(conda shell.bash hook)"
181181
conda env remove -n "env$PYTHON_VERSION" || true
182-
conda create -yn "env$PYTHON_VERSION" python="$PYTHON_VERSION"
182+
if [[ "$PYTHON_VERSION" == 3.9 ]]; then
183+
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c=conda-forge"
184+
fi
185+
conda create ${CONDA_CHANNEL_FLAGS} -yn "env$PYTHON_VERSION" python="$PYTHON_VERSION"
183186
conda activate "env$PYTHON_VERSION"
184187
# Install libpng from Anaconda (defaults)
185-
conda install libpng jpeg -y
188+
conda install ${CONDA_CHANNEL_FLAGS} -c conda-forge libpng "jpeg<=9b" -y
186189
else
187190
# Install native CentOS libJPEG, LAME, freetype and GnuTLS
188191
yum install -y libjpeg-turbo-devel lame freetype gnutls
@@ -198,6 +201,7 @@ setup_wheel_python() {
198201
3.6) python_abi=cp36-cp36m ;;
199202
3.7) python_abi=cp37-cp37m ;;
200203
3.8) python_abi=cp38-cp38 ;;
204+
3.9) python_abi=cp39-cp39 ;;
201205
*)
202206
echo "Unrecognized PYTHON_VERSION=$PYTHON_VERSION"
203207
exit 1
@@ -272,6 +276,9 @@ setup_conda_pytorch_constraint() {
272276
if [[ "$OSTYPE" == msys && "$CU_VERSION" == cu92 ]]; then
273277
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c defaults -c numba/label/dev"
274278
fi
279+
if [[ "$PYTHON_VERSION" == 3.9 ]]; then
280+
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c=conda-forge"
281+
fi
275282
}
276283

277284
# Translate CUDA_VERSION into CUDA_CUDATOOLKIT_CONSTRAINT

packaging/torchvision/meta.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ requirements:
99
build:
1010
- {{ compiler('c') }} # [win]
1111
- libpng
12-
- jpeg
12+
- jpeg <=9b
1313

1414
host:
1515
- python
@@ -21,7 +21,7 @@ requirements:
2121
run:
2222
- python
2323
- libpng
24-
- jpeg
24+
- jpeg <=9b
2525
- pillow >=4.1.1
2626
- numpy >=1.11
2727
{{ environ.get('CONDA_PYTORCH_CONSTRAINT') }}
@@ -48,7 +48,8 @@ test:
4848
requires:
4949
- pytest
5050
- scipy
51-
- av =8.0.1
51+
- av >=8.0.1
52+
- jpeg <=9b
5253
- ca-certificates
5354
{{ environ.get('CONDA_TYPING_CONSTRAINT') }}
5455

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,9 @@ def get_extensions():
330330
))
331331

332332
ffmpeg_exe = distutils.spawn.find_executable('ffmpeg')
333-
has_ffmpeg = ffmpeg_exe is not None
333+
# Disable ffmpeg by default
334+
no_ffmpeg = os.environ.get("NO_FFMPEG", True)
335+
has_ffmpeg = ffmpeg_exe is not None and not no_ffmpeg
334336
print("FFmpeg found: {}".format(has_ffmpeg))
335337

336338
if has_ffmpeg:

test/test_video.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ def _template_read_video(video_object, s=0, e=None):
276276
return video_frames, audio_frames, video_object.get_metadata()
277277

278278

279+
@unittest.skip("ffmpeg isn't included in this release skip these tests")
279280
@unittest.skipIf(_HAS_VIDEO_OPT is False, "Didn't compile with ffmpeg")
280281
class TestVideo(unittest.TestCase):
281282
@unittest.skipIf(av is None, "PyAV unavailable")

test/test_video_reader.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ def _get_video_tensor(video_dir, video_file):
269269
return full_path, video_tensor
270270

271271

272+
@unittest.skip("ffmpeg was not included in this release")
272273
@unittest.skipIf(av is None, "PyAV unavailable")
273274
@unittest.skipIf(_HAS_VIDEO_OPT is False, "Didn't compile with ffmpeg")
274275
class TestVideoReader(unittest.TestCase):

0 commit comments

Comments
 (0)