Skip to content
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

[v0.8.X] .circleci: Add Python 3.9 to CI #3063

Merged
merged 16 commits into from
Dec 4, 2020
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
762 changes: 748 additions & 14 deletions .circleci/config.yml

Large diffs are not rendered by default.

20 changes: 14 additions & 6 deletions .circleci/config.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ binary_common: &binary_common
build_version:
description: "version number of release binary; by default, build a nightly"
type: string
default: "0.8.0"
default: "0.8.2"
pytorch_version:
description: "PyTorch version to build against; by default, use a nightly"
type: string
default: "1.7.0"
default: "1.7.1"
# Don't edit these
python_version:
description: "Python version to build against (e.g., 3.7)"
Expand Down Expand Up @@ -368,7 +368,11 @@ jobs:
set -x
eval "$('/C/tools/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
conda env remove -n python${PYTHON_VERSION} || true
conda create -yn python${PYTHON_VERSION} python=${PYTHON_VERSION}
CONDA_CHANNEL_FLAGS=""
if [[ "${PYTHON_VERSION}" = 3.9 ]]; then
CONDA_CHANNEL_FLAGS="-c=conda-forge"
fi
conda create ${CONDA_CHANNEL_FLAGS} -yn python${PYTHON_VERSION} python=${PYTHON_VERSION}
conda activate python${PYTHON_VERSION}
conda install Pillow
conda install -v -y -c pytorch-nightly pytorch
Expand All @@ -393,7 +397,11 @@ jobs:
command: |
set -x
eval "$('/C/tools/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
conda env remove -n python${PYTHON_VERSION} || true
CONDA_CHANNEL_FLAGS=""
if [[ "${PYTHON_VERSION}" = 3.9 ]]; then
CONDA_CHANNEL_FLAGS="-c=conda-forge"
fi
conda create ${CONDA_CHANNEL_FLAGS} -yn python${PYTHON_VERSION} python=${PYTHON_VERSION}
conda create -yn python${PYTHON_VERSION} python=${PYTHON_VERSION}
conda activate python${PYTHON_VERSION}
pip install $(ls ~/workspace/torchvision*.whl) --pre -f https://download.pytorch.org/whl/nightly/torch_nightly.html
Expand Down Expand Up @@ -464,7 +472,7 @@ jobs:
{% endraw %}
- run:
name: Setup
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/setup_env.sh
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e PYTHON_VERSION "${image_name}" .circleci/unittest/linux/scripts/setup_env.sh
- save_cache:
{% raw %}
key: env-v2-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".circleci-weekly" }}
Expand All @@ -474,7 +482,7 @@ jobs:
- env
- run:
name: Install torchvision
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL "${image_name}" .circleci/unittest/linux/scripts/install.sh
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
- run:
name: Run tests
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/run_test.sh
Expand Down
2 changes: 1 addition & 1 deletion .circleci/regenerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import os.path


PYTHON_VERSIONS = ["3.6", "3.7", "3.8"]
PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]


def build_workflows(prefix='', filter_branch=None, upload=False, indentation=6, windows_latest_only=False):
Expand Down
6 changes: 4 additions & 2 deletions .circleci/unittest/linux/scripts/environment.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
channels:
- pytorch
- defaults
# using conda-forge for python v3.9+
- conda-forge
dependencies:
- numpy
- pytest
- pytest-cov
- codecov
- pip
- libpng
- jpeg
- jpeg <= 9b
- ca-certificates
- av
- pip:
- future
- pillow>=4.1.1
- scipy
- av
8 changes: 7 additions & 1 deletion .circleci/unittest/linux/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ else
version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
cudatoolkit="cudatoolkit=${version}"
fi

CONDA_CHANNEL_FLAGS=""
if [[ "$(python --version)" = *3.9* ]]; then
CONDA_CHANNEL_FLAGS="-c=conda-forge"
fi

printf "Installing PyTorch with %s\n" "${cudatoolkit}"
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" pytorch "${cudatoolkit}"
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" ${CONDA_CHANNEL_FLAGS} pytorch "${cudatoolkit}"

printf "* Installing torchvision\n"
python setup.py develop
2 changes: 1 addition & 1 deletion .circleci/unittest/linux/scripts/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ eval "$(./conda/bin/conda shell.bash hook)"
conda activate ./env

