Skip to content

Commit

Permalink
Add Python 3.10 (build and test)
Browse files Browse the repository at this point in the history
  • Loading branch information
atalman committed Feb 16, 2022
1 parent bc0fcad commit f160db7
Show file tree
Hide file tree
Showing 8 changed files with 982 additions and 113 deletions.
1,055 changes: 949 additions & 106 deletions .circleci/config.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .circleci/regenerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from jinja2 import select_autoescape


PYTHON_VERSIONS = ["3.7", "3.8", "3.9"]
PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10"]
CU_VERSIONS_DICT = {
"linux": ["cpu", "cu102", "cu111", "cu113", "cu115", "rocm4.3.1", "rocm4.5.2"],
"windows": ["cpu", "cu113", "cu115"],
Expand Down
8 changes: 6 additions & 2 deletions .circleci/unittest/linux/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ fi

printf "Installing PyTorch with %s\n" "${cudatoolkit}"
(
if [[ "$(python --version)" = *3.10* ]]; then
CONDA_CHANNEL_FLAGS="-c conda-forge"
fi

if [ "${os}" == MacOSX ] ; then
# TODO: this can be removed as soon as linking issue could be resolved
# see https://github.com/pytorch/pytorch/issues/62424 from details
Expand All @@ -57,8 +61,8 @@ python setup.py install
# 3. Install Test tools
printf "* Installing test tools\n"
NUMBA_DEV_CHANNEL=""
if [[ "$(python --version)" = *3.9* ]]; then
# Numba isn't available for Python 3.9 except on the numba dev channel and building from source fails
if [[ "$(python --version)" = *3.9* || "$(python --version)" = *3.10* ]]; then
# Numba isn't available for Python 3.9 and 3.10 except on the numba dev channel and building from source fails
# See https://github.com/librosa/librosa/issues/1270#issuecomment-759065048
NUMBA_DEV_CHANNEL="-c numba/label/dev"
fi
Expand Down
8 changes: 7 additions & 1 deletion .circleci/unittest/linux/scripts/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ if [ ! -d "${conda_dir}" ]; then
bash ./miniconda.sh -b -f -p "${conda_dir}"
eval "$("${conda_dir}/bin/conda" shell.bash hook)"
printf "* Updating the base Python version to %s\n" "${PYTHON_VERSION}"
conda install --quiet -y python="${PYTHON_VERSION}"

ADDITIONAL_CHANNELS=""
if [[ ${PYTHON_VERSION} == 3.10 ]]; then
ADDITIONAL_CHANNELS="-c conda-forge"
fi

conda install ${ADDITIONAL_CHANNELS} --quiet -y python="${PYTHON_VERSION}"
else
eval "$("${conda_dir}/bin/conda" shell.bash hook)"
fi
Expand Down
2 changes: 1 addition & 1 deletion .circleci/unittest/windows/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ printf "* Installing torchaudio\n"
# 3. Install Test tools
printf "* Installing test tools\n"
NUMBA_DEV_CHANNEL=""
if [[ "$(python --version)" = *3.9* ]]; then
if [[ "$(python --version)" = *3.9* || "$(python --version)" = *3.10* ]]; then
# Numba isn't available for Python 3.9 except on the numba dev channel and building from source fails
# See https://github.com/librosa/librosa/issues/1270#issuecomment-759065048
NUMBA_DEV_CHANNEL="-c numba/label/dev"
Expand Down
8 changes: 7 additions & 1 deletion .circleci/unittest/windows/scripts/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ if [ ! -d "${conda_dir}" ]; then
unset miniconda_exe
eval "$("${conda_dir}/Scripts/conda.exe" 'shell.bash' 'hook')"
printf "* Updating the base Python version to %s\n" "${PYTHON_VERSION}"
conda install --quiet -y python="$PYTHON_VERSION"

ADDITIONAL_CHANNELS=""
if [[ ${PYTHON_VERSION} == 3.10 ]]; then
ADDITIONAL_CHANNELS="-c conda-forge"
fi

conda install ${ADDITIONAL_CHANNELS} --quiet -y python="$PYTHON_VERSION"
else
eval "$("${conda_dir}/Scripts/conda.exe" 'shell.bash' 'hook')"
fi
Expand Down
7 changes: 6 additions & 1 deletion packaging/build_conda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ setup_conda_cudatoolkit_constraint
setup_visual_studio_constraint

# nvidia channel included for cudatoolkit >= 11 however for 11.5 we use conda-forge
# HACK HACK HACK: Remove PYTHON_VERSION check once https://github.com/pytorch/builder/pull/961 is merged
export CUDATOOLKIT_CHANNEL="nvidia"
export ADDITIONAL_CHANNELS=""
if [[ "$CU_VERSION" == cu115 ]]; then
export CUDATOOLKIT_CHANNEL="conda-forge"
fi
if [[ "$PYTHON_VERSION" == 3.10 ]]; then
export ADDITIONAL_CHANNELS="-c conda-forge"
fi

conda build -c defaults -c $CUDATOOLKIT_CHANNEL $CONDA_CHANNEL_FLAGS --no-anaconda-upload --python "$PYTHON_VERSION" packaging/torchaudio
conda build -c defaults -c $CUDATOOLKIT_CHANNEL $CONDA_CHANNEL_FLAGS $ADDITIONAL_CHANNELS --no-anaconda-upload --python "$PYTHON_VERSION" packaging/torchaudio
5 changes: 5 additions & 0 deletions packaging/pkg_helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ setup_wheel_python() {
3.7) python_abi=cp37-cp37m ;;
3.8) python_abi=cp38-cp38 ;;
3.9) python_abi=cp39-cp39 ;;
3.10) python_abi=cp310-cp310 ;;
*)
echo "Unrecognized PYTHON_VERSION=$PYTHON_VERSION"
exit 1
Expand Down Expand Up @@ -239,6 +240,10 @@ setup_conda_pytorch_constraint() {
else
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c pytorch -c pytorch-test -c pytorch-nightly"
fi
# Some dependencies for Python 3.10 are only on conda-forge
if [[ "${PYTHON_VERSION}" = "3.10" ]]; then
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c conda-forge"
fi
if [[ "$CU_VERSION" == cpu ]]; then
export CONDA_PYTORCH_BUILD_CONSTRAINT="- pytorch==$PYTORCH_VERSION${PYTORCH_VERSION_SUFFIX}"
export CONDA_PYTORCH_CONSTRAINT="- pytorch==$PYTORCH_VERSION"
Expand Down

0 comments on commit f160db7

Please sign in to comment.