From 9eaed4454810215918ca9d3ed9a73aea3f656d94 Mon Sep 17 00:00:00 2001 From: Joao Gomes Date: Mon, 6 Jun 2022 09:21:58 -0700 Subject: [PATCH] [fbsync] [M1] Install "jpeg<=9b" rather than OpenJpeg (#6122) Summary: Explicitly set PATH to point to `conda` binary, otherwise libjpeg detection logic does not work Pin libjpeg to the same version on x86 and m1 Add simple tests that jpeg can be decoded by a generated wheel Reviewed By: NicolasHug Differential Revision: D36931836 fbshipit-source-id: d8a3bcc4f7ec513b95cd325e33bdf2aa695500e4 --- .github/workflows/build-m1-binaries.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-m1-binaries.yml b/.github/workflows/build-m1-binaries.yml index 09fb74ee273..b03cefbf25d 100644 --- a/.github/workflows/build-m1-binaries.yml +++ b/.github/workflows/build-m1-binaries.yml @@ -24,11 +24,13 @@ jobs: PY_VERS: ${{ matrix.py_vers }} run: | . ~/miniconda3/etc/profile.d/conda.sh + # Needed for JPEG library detection as setup.py detects conda presence by running `shlex.which('conda')` + export PATH=~/miniconda3/bin:$PATH set -ex . packaging/pkg_helpers.bash setup_build_version WHL_NAME=torchvision-${BUILD_VERSION}-cp${PY_VERS/.}-cp${PY_VERS/.}-macosx_11_0_arm64.whl - conda create -yp ${ENV_NAME} python=${PY_VERS} numpy libpng openjpeg wheel pkg-config + conda create -yp ${ENV_NAME} python=${PY_VERS} numpy libpng "jpeg<=9b" wheel pkg-config conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/nightly conda run -p ${ENV_NAME} python3 -mpip install delocate conda run -p ${ENV_NAME} python3 setup.py bdist_wheel @@ -49,6 +51,7 @@ jobs: # Test torch is importable, by changing cwd and running import commands conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torchvision;print('torchvision version is ', torchvision.__version__)" conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torch;import torchvision;print('Is torchvision useable?', all(x is not None for x in [torch.ops.image.decode_png, torch.ops.torchvision.roi_align]))" + conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torchvision;print(torchvision.io.read_image('${PWD}/gallery/assets/dog1.jpg').shape)" conda env remove -p ${ENV_NAME} - name: Upload wheel to GitHub uses: actions/upload-artifact@v3