python -m torch.utils.collect_env
pytest --cov=torchvision --junitxml=test-results/junit.xml -v --durations 20 test --ignore=test/test_datasets_download.py
pytest --cov=torchvision --junitxml=test-results/junit.xml -v --durations 20 test --ignore=test/test_datasets_download.py
8 changes: 5 additions & 3 deletions .circleci/unittest/windows/scripts/environment.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
channels:
- pytorch
- defaults
# use conda-forge for python v3.9+
- conda-forge
dependencies:
- numpy
- pytest
- pytest-cov
- codecov
- pip
- libpng
- jpeg
- jpeg <= 9b
- ca-certificates
- av
- pip:
- future
- pillow>=4.1.1
- scipy==1.4.1
- av
- scipy>=1.4.1
- dataclasses
8 changes: 7 additions & 1 deletion .circleci/unittest/windows/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ else
version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
cudatoolkit="cudatoolkit=${version}"
fi

CONDA_CHANNEL_FLAGS=""
if [[ "$(python --version)" = *3.9* ]]; then
CONDA_CHANNEL_FLAGS="-c=conda-forge"
fi

printf "Installing PyTorch with %s\n" "${cudatoolkit}"
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" pytorch "${cudatoolkit}"
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" ${CONDA_CHANNEL_FLAGS} pytorch "${cudatoolkit}"

printf "* Installing torchvision\n"
"$this_dir/vc_env_helper.bat" python setup.py develop
11 changes: 9 additions & 2 deletions packaging/pkg_helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,13 @@ setup_wheel_python() {
if [[ "$(uname)" == Darwin || "$OSTYPE" == "msys" ]]; then
eval "$(conda shell.bash hook)"
conda env remove -n "env$PYTHON_VERSION" || true
conda create -yn "env$PYTHON_VERSION" python="$PYTHON_VERSION"
if [[ "$PYTHON_VERSION" == 3.9 ]]; then
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c=conda-forge"
fi
conda create ${CONDA_CHANNEL_FLAGS} -yn "env$PYTHON_VERSION" python="$PYTHON_VERSION"
conda activate "env$PYTHON_VERSION"
# Install libpng from Anaconda (defaults)
conda install libpng jpeg -y
conda install ${CONDA_CHANNEL_FLAGS} -c conda-forge libpng "jpeg<=9b" -y
else
# Install native CentOS libJPEG, LAME, freetype and GnuTLS
yum install -y libjpeg-turbo-devel lame freetype gnutls
Expand All @@ -198,6 +201,7 @@ setup_wheel_python() {
3.6) python_abi=cp36-cp36m ;;
3.7) python_abi=cp37-cp37m ;;
3.8) python_abi=cp38-cp38 ;;
3.9) python_abi=cp39-cp39 ;;
*)
echo "Unrecognized PYTHON_VERSION=$PYTHON_VERSION"
exit 1
Expand Down Expand Up @@ -272,6 +276,9 @@ setup_conda_pytorch_constraint() {
if [[ "$OSTYPE" == msys && "$CU_VERSION" == cu92 ]]; then
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c defaults -c numba/label/dev"
fi
if [[ "$PYTHON_VERSION" == 3.9 ]]; then
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c=conda-forge"
fi
}

# Translate CUDA_VERSION into CUDA_CUDATOOLKIT_CONSTRAINT
Expand Down
7 changes: 4 additions & 3 deletions packaging/torchvision/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ requirements:
build:
- {{ compiler('c') }} # [win]
- libpng
- jpeg
- jpeg <=9b

host:
- python
Expand All @@ -21,7 +21,7 @@ requirements:
run:
- python
- libpng
- jpeg
- jpeg <=9b
- pillow >=4.1.1
- numpy >=1.11
{{ environ.get('CONDA_PYTORCH_CONSTRAINT') }}
Expand All @@ -48,7 +48,8 @@ test:
requires:
- pytest
- scipy
- av =8.0.1
- av >=8.0.1
- jpeg <=9b
- ca-certificates
{{ environ.get('CONDA_TYPING_CONSTRAINT') }}

Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,9 @@ def get_extensions():
))

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

if has_ffmpeg:
Expand Down
1 change: 1 addition & 0 deletions test/test_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ def _template_read_video(video_object, s=0, e=None):
return video_frames, audio_frames, video_object.get_metadata()


@unittest.skip("ffmpeg isn't included in this release skip these tests")
@unittest.skipIf(_HAS_VIDEO_OPT is False, "Didn't compile with ffmpeg")
class TestVideo(unittest.TestCase):
@unittest.skipIf(av is None, "PyAV unavailable")
Expand Down
1 change: 1 addition & 0 deletions test/test_video_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ def _get_video_tensor(video_dir, video_file):
return full_path, video_tensor


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