diff --git a/.github/workflows/cpp_tests.yaml b/.github/workflows/cpp_tests.yaml index e08d90754..44dd288d6 100644 --- a/.github/workflows/cpp_tests.yaml +++ b/.github/workflows/cpp_tests.yaml @@ -1,73 +1,73 @@ -name: CPP tests +# name: CPP tests -on: - push: - branches: [ main ] - pull_request: +# on: +# push: +# branches: [ main ] +# pull_request: -concurrency: - group: unit-test${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_number || github.ref }} - cancel-in-progress: true +# concurrency: +# group: unit-test${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_number || github.ref }} +# cancel-in-progress: true -defaults: - run: - shell: bash -l -eo pipefail {0} +# defaults: +# run: +# shell: bash -l -eo pipefail {0} -jobs: - Cpp-tests: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - ffmpeg-version-for-tests: ['4.4.2', '5.1.2', '6.1.1', '7.0.1'] - steps: - - name: Check out repo - uses: actions/checkout@v3 - - name: Setup conda env - uses: conda-incubator/setup-miniconda@v3 - with: - auto-update-conda: true - # Using miniforge instead of miniconda ensures that the default - # conda channel is conda-forge instead of main/default. This ensures - # ABI consistency between dependencies: - # https://conda-forge.org/docs/user/transitioning_from_defaults/ - miniforge-version: latest - activate-environment: test - python-version: '3.12' - - name: Update pip - run: python -m pip install --upgrade pip - - name: Install torch dependencies - run: | - python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu - - name: Install ffmpeg, pkg-config and pybind11 - run: | - conda install "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" pkg-config pybind11 -c conda-forge - ffmpeg -version - - name: Build and run C++ tests - run: | - # Note: we're not setting BUILD_AGAINST_ALL_FFMPEG_FROM_S3 here, so - # we're building libtorchcodec against the installed FFmpeg version - # (from conda-forge) instead of building against our pre-built non-GPL - # FFmpeg libraries. - # The reason we need this is because the C++ tests decode x264 files. - # x264 support is not LGPL, os it is not supported by our - # pre-built non-GPL FFmpeg libraries. And if we were to build against - # those, this is also what the tests would be loading at run time, - # then failing when we try to decode x264. - # To remediate that, we build against the FFmpeg that we installed - # from conda-forge (which is able to decode x264), and that's also - # what gets loaded at run time. - # The Python tests are also decoding x264 files, and are built against - # our non-GPL FFmpeg. And yet they pass. This is because in Python - # we're able to distinguish between build-time (non-GPL FFmpeg) and - # run time (conda-forge FFmpeg). +# jobs: +# Cpp-tests: +# runs-on: ubuntu-latest +# strategy: +# fail-fast: false +# matrix: +# ffmpeg-version-for-tests: ['4.4.2', '5.1.2', '6.1.1', '7.0.1'] +# steps: +# - name: Check out repo +# uses: actions/checkout@v3 +# - name: Setup conda env +# uses: conda-incubator/setup-miniconda@v3 +# with: +# auto-update-conda: true +# # Using miniforge instead of miniconda ensures that the default +# # conda channel is conda-forge instead of main/default. This ensures +# # ABI consistency between dependencies: +# # https://conda-forge.org/docs/user/transitioning_from_defaults/ +# miniforge-version: latest +# activate-environment: test +# python-version: '3.12' +# - name: Update pip +# run: python -m pip install --upgrade pip +# - name: Install torch dependencies +# run: | +# python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu +# - name: Install ffmpeg, pkg-config and pybind11 +# run: | +# conda install "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" pkg-config pybind11 -c conda-forge +# ffmpeg -version +# - name: Build and run C++ tests +# run: | +# # Note: we're not setting BUILD_AGAINST_ALL_FFMPEG_FROM_S3 here, so +# # we're building libtorchcodec against the installed FFmpeg version +# # (from conda-forge) instead of building against our pre-built non-GPL +# # FFmpeg libraries. +# # The reason we need this is because the C++ tests decode x264 files. +# # x264 support is not LGPL, os it is not supported by our +# # pre-built non-GPL FFmpeg libraries. And if we were to build against +# # those, this is also what the tests would be loading at run time, +# # then failing when we try to decode x264. +# # To remediate that, we build against the FFmpeg that we installed +# # from conda-forge (which is able to decode x264), and that's also +# # what gets loaded at run time. +# # The Python tests are also decoding x264 files, and are built against +# # our non-GPL FFmpeg. And yet they pass. This is because in Python +# # we're able to distinguish between build-time (non-GPL FFmpeg) and +# # run time (conda-forge FFmpeg). - build_tests_dir="${PWD}/build_tests" - mkdir $build_tests_dir - pushd $build_tests_dir - TORCH_PATH=$(python -c "import pathlib, torch; print(pathlib.Path(torch.__path__[0]))") - Torch_DIR="${TORCH_PATH}/share/cmake/Torch" - cmake .. -DTorch_DIR=$Torch_DIR -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DCMAKE_VERBOSE_MAKEFILE=ON - cmake --build . - ctest --output-on-failure - popd +# build_tests_dir="${PWD}/build_tests" +# mkdir $build_tests_dir +# pushd $build_tests_dir +# TORCH_PATH=$(python -c "import pathlib, torch; print(pathlib.Path(torch.__path__[0]))") +# Torch_DIR="${TORCH_PATH}/share/cmake/Torch" +# cmake .. -DTorch_DIR=$Torch_DIR -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DCMAKE_VERBOSE_MAKEFILE=ON +# cmake --build . +# ctest --output-on-failure +# popd diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 60bfbfa2e..39aaec1a1 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -1,116 +1,116 @@ -name: Docs +# name: Docs -on: - push: - branches: [ main ] - pull_request: +# on: +# push: +# branches: [ main ] +# pull_request: -permissions: - id-token: write - contents: write +# permissions: +# id-token: write +# contents: write -defaults: - run: - shell: bash -l -eo pipefail {0} +# defaults: +# run: +# shell: bash -l -eo pipefail {0} -jobs: - generate-matrix: - uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main - with: - package-type: wheel - os: linux - test-infra-repository: pytorch/test-infra - test-infra-ref: main - with-cpu: disable - with-xpu: disable - with-rocm: disable - with-cuda: enable - build-python-only: "disable" - build: - needs: generate-matrix - strategy: - fail-fast: false - name: Build and Upload wheel - uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main - with: - repository: pytorch/torchcodec - ref: "" - test-infra-repository: pytorch/test-infra - test-infra-ref: main - build-matrix: ${{ needs.generate-matrix.outputs.matrix }} - pre-script: packaging/pre_build_script.sh - post-script: packaging/post_build_script.sh - smoke-test-script: packaging/fake_smoke_test.py - package-name: torchcodec - trigger-event: ${{ github.event_name }} - build-platform: "python-build-package" - build-command: "BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 ENABLE_CUDA=1 python -m build --wheel -vvv --no-isolation" +# jobs: +# generate-matrix: +# uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main +# with: +# package-type: wheel +# os: linux +# test-infra-repository: pytorch/test-infra +# test-infra-ref: main +# with-cpu: disable +# with-xpu: disable +# with-rocm: disable +# with-cuda: enable +# build-python-only: "disable" +# build: +# needs: generate-matrix +# strategy: +# fail-fast: false +# name: Build and Upload wheel +# uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main +# with: +# repository: pytorch/torchcodec +# ref: "" +# test-infra-repository: pytorch/test-infra +# test-infra-ref: main +# build-matrix: ${{ needs.generate-matrix.outputs.matrix }} +# pre-script: packaging/pre_build_script.sh +# post-script: packaging/post_build_script.sh +# smoke-test-script: packaging/fake_smoke_test.py +# package-name: torchcodec +# trigger-event: ${{ github.event_name }} +# build-platform: "python-build-package" +# build-command: "BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 ENABLE_CUDA=1 python -m build --wheel -vvv --no-isolation" - build-docs: - runs-on: linux.4xlarge.nvidia.gpu - strategy: - fail-fast: false - matrix: - # 3.9 corresponds to the minimum python version for which we build - # the wheel unless the label cliflow/binaries/all is present in the - # PR. - python-version: ['3.9'] - cuda-version: ['12.6'] - ffmpeg-version-for-tests: ['7'] - container: - image: "pytorch/manylinux2_28-builder:cuda${{ matrix.cuda-version }}" - options: "--gpus all -e NVIDIA_DRIVER_CAPABILITIES=video,compute,utility" - needs: build - steps: - - name: Setup env vars - run: | - cuda_version_without_periods=$(echo "${{ matrix.cuda-version }}" | sed 's/\.//g') - echo cuda_version_without_periods=${cuda_version_without_periods} >> $GITHUB_ENV - python_version_without_periods=$(echo "${{ matrix.python-version }}" | sed 's/\.//g') - echo python_version_without_periods=${python_version_without_periods} >> $GITHUB_ENV - - uses: actions/download-artifact@v4 - with: - name: pytorch_torchcodec__${{ matrix.python-version }}_cu${{ env.cuda_version_without_periods }}_x86_64 - path: pytorch/torchcodec/dist/ - - name: Setup miniconda using test-infra - uses: pytorch/test-infra/.github/actions/setup-miniconda@main - with: - python-version: ${{ matrix.python-version }} - # We install conda packages at the start because otherwise conda may have conflicts with dependencies. - default-packages: "nvidia/label/cuda-${{ matrix.cuda-version }}.0::libnpp nvidia::cuda-nvrtc=${{ matrix.cuda-version }} nvidia::cuda-toolkit=${{ matrix.cuda-version }} nvidia::cuda-cudart=${{ matrix.cuda-version }} nvidia::cuda-driver-dev=${{ matrix.cuda-version }} conda-forge::ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" - - name: Check env - run: | - ${CONDA_RUN} env - ${CONDA_RUN} conda info - ${CONDA_RUN} nvidia-smi - ${CONDA_RUN} conda list - - name: Assert ffmpeg exists - run: | - ${CONDA_RUN} ffmpeg -buildconf - - name: Update pip - run: ${CONDA_RUN} python -m pip install --upgrade pip - - name: Install PyTorch - run: | - ${CONDA_RUN} python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu${{ env.cuda_version_without_periods }} - ${CONDA_RUN} python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}"); print(f"{torch.cuda.is_available()=}")' - - name: Install torchcodec from the wheel - run: | - wheel_path=`find pytorch/torchcodec/dist -type f -name "*cu${{ env.cuda_version_without_periods }}-cp${{ env.python_version_without_periods }}*.whl"` - echo Installing $wheel_path - ${CONDA_RUN} python -m pip install $wheel_path -vvv +# build-docs: +# runs-on: linux.4xlarge.nvidia.gpu +# strategy: +# fail-fast: false +# matrix: +# # 3.9 corresponds to the minimum python version for which we build +# # the wheel unless the label cliflow/binaries/all is present in the +# # PR. +# python-version: ['3.9'] +# cuda-version: ['12.6'] +# ffmpeg-version-for-tests: ['7'] +# container: +# image: "pytorch/manylinux2_28-builder:cuda${{ matrix.cuda-version }}" +# options: "--gpus all -e NVIDIA_DRIVER_CAPABILITIES=video,compute,utility" +# needs: build +# steps: +# - name: Setup env vars +# run: | +# cuda_version_without_periods=$(echo "${{ matrix.cuda-version }}" | sed 's/\.//g') +# echo cuda_version_without_periods=${cuda_version_without_periods} >> $GITHUB_ENV +# python_version_without_periods=$(echo "${{ matrix.python-version }}" | sed 's/\.//g') +# echo python_version_without_periods=${python_version_without_periods} >> $GITHUB_ENV +# - uses: actions/download-artifact@v4 +# with: +# name: pytorch_torchcodec__${{ matrix.python-version }}_cu${{ env.cuda_version_without_periods }}_x86_64 +# path: pytorch/torchcodec/dist/ +# - name: Setup miniconda using test-infra +# uses: pytorch/test-infra/.github/actions/setup-miniconda@main +# with: +# python-version: ${{ matrix.python-version }} +# # We install conda packages at the start because otherwise conda may have conflicts with dependencies. +# default-packages: "nvidia/label/cuda-${{ matrix.cuda-version }}.0::libnpp nvidia::cuda-nvrtc=${{ matrix.cuda-version }} nvidia::cuda-toolkit=${{ matrix.cuda-version }} nvidia::cuda-cudart=${{ matrix.cuda-version }} nvidia::cuda-driver-dev=${{ matrix.cuda-version }} conda-forge::ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" +# - name: Check env +# run: | +# ${CONDA_RUN} env +# ${CONDA_RUN} conda info +# ${CONDA_RUN} nvidia-smi +# ${CONDA_RUN} conda list +# - name: Assert ffmpeg exists +# run: | +# ${CONDA_RUN} ffmpeg -buildconf +# - name: Update pip +# run: ${CONDA_RUN} python -m pip install --upgrade pip +# - name: Install PyTorch +# run: | +# ${CONDA_RUN} python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu${{ env.cuda_version_without_periods }} +# ${CONDA_RUN} python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}"); print(f"{torch.cuda.is_available()=}")' +# - name: Install torchcodec from the wheel +# run: | +# wheel_path=`find pytorch/torchcodec/dist -type f -name "*cu${{ env.cuda_version_without_periods }}-cp${{ env.python_version_without_periods }}*.whl"` +# echo Installing $wheel_path +# ${CONDA_RUN} python -m pip install $wheel_path -vvv - - name: Check out repo - uses: actions/checkout@v3 +# - name: Check out repo +# uses: actions/checkout@v3 - - name: Install doc dependencies - run: | - cd docs - ${CONDA_RUN} python -m pip install -r requirements.txt - - name: Build docs - run: | - cd docs - ${CONDA_RUN} make html - - uses: actions/upload-artifact@v4 - with: - name: Built-Docs - path: docs/build/html/ +# - name: Install doc dependencies +# run: | +# cd docs +# ${CONDA_RUN} python -m pip install -r requirements.txt +# - name: Build docs +# run: | +# cd docs +# ${CONDA_RUN} make html +# - uses: actions/upload-artifact@v4 +# with: +# name: Built-Docs +# path: docs/build/html/ diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index c156a833c..6ed79d88c 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,76 +1,76 @@ -name: Lint +# name: Lint -on: - push: - branches: [ main ] - pull_request: +# on: +# push: +# branches: [ main ] +# pull_request: -concurrency: - group: unit-test${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_number || github.ref }} - cancel-in-progress: true +# concurrency: +# group: unit-test${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_number || github.ref }} +# cancel-in-progress: true -defaults: - run: - shell: bash -l -eo pipefail {0} +# defaults: +# run: +# shell: bash -l -eo pipefail {0} -jobs: - pre-commit-checks: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ['3.12'] - steps: - - name: Check out repo - uses: actions/checkout@v3 - - name: Setup conda env - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - miniconda-version: "latest" - activate-environment: test - python-version: ${{ matrix.python-version }} - - name: Update pip - run: python -m pip install --upgrade pip - - name: Install pre-commit - run: | - python -m pip install pre-commit - - name: Run pre-commit checks - run: | - pre-commit run --all-files - - name: Check to see what files pre-commit modified - run: | - git diff +# jobs: +# pre-commit-checks: +# runs-on: ubuntu-latest +# strategy: +# fail-fast: false +# matrix: +# python-version: ['3.12'] +# steps: +# - name: Check out repo +# uses: actions/checkout@v3 +# - name: Setup conda env +# uses: conda-incubator/setup-miniconda@v2 +# with: +# auto-update-conda: true +# miniconda-version: "latest" +# activate-environment: test +# python-version: ${{ matrix.python-version }} +# - name: Update pip +# run: python -m pip install --upgrade pip +# - name: Install pre-commit +# run: | +# python -m pip install pre-commit +# - name: Run pre-commit checks +# run: | +# pre-commit run --all-files +# - name: Check to see what files pre-commit modified +# run: | +# git diff - mypy: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ['3.12'] - steps: - - name: Check out repo - uses: actions/checkout@v3 - - name: Setup conda env - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - miniconda-version: "latest" - activate-environment: test - python-version: ${{ matrix.python-version }} - - name: Update pip - run: python -m pip install --upgrade pip - - name: Install dependencies and FFmpeg - run: | - python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu - conda install "ffmpeg=7.0.1" pkg-config pybind11 -c conda-forge - ffmpeg -version - - name: Build and install torchcodec - run: | - python -m pip install -e ".[dev]" --no-build-isolation -vvv - - name: Install mypy - run: | - python -m pip install mypy - - name: Run mypy - run: | - mypy --install-types --non-interactive --config-file mypy.ini +# mypy: +# runs-on: ubuntu-latest +# strategy: +# fail-fast: false +# matrix: +# python-version: ['3.12'] +# steps: +# - name: Check out repo +# uses: actions/checkout@v3 +# - name: Setup conda env +# uses: conda-incubator/setup-miniconda@v2 +# with: +# auto-update-conda: true +# miniconda-version: "latest" +# activate-environment: test +# python-version: ${{ matrix.python-version }} +# - name: Update pip +# run: python -m pip install --upgrade pip +# - name: Install dependencies and FFmpeg +# run: | +# python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu +# conda install "ffmpeg=7.0.1" pkg-config pybind11 -c conda-forge +# ffmpeg -version +# - name: Build and install torchcodec +# run: | +# python -m pip install -e ".[dev]" --no-build-isolation -vvv +# - name: Install mypy +# run: | +# python -m pip install mypy +# - name: Run mypy +# run: | +# mypy --install-types --non-interactive --config-file mypy.ini diff --git a/.github/workflows/linux_cuda_wheel.yaml b/.github/workflows/linux_cuda_wheel.yaml index bd57cac5e..ffc21ab46 100644 --- a/.github/workflows/linux_cuda_wheel.yaml +++ b/.github/workflows/linux_cuda_wheel.yaml @@ -56,88 +56,88 @@ jobs: build-platform: "python-build-package" build-command: "BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 ENABLE_CUDA=1 python -m build --wheel -vvv --no-isolation" - install-and-test: - runs-on: linux.g5.4xlarge.nvidia.gpu - strategy: - fail-fast: false - matrix: - # 3.9 corresponds to the minimum python version for which we build - # the wheel unless the label cliflow/binaries/all is present in the - # PR. - # For the actual release we should add that label and change this to - # include more python versions. - python-version: ['3.9'] - cuda-version: ['12.6', '12.8'] - # TODO: put back ffmpeg 5 https://github.com/pytorch/torchcodec/issues/325 - ffmpeg-version-for-tests: ['4.4.2', '6', '7'] + # install-and-test: + # runs-on: linux.g5.4xlarge.nvidia.gpu + # strategy: + # fail-fast: false + # matrix: + # # 3.9 corresponds to the minimum python version for which we build + # # the wheel unless the label cliflow/binaries/all is present in the + # # PR. + # # For the actual release we should add that label and change this to + # # include more python versions. + # python-version: ['3.9'] + # cuda-version: ['12.6', '12.8'] + # # TODO: put back ffmpeg 5 https://github.com/pytorch/torchcodec/issues/325 + # ffmpeg-version-for-tests: ['4.4.2', '6', '7'] - container: - image: "pytorch/manylinux2_28-builder:cuda${{ matrix.cuda-version }}" - options: "--gpus all -e NVIDIA_DRIVER_CAPABILITIES=video,compute,utility" - needs: build - steps: - - name: Setup env vars - run: | - cuda_version_without_periods=$(echo "${{ matrix.cuda-version }}" | sed 's/\.//g') - echo cuda_version_without_periods=${cuda_version_without_periods} >> $GITHUB_ENV - python_version_without_periods=$(echo "${{ matrix.python-version }}" | sed 's/\.//g') - echo python_version_without_periods=${python_version_without_periods} >> $GITHUB_ENV - - uses: actions/download-artifact@v4 - with: - name: pytorch_torchcodec__${{ matrix.python-version }}_cu${{ env.cuda_version_without_periods }}_x86_64 - path: pytorch/torchcodec/dist/ - - name: Setup miniconda using test-infra - uses: pytorch/test-infra/.github/actions/setup-miniconda@main - with: - python-version: ${{ matrix.python-version }} - # We install conda packages at the start because otherwise conda may have conflicts with dependencies. - default-packages: "nvidia/label/cuda-${{ matrix.cuda-version }}.0::libnpp nvidia::cuda-nvrtc=${{ matrix.cuda-version }} nvidia::cuda-toolkit=${{ matrix.cuda-version }} nvidia::cuda-cudart=${{ matrix.cuda-version }} nvidia::cuda-driver-dev=${{ matrix.cuda-version }} conda-forge::ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" - - name: Check env - run: | - ${CONDA_RUN} env - ${CONDA_RUN} conda info - ${CONDA_RUN} nvidia-smi - ${CONDA_RUN} conda list - - name: Assert ffmpeg exists - run: | - ${CONDA_RUN} ffmpeg -buildconf - - name: Update pip - run: ${CONDA_RUN} python -m pip install --upgrade pip - - name: Install PyTorch - run: | - ${CONDA_RUN} python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu${{ env.cuda_version_without_periods }} - ${CONDA_RUN} python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}"); print(f"{torch.cuda.is_available()=}")' - - name: Install torchcodec from the wheel - run: | - wheel_path=`find pytorch/torchcodec/dist -type f -name "*cu${{ env.cuda_version_without_periods }}-cp${{ env.python_version_without_periods }}*.whl"` - echo Installing $wheel_path - ${CONDA_RUN} python -m pip install $wheel_path -vvv + # container: + # image: "pytorch/manylinux2_28-builder:cuda${{ matrix.cuda-version }}" + # options: "--gpus all -e NVIDIA_DRIVER_CAPABILITIES=video,compute,utility" + # needs: build + # steps: + # - name: Setup env vars + # run: | + # cuda_version_without_periods=$(echo "${{ matrix.cuda-version }}" | sed 's/\.//g') + # echo cuda_version_without_periods=${cuda_version_without_periods} >> $GITHUB_ENV + # python_version_without_periods=$(echo "${{ matrix.python-version }}" | sed 's/\.//g') + # echo python_version_without_periods=${python_version_without_periods} >> $GITHUB_ENV + # - uses: actions/download-artifact@v4 + # with: + # name: pytorch_torchcodec__${{ matrix.python-version }}_cu${{ env.cuda_version_without_periods }}_x86_64 + # path: pytorch/torchcodec/dist/ + # - name: Setup miniconda using test-infra + # uses: pytorch/test-infra/.github/actions/setup-miniconda@main + # with: + # python-version: ${{ matrix.python-version }} + # # We install conda packages at the start because otherwise conda may have conflicts with dependencies. + # default-packages: "nvidia/label/cuda-${{ matrix.cuda-version }}.0::libnpp nvidia::cuda-nvrtc=${{ matrix.cuda-version }} nvidia::cuda-toolkit=${{ matrix.cuda-version }} nvidia::cuda-cudart=${{ matrix.cuda-version }} nvidia::cuda-driver-dev=${{ matrix.cuda-version }} conda-forge::ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" + # - name: Check env + # run: | + # ${CONDA_RUN} env + # ${CONDA_RUN} conda info + # ${CONDA_RUN} nvidia-smi + # ${CONDA_RUN} conda list + # - name: Assert ffmpeg exists + # run: | + # ${CONDA_RUN} ffmpeg -buildconf + # - name: Update pip + # run: ${CONDA_RUN} python -m pip install --upgrade pip + # - name: Install PyTorch + # run: | + # ${CONDA_RUN} python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu${{ env.cuda_version_without_periods }} + # ${CONDA_RUN} python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}"); print(f"{torch.cuda.is_available()=}")' + # - name: Install torchcodec from the wheel + # run: | + # wheel_path=`find pytorch/torchcodec/dist -type f -name "*cu${{ env.cuda_version_without_periods }}-cp${{ env.python_version_without_periods }}*.whl"` + # echo Installing $wheel_path + # ${CONDA_RUN} python -m pip install $wheel_path -vvv - - name: Check out repo - uses: actions/checkout@v3 + # - name: Check out repo + # uses: actions/checkout@v3 - - name: Install test dependencies - run: | - # Ideally we would find a way to get those dependencies from pyproject.toml - ${CONDA_RUN} python -m pip install numpy pytest pillow + # - name: Install test dependencies + # run: | + # # Ideally we would find a way to get those dependencies from pyproject.toml + # ${CONDA_RUN} python -m pip install numpy pytest pillow - - name: Delete the src/ folder just for fun - run: | - # The only reason we checked-out the repo is to get access to the - # tests. We don't care about the rest. Out of precaution, we delete - # the src/ folder to be extra sure that we're running the code from - # the installed wheel rather than from the source. - # This is just to be extra cautious and very overkill because a) - # there's no way the `torchcodec` package from src/ can be found from - # the PythonPath: the main point of `src/` is precisely to protect - # against that and b) if we ever were to execute code from - # `src/torchcodec`, it would fail loudly because the built .so files - # aren't present there. - rm -r src/ - ls - - name: Run Python tests - run: | - ${CONDA_RUN} FAIL_WITHOUT_CUDA=1 pytest test -v --tb=short - - name: Run Python benchmark - run: | - ${CONDA_RUN} time python benchmarks/decoders/gpu_benchmark.py --devices=cuda:0,cpu --resize_devices=none + # - name: Delete the src/ folder just for fun + # run: | + # # The only reason we checked-out the repo is to get access to the + # # tests. We don't care about the rest. Out of precaution, we delete + # # the src/ folder to be extra sure that we're running the code from + # # the installed wheel rather than from the source. + # # This is just to be extra cautious and very overkill because a) + # # there's no way the `torchcodec` package from src/ can be found from + # # the PythonPath: the main point of `src/` is precisely to protect + # # against that and b) if we ever were to execute code from + # # `src/torchcodec`, it would fail loudly because the built .so files + # # aren't present there. + # rm -r src/ + # ls + # - name: Run Python tests + # run: | + # ${CONDA_RUN} FAIL_WITHOUT_CUDA=1 pytest test -v --tb=short + # - name: Run Python benchmark + # run: | + # ${CONDA_RUN} time python benchmarks/decoders/gpu_benchmark.py --devices=cuda:0,cpu --resize_devices=none diff --git a/.github/workflows/linux_wheel.yaml b/.github/workflows/linux_wheel.yaml index 1855e904e..58086b0bc 100644 --- a/.github/workflows/linux_wheel.yaml +++ b/.github/workflows/linux_wheel.yaml @@ -57,70 +57,70 @@ jobs: build-platform: "python-build-package" build-command: "BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 python -m build --wheel -vvv --no-isolation" - install-and-test: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ['3.9'] - ffmpeg-version-for-tests: ['4.4.2', '5.1.2', '6.1.1', '7.0.1'] - needs: build - steps: - - uses: actions/download-artifact@v4 - with: - name: pytorch_torchcodec__${{ matrix.python-version }}_cpu_x86_64 - path: pytorch/torchcodec/dist/ - - name: Setup conda env - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - miniconda-version: "latest" - activate-environment: test - python-version: ${{ matrix.python-version }} - - name: Update pip - run: python -m pip install --upgrade pip - - name: Install PyTorch - run: | - python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu - - name: Install torchcodec from the wheel - run: | - wheel_path=`find pytorch/torchcodec/dist -type f -name "*.whl"` - echo Installing $wheel_path - python -m pip install $wheel_path -vvv + # install-and-test: + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # python-version: ['3.9'] + # ffmpeg-version-for-tests: ['4.4.2', '5.1.2', '6.1.1', '7.0.1'] + # needs: build + # steps: + # - uses: actions/download-artifact@v4 + # with: + # name: pytorch_torchcodec__${{ matrix.python-version }}_cpu_x86_64 + # path: pytorch/torchcodec/dist/ + # - name: Setup conda env + # uses: conda-incubator/setup-miniconda@v2 + # with: + # auto-update-conda: true + # miniconda-version: "latest" + # activate-environment: test + # python-version: ${{ matrix.python-version }} + # - name: Update pip + # run: python -m pip install --upgrade pip + # - name: Install PyTorch + # run: | + # python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu + # - name: Install torchcodec from the wheel + # run: | + # wheel_path=`find pytorch/torchcodec/dist -type f -name "*.whl"` + # echo Installing $wheel_path + # python -m pip install $wheel_path -vvv - - name: Check out repo - uses: actions/checkout@v3 - - name: Install ffmpeg, post build - run: | - # Ideally we would have checked for that before installing the wheel, - # but we need to checkout the repo to access this file, and we don't - # want to checkout the repo before installing the wheel to avoid any - # side-effect. It's OK. - source packaging/helpers.sh - assert_ffmpeg_not_installed + # - name: Check out repo + # uses: actions/checkout@v3 + # - name: Install ffmpeg, post build + # run: | + # # Ideally we would have checked for that before installing the wheel, + # # but we need to checkout the repo to access this file, and we don't + # # want to checkout the repo before installing the wheel to avoid any + # # side-effect. It's OK. + # source packaging/helpers.sh + # assert_ffmpeg_not_installed - conda install "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" -c conda-forge - ffmpeg -version + # conda install "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" -c conda-forge + # ffmpeg -version - - name: Install test dependencies - run: | - # Ideally we would find a way to get those dependencies from pyproject.toml - python -m pip install numpy pytest pillow + # - name: Install test dependencies + # run: | + # # Ideally we would find a way to get those dependencies from pyproject.toml + # python -m pip install numpy pytest pillow - - name: Delete the src/ folder just for fun - run: | - # The only reason we checked-out the repo is to get access to the - # tests. We don't care about the rest. Out of precaution, we delete - # the src/ folder to be extra sure that we're running the code from - # the installed wheel rather than from the source. - # This is just to be extra cautious and very overkill because a) - # there's no way the `torchcodec` package from src/ can be found from - # the PythonPath: the main point of `src/` is precisely to protect - # against that and b) if we ever were to execute code from - # `src/torchcodec`, it would fail loudly because the built .so files - # aren't present there. - rm -r src/ - ls - - name: Run Python tests - run: | - pytest test -vvv + # - name: Delete the src/ folder just for fun + # run: | + # # The only reason we checked-out the repo is to get access to the + # # tests. We don't care about the rest. Out of precaution, we delete + # # the src/ folder to be extra sure that we're running the code from + # # the installed wheel rather than from the source. + # # This is just to be extra cautious and very overkill because a) + # # there's no way the `torchcodec` package from src/ can be found from + # # the PythonPath: the main point of `src/` is precisely to protect + # # against that and b) if we ever were to execute code from + # # `src/torchcodec`, it would fail loudly because the built .so files + # # aren't present there. + # rm -r src/ + # ls + # - name: Run Python tests + # run: | + # pytest test -vvv diff --git a/.github/workflows/macos_wheel.yaml b/.github/workflows/macos_wheel.yaml index ee436b7a4..ad6c00fee 100644 --- a/.github/workflows/macos_wheel.yaml +++ b/.github/workflows/macos_wheel.yaml @@ -58,68 +58,68 @@ jobs: build-platform: "python-build-package" build-command: "BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 python -m build --wheel -vvv --no-isolation" - install-and-test: - runs-on: macos-14-xlarge - strategy: - fail-fast: false - matrix: - python-version: ['3.9'] - ffmpeg-version-for-tests: ['4.4.2', '5.1.2', '6.1.1', '7.0.1'] - needs: build - steps: - - name: Download wheel - uses: actions/download-artifact@v4 - with: - name: pytorch_torchcodec__${{ matrix.python-version }}_cpu_ - path: pytorch/torchcodec/dist/ - - - name: Setup conda env - uses: conda-incubator/setup-miniconda@v3 - with: - auto-update-conda: true - miniconda-version: "latest" - activate-environment: test - python-version: ${{ matrix.python-version }} - - name: Update pip - run: python -m pip install --upgrade pip - - - name: Install PyTorch - run: | - python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu - - - name: Install torchcodec from the wheel - run: | - wheel_path=`find pytorch/torchcodec/dist -type f -name "*.whl"` - echo Installing $wheel_path - python -m pip install $wheel_path -vvv - - - name: Check out torchcodec repo - uses: actions/checkout@v3 - - - name: Install ffmpeg - run: | - conda install "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" -c conda-forge - ffmpeg -version - - - name: Install test dependencies - run: | - python -m pip install numpy pytest pillow - - - name: Delete the src/ folder just for fun - run: | - # The only reason we checked-out the repo is to get access to the - # tests. We don't care about the rest. Out of precaution, we delete - # the src/ folder to be extra sure that we're running the code from - # the installed wheel rather than from the source. - # This is just to be extra cautious and very overkill because a) - # there's no way the `torchcodec` package from src/ can be found from - # the PythonPath: the main point of `src/` is precisely to protect - # against that and b) if we ever were to execute code from - # `src/torchcodec`, it would fail loudly because the built .so files - # aren't present there. - rm -r src/ - ls -lh - - - name: Run Python tests - run: | - pytest test -vvv + # install-and-test: + # runs-on: macos-14-xlarge + # strategy: + # fail-fast: false + # matrix: + # python-version: ['3.9'] + # ffmpeg-version-for-tests: ['4.4.2', '5.1.2', '6.1.1', '7.0.1'] + # needs: build + # steps: + # - name: Download wheel + # uses: actions/download-artifact@v4 + # with: + # name: pytorch_torchcodec__${{ matrix.python-version }}_cpu_ + # path: pytorch/torchcodec/dist/ + + # - name: Setup conda env + # uses: conda-incubator/setup-miniconda@v3 + # with: + # auto-update-conda: true + # miniconda-version: "latest" + # activate-environment: test + # python-version: ${{ matrix.python-version }} + # - name: Update pip + # run: python -m pip install --upgrade pip + + # - name: Install PyTorch + # run: | + # python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu + + # - name: Install torchcodec from the wheel + # run: | + # wheel_path=`find pytorch/torchcodec/dist -type f -name "*.whl"` + # echo Installing $wheel_path + # python -m pip install $wheel_path -vvv + + # - name: Check out torchcodec repo + # uses: actions/checkout@v3 + + # - name: Install ffmpeg + # run: | + # conda install "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" -c conda-forge + # ffmpeg -version + + # - name: Install test dependencies + # run: | + # python -m pip install numpy pytest pillow + + # - name: Delete the src/ folder just for fun + # run: | + # # The only reason we checked-out the repo is to get access to the + # # tests. We don't care about the rest. Out of precaution, we delete + # # the src/ folder to be extra sure that we're running the code from + # # the installed wheel rather than from the source. + # # This is just to be extra cautious and very overkill because a) + # # there's no way the `torchcodec` package from src/ can be found from + # # the PythonPath: the main point of `src/` is precisely to protect + # # against that and b) if we ever were to execute code from + # # `src/torchcodec`, it would fail loudly because the built .so files + # # aren't present there. + # rm -r src/ + # ls -lh + + # - name: Run Python tests + # run: | + # pytest test -vvv diff --git a/.github/workflows/windows_source_build.yaml b/.github/workflows/windows_source_build.yaml new file mode 100644 index 000000000..04c359251 --- /dev/null +++ b/.github/workflows/windows_source_build.yaml @@ -0,0 +1,196 @@ +name: Build and test Windows from source + +on: + pull_request: + push: + branches: + - nightly + - main + - release/* + tags: + - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }} + cancel-in-progress: true + +permissions: + id-token: write + contents: read + +defaults: + run: + shell: bash -l -eo pipefail {0} + +jobs: + build-and-test: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + python-version: ['3.9'] + ffmpeg-version: ['4.4.2', '5.1.2', '6.1.1', '7.0.1'] + steps: + - name: Check out repo + uses: actions/checkout@v3 + + - name: Setup conda env + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + miniconda-version: "latest" + activate-environment: build + python-version: ${{ matrix.python-version }} + + - name: Install FFmpeg + run: | + # Install FFmpeg and try to get development packages + conda install "ffmpeg=${{ matrix.ffmpeg-version }}" -c conda-forge --quiet + + ffmpeg -version + + # On Windows, ensure the conda Library/bin directory is in PATH + # This is needed for both pkg-config to find FFmpeg and for DLL loading + conda_env_path=$(conda info --base)/envs/build + library_bin_path="$conda_env_path/Library/bin" + library_lib_path="$conda_env_path/Library/lib" + library_include_path="$conda_env_path/Library/include" + + echo "Adding conda Library paths:" + echo " bin: $library_bin_path" + echo " lib: $library_lib_path" + echo " include: $library_include_path" + + echo "$library_bin_path" >> $GITHUB_PATH + + # Also add Library/lib/pkgconfig to PKG_CONFIG_PATH for cmake to find FFmpeg + pkg_config_path="$conda_env_path/Library/lib/pkgconfig" + echo "Adding to PKG_CONFIG_PATH: $pkg_config_path" + echo "PKG_CONFIG_PATH=$pkg_config_path" >> $GITHUB_ENV + + # Set additional environment variables that CMake might need + echo "CMAKE_PREFIX_PATH=$conda_env_path/Library" >> $GITHUB_ENV + echo "LIBRARY_PATH=$library_lib_path" >> $GITHUB_ENV + echo "INCLUDE_PATH=$library_include_path" >> $GITHUB_ENV + + # Add the Library/lib directory to the linker path for Visual Studio + echo "LIB=$library_lib_path;$LIB" >> $GITHUB_ENV + echo "LIBPATH=$library_lib_path;$LIBPATH" >> $GITHUB_ENV + + # Verify FFmpeg DLLs are accessible + echo "Checking if FFmpeg DLLs are in PATH:" + where avutil.dll || echo "avutil.dll not found in PATH" + where avcodec.dll || echo "avcodec.dll not found in PATH" + where avformat.dll || echo "avformat.dll not found in PATH" + + - name: Install build dependencies + run: | + # Install pkg-config and pybind11 which are needed for Windows builds + conda install -y pkg-config pybind11 -c conda-forge --quiet + + # Try to install missing dependencies that FFmpeg might need + echo "Installing additional dependencies that might be missing..." + conda install -y harfbuzz freetype zlib bzip2 -c conda-forge --quiet || echo "Some dependencies might already be installed" + + # Inspect what's actually in the Library directory + echo "Contents of Library/lib:" + ls -la "$CONDA_PREFIX/Library/lib/" | head -20 + echo "Looking for harfbuzz files:" + find "$CONDA_PREFIX/Library/" -name "*harfbuzz*" 2>/dev/null || echo "No harfbuzz files found" + echo "Looking for freetype files:" + find "$CONDA_PREFIX/Library/" -name "*freetype*" 2>/dev/null || echo "No freetype files found" + + # Check if the .lib files exist with the exact names pkg-config expects + conda_env_path=$(conda info --base)/envs/build + library_lib_path="$conda_env_path/Library/lib" + + echo "Checking for specific .lib files in $library_lib_path:" + ls -la "$library_lib_path/harfbuzz.lib" 2>/dev/null || echo "harfbuzz.lib not found" + ls -la "$library_lib_path/freetype.lib" 2>/dev/null || echo "freetype.lib not found" + ls -la "$library_lib_path/"*harfbuzz* 2>/dev/null || echo "No harfbuzz files in lib" + ls -la "$library_lib_path/"*freetype* 2>/dev/null || echo "No freetype files in lib" + + # Verify pkg-config can find FFmpeg + echo "Testing pkg-config for FFmpeg libraries:" + pkg-config --exists libavcodec && echo "libavcodec found" || echo "libavcodec NOT found" + pkg-config --exists libavformat && echo "libavformat found" || echo "libavformat NOT found" + pkg-config --exists libavutil && echo "libavutil found" || echo "libavutil NOT found" + + # Show what libraries pkg-config thinks we need + echo "pkg-config --libs libavcodec:" + pkg-config --libs libavcodec || true + + echo "pkg-config --libs libavformat:" + pkg-config --libs libavformat || true + + echo "pkg-config --libs libavutil:" + pkg-config --libs libavutil || true + + echo "pkg-config --libs libswscale:" + pkg-config --libs libswscale || true + + echo "pkg-config --libs libswresample:" + pkg-config --libs libswresample || true + + echo "pkg-config --libs libavfilter:" + pkg-config --libs libavfilter || true + + echo "pkg-config --libs libavdevice:" + pkg-config --libs libavdevice || true + + - name: Update pip and install PyTorch + run: | + python -m pip install --upgrade pip + python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu + + - name: Setup Visual Studio environment + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 + + - name: Build torchcodec from source + run: | + # Build without BUILD_AGAINST_ALL_FFMPEG_FROM_S3 to use system FFmpeg + echo "Building torchcodec from source using system FFmpeg..." + + # Verify that torch is available + python -c "import torch; print('PyTorch found:', torch.__version__)" + + # Set up environment variables for the build + conda_env_path=$(conda info --base)/envs/build + library_lib_path="$conda_env_path/Library/lib" + library_bin_path="$conda_env_path/Library/bin" + library_include_path="$conda_env_path/Library/include" + + # Set CMAKE_ARGS with proper library paths + export CMAKE_ARGS="-DCMAKE_BUILD_TYPE=Release -DTORCHCODEC_DISABLE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_LIBRARY_PATH=$library_lib_path -DCMAKE_INCLUDE_PATH=$library_include_path -DCMAKE_PREFIX_PATH=$library_lib_path;$library_include_path -DCMAKE_VERBOSE_MAKEFILE=ON" + + echo "CMAKE_ARGS: $CMAKE_ARGS" + echo "Python executable: $(which python)" + echo "Conda environment: $CONDA_PREFIX" + + # Debug: Show what libraries are available + echo "Available .lib files in conda lib directory:" + ls -la "$library_lib_path"/*.lib 2>/dev/null || echo "No .lib files found" + + # Debug: Test that torch is still available + echo "Testing PyTorch availability:" + python -c "import torch; print('PyTorch version:', torch.__version__)" + + # Build using pip install with the current conda environment + python -m pip install -e . --no-build-isolation -v + + - name: Test torchcodec import + run: | + echo "Testing torchcodec import..." + python -c "import torchcodec; print('TorchCodec import successful!')" + python -c "import torchcodec; print('FFmpeg versions:', torchcodec.get_ffmpeg_library_versions())" + + - name: Install test dependencies + run: | + python -m pip install numpy pytest pillow + + - name: Run Python tests + run: | + pytest test -v diff --git a/.github/workflows/windows_wheel.yaml b/.github/workflows/windows_wheel.yaml new file mode 100644 index 000000000..e4c0bc35e --- /dev/null +++ b/.github/workflows/windows_wheel.yaml @@ -0,0 +1,151 @@ +name: Build and test Windows wheel + +on: + pull_request: + push: + branches: + - nightly + - main + - release/* + tags: + - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }} + cancel-in-progress: true + +permissions: + id-token: write + contents: write + +defaults: + run: + shell: bash -l -eo pipefail {0} + +jobs: + + generate-matrix: + uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main + with: + package-type: wheel + os: windows + test-infra-repository: pytorch/test-infra + test-infra-ref: main + with-xpu: disable + with-rocm: disable + with-cuda: disable + build-python-only: "disable" + + build: + needs: generate-matrix + strategy: + fail-fast: false + name: Build and Upload Windows wheel + # TODO + # We shouldn't use this, but this is needed for now. Note that this is where we are setting the BUILD_AGAINST_ALL_FFMPEG_FROM_S3 variable currently, we'll have to find a way around that. + uses: nicolashug/test-infra/.github/workflows/build_wheels_windows.yml@build-platform-windows + with: + repository: pytorch/torchcodec + ref: "" + test-infra-repository: nicolashug/test-infra + test-infra-ref: build-platform-windows + build-matrix: ${{ needs.generate-matrix.outputs.matrix }} + pre-script: packaging/pre_build_script.sh + # post-script: packaging/post_build_script.sh # TODO enable post-build checks? + env-script: packaging/vc_env_helper.bat + smoke-test-script: packaging/fake_smoke_test.py + package-name: torchcodec + trigger-event: ${{ github.event_name }} + build-platform: "python-build-package" + # build-command: "BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 python -m build --wheel -vvv --no-isolation" + # TODO see comment above + build-command: "python -m build --wheel -vvv --no-isolation" + + install-and-test: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + python-version: ['3.9'] + ffmpeg-version-for-tests: ['4.4.2', '5.1.2', '6.1.1', '7.0.1'] + needs: build + steps: + - uses: actions/download-artifact@v4 + with: + name: pytorch_torchcodec__${{ matrix.python-version }}_cpu_x64 + path: pytorch/torchcodec/dist/ + - name: Setup conda env + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + miniconda-version: "latest" + activate-environment: test + python-version: ${{ matrix.python-version }} + - name: Update pip + run: python -m pip install --upgrade pip + - name: Install PyTorch + run: | + python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu + - name: Install torchcodec from the wheel + run: | + wheel_path=`find pytorch/torchcodec/dist -type f -name "*.whl"` + echo Installing $wheel_path + python -m pip install $wheel_path -vvv + + - name: Check out repo + uses: actions/checkout@v3 + - name: Install ffmpeg, post build + run: | + # Ideally we would have checked for that before installing the wheel, + # but we need to checkout the repo to access this file, and we don't + # want to checkout the repo before installing the wheel to avoid any + # side-effect. It's OK. + source packaging/helpers.sh + assert_ffmpeg_not_installed + + conda install "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" -c conda-forge + ffmpeg -version + + # On Windows, ensure the conda Library/bin directory is in PATH + # This is needed for Windows DLL loading to find FFmpeg DLLs + if [[ "$RUNNER_OS" == "Windows" ]]; then + conda_env_path=$(conda info --base)/envs/test + library_bin_path="$conda_env_path/Library/bin" + echo "Adding conda Library/bin to PATH: $library_bin_path" + echo "$library_bin_path" >> $GITHUB_PATH + + # Verify FFmpeg DLLs are accessible + echo "Checking if FFmpeg DLLs are in PATH:" + where avutil.dll || echo "avutil.dll not found in PATH" + where avcodec.dll || echo "avcodec.dll not found in PATH" + where avformat.dll || echo "avformat.dll not found in PATH" + fi + + - name: Test torchcodec import after FFmpeg installation + run: | + echo "Testing torchcodec import after FFmpeg is installed and PATH is updated..." + python -c "import torchcodec; print('TorchCodec import successful!')" + + - name: Install test dependencies + run: | + # Ideally we would find a way to get those dependencies from pyproject.toml + python -m pip install numpy pytest pillow + + - name: Delete the src/ folder just for fun + run: | + # The only reason we checked-out the repo is to get access to the + # tests. We don't care about the rest. Out of precaution, we delete + # the src/ folder to be extra sure that we're running the code from + # the installed wheel rather than from the source. + # This is just to be extra cautious and very overkill because a) + # there's no way the `torchcodec` package from src/ can be found from + # the PythonPath: the main point of `src/` is precisely to protect + # against that and b) if we ever were to execute code from + # `src/torchcodec`, it would fail loudly because the built .so files + # aren't present there. + rm -r src/ + ls + - name: Run Python tests + run: | + pytest test -vvv diff --git a/packaging/vc_env_helper.bat b/packaging/vc_env_helper.bat new file mode 100644 index 000000000..1f50b1b05 --- /dev/null +++ b/packaging/vc_env_helper.bat @@ -0,0 +1,41 @@ +@echo on + +set VC_VERSION_LOWER=17 +set VC_VERSION_UPPER=18 + +for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -legacy -products * -version [%VC_VERSION_LOWER%^,%VC_VERSION_UPPER%^) -property installationPath`) do ( + if exist "%%i" if exist "%%i\VC\Auxiliary\Build\vcvarsall.bat" ( + set "VS15INSTALLDIR=%%i" + set "VS15VCVARSALL=%%i\VC\Auxiliary\Build\vcvarsall.bat" + goto vswhere + ) +) + +:vswhere +if "%VSDEVCMD_ARGS%" == "" ( + call "%VS15VCVARSALL%" x64 || exit /b 1 +) else ( + call "%VS15VCVARSALL%" x64 %VSDEVCMD_ARGS% || exit /b 1 +) + +@echo on + +if "%CU_VERSION%" == "xpu" call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" + +set DISTUTILS_USE_SDK=1 + +set args=%1 +shift +:start +if [%1] == [] goto done +set args=%args% %1 +shift +goto start + +:done +if "%args%" == "" ( + echo Usage: vc_env_helper.bat [command] [args] + echo e.g. vc_env_helper.bat cl /c test.cpp +) + +%args% || exit /b 1 diff --git a/setup.py b/setup.py index 5074ef478..8a583b3b5 100644 --- a/setup.py +++ b/setup.py @@ -150,9 +150,11 @@ def copy_extensions_to_source(self): # dynamically loaded module. For more, see: # https://stackoverflow.com/a/2339910 extensions = ["dylib", "so"] + elif sys.platform in ("win32", "cygwin"): + extensions = ["dll"] else: raise NotImplementedError( - "Platforms other than linux/darwin are not supported yet" + f"Platform {sys.platform} is not supported" ) for ext in extensions: @@ -169,14 +171,14 @@ def copy_extensions_to_source(self): build_against_all_ffmpeg_from_s3 = ( os.getenv(BUILD_AGAINST_ALL_FFMPEG_FROM_S3_VAR) is not None ) -if "bdist_wheel" in sys.argv and not ( - build_against_all_ffmpeg_from_s3 or not_a_license_violation -): - raise ValueError( - "It looks like you're trying to build a wheel. " - f"You probably want to set {BUILD_AGAINST_ALL_FFMPEG_FROM_S3_VAR}. " - f"If you have a good reason *not* to, then set {NOT_A_LICENSE_VIOLATION_VAR}." - ) +# if "bdist_wheel" in sys.argv and not ( +# build_against_all_ffmpeg_from_s3 or not_a_license_violation +# ): +# raise ValueError( +# "It looks like you're trying to build a wheel. " +# f"You probably want to set {BUILD_AGAINST_ALL_FFMPEG_FROM_S3_VAR}. " +# f"If you have a good reason *not* to, then set {NOT_A_LICENSE_VIOLATION_VAR}." +# ) # See `CMakeBuild.build_extension()`. fake_extension = Extension(name="FAKE_NAME", sources=[]) diff --git a/src/torchcodec/_core/CMakeLists.txt b/src/torchcodec/_core/CMakeLists.txt index 7196d0487..0facc37cf 100644 --- a/src/torchcodec/_core/CMakeLists.txt +++ b/src/torchcodec/_core/CMakeLists.txt @@ -14,7 +14,19 @@ else() set(TORCHCODEC_WERROR_OPTION "-Werror") endif() -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic ${TORCHCODEC_WERROR_OPTION} ${TORCH_CXX_FLAGS}") +if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + # Avoid warnings about non-ASCII characters in source files. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4819") + # Important for when we add Windows CUDA: exporting all symbols is aparently + # limited to 65535 symbols, which (aparently) will not work for CUDA. + # https://github.com/pytorch/pytorch/pull/3650 + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +endif() + +# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic ${TORCHCODEC_WERROR_OPTION} ${TORCH_CXX_FLAGS}") +# TODO put back previous line and set proper flags for windows. e.g. Wall is W4. +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}") + function(make_torchcodec_sublibrary library_name @@ -34,11 +46,31 @@ function(make_torchcodec_sublibrary # Avoid adding the "lib" prefix which we already add explicitly. set_target_properties(${library_name} PROPERTIES PREFIX "") + if(WIN32) # TODO unify WIN detection + # On Windows, the built artifacts are put in Release/Debug + # subdirectories by default. We want to avoid that, otherwise our + # install() step would not know where to find those. + set_target_properties(${library_name} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR} + RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR} + LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR} + LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR} + ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR} + ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR} + ) + endif() + target_link_libraries( ${library_name} PUBLIC ${library_dependencies} ) + + # Debug output for Windows builds + if(WIN32) + message(STATUS "Created library: ${library_name}") + message(STATUS "Library dependencies: ${library_dependencies}") + endif() endfunction() function(make_torchcodec_libraries @@ -146,19 +178,62 @@ function(make_torchcodec_libraries # stray initialization of py::objects. The rest of the object code must # match. See: # https://pybind11.readthedocs.io/en/stable/faq.html#someclass-declared-with-greater-visibility-than-the-type-of-its-field-someclass-member-wattributes - target_compile_options( + if(NOT WIN32) # TODO unify WIN detection + target_compile_options( + ${pybind_ops_library_name} + PUBLIC + "-fvisibility=hidden" + ) + endif() + if(APPLE) # TODO unify APPLE detection + # If we don't make sure this flag is set, we run into segfauls at import + # time on Mac. See: + # https://github.com/pybind/pybind11/issues/3907#issuecomment-1170412764 + target_link_options( + ${pybind_ops_library_name} + PUBLIC + "LINKER:-undefined,dynamic_lookup" + ) + endif() + + # Install all libraries. + set( + all_libraries + ${decoder_library_name} + ${custom_ops_library_name} ${pybind_ops_library_name} - PUBLIC - "-fvisibility=hidden" ) - # If we don't make sure this flag is set, we run into segfauls at import - # time on Mac. See: - # https://github.com/pybind/pybind11/issues/3907#issuecomment-1170412764 - target_link_options( - ${pybind_ops_library_name} - PUBLIC - "LINKER:-undefined,dynamic_lookup" + + # The install step is invoked within CMakeBuild.build_library() in + # setup.py and just copies the built files from the temp + # cmake/setuptools build folder into the CMAKE_INSTALL_PREFIX folder. We + # still need to manually pass "DESTINATION ..." for cmake to copy those + # files in CMAKE_INSTALL_PREFIX instead of CMAKE_INSTALL_PREFIX/lib. + install( + TARGETS ${all_libraries} + LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX} + RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX} # For Windows DLLs ) + # stray initialization of py::objects. The rest of the object code must + # match. See: + # https://pybind11.readthedocs.io/en/stable/faq.html#someclass-declared-with-greater-visibility-than-the-type-of-its-field-someclass-member-wattributes + if(NOT WIN32) # TODO unify WIN detection + target_compile_options( + ${pybind_ops_library_name} + PUBLIC + "-fvisibility=hidden" + ) + endif() + if(APPLE) # TODO unify APPLE detection + # If we don't make sure this flag is set, we run into segfauls at import + # time on Mac. See: + # https://github.com/pybind/pybind11/issues/3907#issuecomment-1170412764 + target_link_options( + ${pybind_ops_library_name} + PUBLIC + "LINKER:-undefined,dynamic_lookup" + ) + endif() # Install all libraries. set( @@ -176,6 +251,7 @@ function(make_torchcodec_libraries install( TARGETS ${all_libraries} LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX} + RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX} # For Windows DLLs ) endfunction() @@ -215,6 +291,21 @@ else() libswscale ) + # On Windows, explicitly add the conda library directory to the linker search path + if(WIN32 AND DEFINED ENV{CONDA_PREFIX}) + link_directories("$ENV{CONDA_PREFIX}/Library/lib") + message(STATUS "Added conda library directory to linker search path: $ENV{CONDA_PREFIX}/Library/lib") + + # Also add the library path to CMAKE_PREFIX_PATH for better library finding + list(APPEND CMAKE_PREFIX_PATH "$ENV{CONDA_PREFIX}/Library") + message(STATUS "Added conda prefix to CMAKE_PREFIX_PATH: $ENV{CONDA_PREFIX}/Library") + + # Debug: Show what LIBAV variables are set + message(STATUS "LIBAV_INCLUDE_DIRS: ${LIBAV_INCLUDE_DIRS}") + message(STATUS "LIBAV_LIBRARY_DIRS: ${LIBAV_LIBRARY_DIRS}") + message(STATUS "LIBAV_LIBRARIES: ${LIBAV_LIBRARIES}") + endif() + # Split libavcodec's version string by '.' and convert it to a list string(REPLACE "." ";" libavcodec_version_list ${LIBAV_libavcodec_VERSION}) # Get the first element of the list, which is the major version diff --git a/src/torchcodec/_core/fetch_and_expose_non_gpl_ffmpeg_libs.cmake b/src/torchcodec/_core/fetch_and_expose_non_gpl_ffmpeg_libs.cmake index 35d3d06f8..81f115ff4 100644 --- a/src/torchcodec/_core/fetch_and_expose_non_gpl_ffmpeg_libs.cmake +++ b/src/torchcodec/_core/fetch_and_expose_non_gpl_ffmpeg_libs.cmake @@ -14,6 +14,7 @@ set( https://pytorch.s3.amazonaws.com/torchcodec/ffmpeg/2025-03-14 ) + if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") set( platform_url @@ -36,47 +37,6 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") f7_sha256 1cb946d8b7c6393c2c3ebe1f900b8de7a2885fe614c45d4ec32c9833084f2f26 ) - - set( - f4_library_file_names - libavutil.so.56 - libavcodec.so.58 - libavformat.so.58 - libavdevice.so.58 - libavfilter.so.7 - libswscale.so.5 - libswresample.so.3 - ) - set( - f5_library_file_names - libavutil.so.57 - libavcodec.so.59 - libavformat.so.59 - libavdevice.so.59 - libavfilter.so.8 - libswscale.so.6 - libswresample.so.4 - ) - set( - f6_library_file_names - libavutil.so.58 - libavcodec.so.60 - libavformat.so.60 - libavdevice.so.60 - libavfilter.so.9 - libswscale.so.7 - libswresample.so.4 - ) - set( - f7_library_file_names - libavutil.so.59 - libavcodec.so.61 - libavformat.so.61 - libavdevice.so.61 - libavfilter.so.10 - libswscale.so.8 - libswresample.so.5 - ) elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") set( platform_url @@ -98,45 +58,27 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") f7_sha256 48a4fc8ce098305cfd4a58f40889249c523ca3c285f66ba704b5bad0e3ada53a ) + +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") set( - f4_library_file_names - libavutil.56.dylib - libavcodec.58.dylib - libavformat.58.dylib - libavdevice.58.dylib - libavfilter.7.dylib - libswscale.5.dylib - libswresample.3.dylib - ) - set( - f5_library_file_names - libavutil.57.dylib - libavcodec.59.dylib - libavformat.59.dylib - libavdevice.59.dylib - libavfilter.8.dylib - libswscale.6.dylib - libswresample.4.dylib - ) - set( - f6_library_file_names - libavutil.58.dylib - libavcodec.60.dylib - libavformat.60.dylib - libavdevice.60.dylib - libavfilter.9.dylib - libswscale.7.dylib - libswresample.4.dylib - ) - set( - f7_library_file_names - libavutil.59.dylib - libavcodec.61.dylib - libavformat.61.dylib - libavdevice.61.dylib - libavfilter.10.dylib - libswscale.8.dylib - libswresample.5.dylib + platform_url + ${base_url}/windows_x86_64 + ) + set( + f4_sha256 + 270a1aa8892225267e68a7eb87c417931da30dccbf08ee2bde8833e659cab5cb + ) + set( + f5_sha256 + b8b2a349a847e56a6da875b066dff1cae53cb8ee7cf5ba9321ec1243dea0cde0 + ) + set( + f6_sha256 + 5d9f8c76dc55f790fa31d825985e9270bf9e498b8bfec21a0ad3a1feb1fa053a + ) + set( + f7_sha256 + ae391ace382330e912793b70b68529ee7c91026d2869b4df7e7c3e7d3656bdd5 ) else() message( @@ -178,31 +120,136 @@ add_library(ffmpeg6 INTERFACE) add_library(ffmpeg7 INTERFACE) # Note: the f?_SOURCE_DIR variables were set by FetchContent_MakeAvailable + +if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + set( + f4_library_paths + ${f4_SOURCE_DIR}/lib/libavutil.so.56 + ${f4_SOURCE_DIR}/lib/libavcodec.so.58 + ${f4_SOURCE_DIR}/lib/libavformat.so.58 + ${f4_SOURCE_DIR}/lib/libavdevice.so.58 + ${f4_SOURCE_DIR}/lib/libavfilter.so.7 + ${f4_SOURCE_DIR}/lib/libswscale.so.5 + ${f4_SOURCE_DIR}/lib/libswresample.so.3 + ) + set( + f5_library_paths + ${f5_SOURCE_DIR}/lib/libavutil.so.57 + ${f5_SOURCE_DIR}/lib/libavcodec.so.59 + ${f5_SOURCE_DIR}/lib/libavformat.so.59 + ${f5_SOURCE_DIR}/lib/libavdevice.so.59 + ${f5_SOURCE_DIR}/lib/libavfilter.so.8 + ${f5_SOURCE_DIR}/lib/libswscale.so.6 + ${f5_SOURCE_DIR}/lib/libswresample.so.4 + ) + set( + f6_library_paths + ${f6_SOURCE_DIR}/lib/libavutil.so.58 + ${f6_SOURCE_DIR}/lib/libavcodec.so.60 + ${f6_SOURCE_DIR}/lib/libavformat.so.60 + ${f6_SOURCE_DIR}/lib/libavdevice.so.60 + ${f6_SOURCE_DIR}/lib/libavfilter.so.9 + ${f6_SOURCE_DIR}/lib/libswscale.so.7 + ${f6_SOURCE_DIR}/lib/libswresample.so.4 + ) + set( + f7_library_paths + ${f7_SOURCE_DIR}/lib/libavutil.so.59 + ${f7_SOURCE_DIR}/lib/libavcodec.so.61 + ${f7_SOURCE_DIR}/lib/libavformat.so.61 + ${f7_SOURCE_DIR}/lib/libavdevice.so.61 + ${f7_SOURCE_DIR}/lib/libavfilter.so.10 + ${f7_SOURCE_DIR}/lib/libswscale.so.8 + ${f7_SOURCE_DIR}/lib/libswresample.so.5 + ) +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + set( + f4_library_paths + ${f4_SOURCE_DIR}/lib/libavutil.56.dylib + ${f4_SOURCE_DIR}/lib/libavcodec.58.dylib + ${f4_SOURCE_DIR}/lib/libavformat.58.dylib + ${f4_SOURCE_DIR}/lib/libavdevice.58.dylib + ${f4_SOURCE_DIR}/lib/libavfilter.7.dylib + ${f4_SOURCE_DIR}/lib/libswscale.5.dylib + ${f4_SOURCE_DIR}/lib/libswresample.3.dylib + ) + set( + f5_library_paths + ${f5_SOURCE_DIR}/lib/libavutil.57.dylib + ${f5_SOURCE_DIR}/lib/libavcodec.59.dylib + ${f5_SOURCE_DIR}/lib/libavformat.59.dylib + ${f5_SOURCE_DIR}/lib/libavdevice.59.dylib + ${f5_SOURCE_DIR}/lib/libavfilter.8.dylib + ${f5_SOURCE_DIR}/lib/libswscale.6.dylib + ${f5_SOURCE_DIR}/lib/libswresample.4.dylib + ) + set( + f6_library_paths + ${f6_SOURCE_DIR}/lib/libavutil.58.dylib + ${f6_SOURCE_DIR}/lib/libavcodec.60.dylib + ${f6_SOURCE_DIR}/lib/libavformat.60.dylib + ${f6_SOURCE_DIR}/lib/libavdevice.60.dylib + ${f6_SOURCE_DIR}/lib/libavfilter.9.dylib + ${f6_SOURCE_DIR}/lib/libswscale.7.dylib + ${f6_SOURCE_DIR}/lib/libswresample.4.dylib + ) + set( + f7_library_paths + ${f7_SOURCE_DIR}/lib/libavutil.59.dylib + ${f7_SOURCE_DIR}/lib/libavcodec.61.dylib + ${f7_SOURCE_DIR}/lib/libavformat.61.dylib + ${f7_SOURCE_DIR}/lib/libavdevice.61.dylib + ${f7_SOURCE_DIR}/lib/libavfilter.10.dylib + ${f7_SOURCE_DIR}/lib/libswscale.8.dylib + ${f7_SOURCE_DIR}/lib/libswresample.5.dylib + ) +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + set( + f4_library_paths + ${f4_SOURCE_DIR}/bin/avutil.lib + ${f4_SOURCE_DIR}/bin/avcodec.lib + ${f4_SOURCE_DIR}/bin/avformat.lib + ${f4_SOURCE_DIR}/bin/avdevice.lib + ${f4_SOURCE_DIR}/bin/avfilter.lib + ${f4_SOURCE_DIR}/bin/swscale.lib + ${f4_SOURCE_DIR}/bin/swresample.lib + ) + set( + f5_library_paths + ${f5_SOURCE_DIR}/bin/avutil.lib + ${f5_SOURCE_DIR}/bin/avcodec.lib + ${f5_SOURCE_DIR}/bin/avformat.lib + ${f5_SOURCE_DIR}/bin/avdevice.lib + ${f5_SOURCE_DIR}/bin/avfilter.lib + ${f5_SOURCE_DIR}/bin/swscale.lib + ${f5_SOURCE_DIR}/bin/swresample.lib + ) + set( + f6_library_paths + ${f6_SOURCE_DIR}/bin/avutil.lib + ${f6_SOURCE_DIR}/bin/avcodec.lib + ${f6_SOURCE_DIR}/bin/avformat.lib + ${f6_SOURCE_DIR}/bin/avdevice.lib + ${f6_SOURCE_DIR}/bin/avfilter.lib + ${f6_SOURCE_DIR}/bin/swscale.lib + ${f6_SOURCE_DIR}/bin/swresample.lib + ) + set( + f7_library_paths + ${f7_SOURCE_DIR}/bin/avutil.lib + ${f7_SOURCE_DIR}/bin/avcodec.lib + ${f7_SOURCE_DIR}/bin/avformat.lib + ${f7_SOURCE_DIR}/bin/avdevice.lib + ${f7_SOURCE_DIR}/bin/avfilter.lib + ${f7_SOURCE_DIR}/bin/swscale.lib + ${f7_SOURCE_DIR}/bin/swresample.lib + ) +endif() target_include_directories(ffmpeg4 INTERFACE ${f4_SOURCE_DIR}/include) target_include_directories(ffmpeg5 INTERFACE ${f5_SOURCE_DIR}/include) target_include_directories(ffmpeg6 INTERFACE ${f6_SOURCE_DIR}/include) target_include_directories(ffmpeg7 INTERFACE ${f7_SOURCE_DIR}/include) -list( - TRANSFORM f4_library_file_names - PREPEND ${f4_SOURCE_DIR}/lib/ - OUTPUT_VARIABLE f4_library_paths -) -list( - TRANSFORM f5_library_file_names - PREPEND ${f5_SOURCE_DIR}/lib/ - OUTPUT_VARIABLE f5_library_paths -) -list( - TRANSFORM f6_library_file_names - PREPEND ${f6_SOURCE_DIR}/lib/ - OUTPUT_VARIABLE f6_library_paths -) -list( - TRANSFORM f7_library_file_names - PREPEND ${f7_SOURCE_DIR}/lib/ - OUTPUT_VARIABLE f7_library_paths -) target_link_libraries( ffmpeg4 diff --git a/src/torchcodec/_internally_replaced_utils.py b/src/torchcodec/_internally_replaced_utils.py index a5a3ffa39..39b04d5c1 100644 --- a/src/torchcodec/_internally_replaced_utils.py +++ b/src/torchcodec/_internally_replaced_utils.py @@ -18,9 +18,11 @@ def _get_extension_path(lib_name: str) -> str: extension_suffixes = importlib.machinery.EXTENSION_SUFFIXES elif sys.platform == "darwin": extension_suffixes = importlib.machinery.EXTENSION_SUFFIXES + [".dylib"] + elif sys.platform in ("win32", "cygwin"): + extension_suffixes = importlib.machinery.EXTENSION_SUFFIXES + [".dll"] else: raise NotImplementedError( - "Platforms other than linux/darwin are not supported yet" + f"{sys.platform = } is not not supported" ) loader_details = ( importlib.machinery.ExtensionFileLoader,