Skip to content
Closed
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
46 changes: 27 additions & 19 deletions Formula/p/pytorch.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
class Pytorch < Formula
include Language::Python::Virtualenv

desc "Tensors and dynamic neural networks"
homepage "https://pytorch.org/"
url "https://github.com/pytorch/pytorch/releases/download/v2.5.1/pytorch-v2.5.1.tar.gz"
sha256 "740eb5fff95e33cfe699bad43be83523f569c7cc7f9c285c2a255416443dd266"
url "https://github.com/pytorch/pytorch/releases/download/v2.7.1/pytorch-v2.7.1.tar.gz"
sha256 "5befd2e540fd55ce4782d0ca7610ce5b572d756d7ea38090ef0f3c7c428fb20f"
license "BSD-3-Clause"
revision 4

livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end

no_autobump! because: :requires_manual_review

bottle do
sha256 cellar: :any, arm64_sequoia: "ec01ffac0aa0b57f68f549662c25d92a1dad3f2e339f7c3dc854170c17605971"
sha256 cellar: :any, arm64_sonoma: "5014d4b9765a0d095e999622a2d3dd11b86fe35cd3fdbd8326c650899ec9fba8"
Expand Down Expand Up @@ -44,18 +41,18 @@
end

resource "filelock" do
url "https://files.pythonhosted.org/packages/9d/db/3ef5bb276dae18d6ec2124224403d1d67bccdbefc17af4cc8f553e341ab1/filelock-3.16.1.tar.gz"
sha256 "c249fbfcd5db47e5e2d6d62198e565475ee65e4831e2561c8e313fa7eb961435"
url "https://files.pythonhosted.org/packages/0a/10/c23352565a6544bdc5353e0b15fc1c563352101f30e24bf500207a54df9a/filelock-3.18.0.tar.gz"
sha256 "adbc88eabb99d2fec8c9c1b229b171f18afa655400173ddc653d5d01501fb9f2"
end

resource "fsspec" do
url "https://files.pythonhosted.org/packages/62/7c/12b0943011daaaa9c35c2a2e22e5eb929ac90002f08f1259d69aedad84de/fsspec-2024.9.0.tar.gz"
sha256 "4b0afb90c2f21832df142f292649035d80b421f60a9e1c027802e5a0da2b04e8"
url "https://files.pythonhosted.org/packages/00/f7/27f15d41f0ed38e8fcc488584b57e902b331da7f7c6dcda53721b15838fc/fsspec-2025.5.1.tar.gz"
sha256 "2e55e47a540b91843b755e83ded97c6e897fa0942b11490113f09e9c443c2475"
end

resource "jinja2" do
url "https://files.pythonhosted.org/packages/ed/55/39036716d19cab0747a5020fc7e907f362fbf48c984b14e62127f7e68e5d/jinja2-3.1.4.tar.gz"
sha256 "4a3aee7acbbe7303aede8e9648d13b8bf88a429282aa6122a993f0ac800cb369"
url "https://files.pythonhosted.org/packages/df/bf/f7da0350254c0ed7c72f3e33cef02e048281fec7ecec5f032d4aac52226b/jinja2-3.1.6.tar.gz"
sha256 "0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d"
end

resource "markupsafe" do
Expand All @@ -69,8 +66,8 @@
end

resource "networkx" do
url "https://files.pythonhosted.org/packages/36/2b/20ad9eecdda3f1b0dc63fb8f82d2ea99163dbca08bfa392594fc2ed81869/networkx-3.4.1.tar.gz"
sha256 "f9df45e85b78f5bd010993e897b4f1fdb242c11e015b101bd951e5c0e29982d8"
url "https://files.pythonhosted.org/packages/6c/4f/ccdb8ad3a38e583f214547fd2f7ff1fc160c43a75af88e6aec213404b96a/networkx-3.5.tar.gz"
sha256 "d4c6f9cf81f52d69230866796b82afbccdec3db7ae4fbd1b65ea750feed50037"
end

resource "opt-einsum" do
Expand All @@ -84,18 +81,18 @@
end

resource "setuptools" do
url "https://files.pythonhosted.org/packages/07/37/b31be7e4b9f13b59cde9dcaeff112d401d49e0dc5b37ed4a9fc8fb12f409/setuptools-75.2.0.tar.gz"
sha256 "753bb6ebf1f465a1912e19ed1d41f403a79173a9acf66a42e7e6aec45c3c16ec"
url "https://files.pythonhosted.org/packages/18/5d/3bf57dcd21979b887f014ea83c24ae194cfcd12b9e0fda66b957c69d1fca/setuptools-80.9.0.tar.gz"
sha256 "f36b47402ecde768dbfafc46e8e4207b4360c654f1f3bb84475f0a28628fb19c"
end

resource "sympy" do
url "https://files.pythonhosted.org/packages/ca/99/5a5b6f19ff9f083671ddf7b9632028436167cd3d33e11015754e41b249a4/sympy-1.13.1.tar.gz"
sha256 "9cebf7e04ff162015ce31c9c6c9144daa34a93bd082f54fd8f12deca4f47515f"
url "https://files.pythonhosted.org/packages/83/d3/803453b36afefb7c2bb238361cd4ae6125a569b4db67cd9e79846ba2d68c/sympy-1.14.0.tar.gz"
sha256 "d3d3fe8df1e5a0b42f0e7bdf50541697dbe7d23746e894990c030e2b05e72517"
end

resource "typing-extensions" do
url "https://files.pythonhosted.org/packages/df/db/f35a00659bc03fec321ba8bce9420de607a1d37f8342eee1863174c69557/typing_extensions-4.12.2.tar.gz"
sha256 "1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"
url "https://files.pythonhosted.org/packages/98/5a/da40306b885cc8c09109dc2e1abd358d5684b1425678151cdaed4731c822/typing_extensions-4.14.1.tar.gz"
sha256 "38b39f4aeeab64884ce9f74c94263ef78f3c22467c8724005483154c26648d36"
end

def install
Expand All @@ -104,6 +101,9 @@
# Avoid building AVX512 code
inreplace "cmake/Modules/FindAVX.cmake", /^CHECK_SSE\(CXX "AVX512"/, "#\\0"

# avoid checking out disabled submodules
inreplace "tools/build_pytorch_libs.py", " checkout_nccl()", ""

ENV["ATEN_NO_TEST"] = "ON"
ENV["BLAS"] = "OpenBLAS"
ENV["BUILD_CUSTOM_PROTOBUF"] = "OFF"
Expand All @@ -115,6 +115,7 @@
ENV["USE_CCACHE"] = "OFF"
ENV["USE_CUDA"] = "OFF"
ENV["USE_DISTRIBUTED"] = "ON"
ENV["USE_KLEIDIAI"] = "OFF" if Hardware::CPU.arm?
ENV["USE_MKLDNN"] = "OFF"
ENV["USE_NNPACK"] = "OFF"
ENV["USE_OPENMP"] = "ON"
Expand All @@ -123,6 +124,9 @@
ENV["USE_SYSTEM_SLEEF"] = "ON"
ENV["USE_MPS"] = "ON" if OS.mac?

# cmake 4 build patch for third parties
ENV["CMAKE_POLICY_VERSION_MINIMUM"] = "3.5"

# Avoid references to Homebrew shims
inreplace "caffe2/core/macros.h.in", "${CMAKE_CXX_COMPILER}", ENV.cxx

Expand Down Expand Up @@ -151,6 +155,10 @@
system ENV.cxx, "-std=c++17", "test.cpp", "-o", "test",
"-I#{include}/torch/csrc/api/include",
"-L#{lib}", "-ltorch", "-ltorch_cpu", "-lc10"

# skipping the test on linux due to an error. Remove in next release
return if OS.linux? && Hardware::CPU.intel?

system "./test"

# test that the `torch` Python module is available
Expand Down
7 changes: 2 additions & 5 deletions Formula/t/torchvision.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@

desc "Datasets, transforms, and models for computer vision"
homepage "https://pytorch.org/vision/stable/index.html"
url "https://github.com/pytorch/vision/archive/refs/tags/v0.20.1.tar.gz"
sha256 "7e08c7f56e2c89859310e53d898f72bccc4987cd83e08cfd6303513da15a9e71"
url "https://github.com/pytorch/vision/archive/refs/tags/v0.22.1.tar.gz"
sha256 "fa1b0a58e13c08329bcff8d52607b4e25944fd074c01dee1b501c8158fadcdec"
license "BSD-3-Clause"
revision 3

livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end

no_autobump! because: :requires_manual_review

bottle do
rebuild 1
sha256 cellar: :any, arm64_sequoia: "05ad6434595d32adb338a250c188b1c4bdbc9dd6cc002667775a940610d03aaa"
Expand All @@ -34,7 +31,7 @@
depends_on "pillow"
depends_on "pytorch"

def install

Check failure on line 34 in Formula/t/torchvision.rb

View workflow job for this annotation

GitHub Actions / Linux x86_64

`brew install --verbose --formula --build-bottle torchvision` failed on Linux x86_64!

Running command Preparing metadata (pyproject.toml) WARNING: All log messages before absl::InitializeLog() is called are written to STDERR E0000 00:00:1753914770.223513 52289 descriptor_database.cc:550] Invalid file descriptor data passed to EncodedDescriptorDatabase::Add(). F0000 00:00:1753914770.223540 52289 descriptor.cc:2248] Check failed: GeneratedDatabase()->Add(encoded_file_descriptor, size) *** Check failure stack trace: *** error: subprocess-exited-with-error × Preparing metadata (pyproject.toml) did not run successfully. │ exit code: -6 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip. full command: /home/linuxbrew/.linuxbrew/Cellar/torchvision/0.22.1/libexec/bin/python /home/linuxbrew/.linuxbrew/Cellar/python@3.13/3.13.5/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py prepare_metadata_for_build_wheel /var/tmp/tmpzsq9rr5t cwd: /var/tmp/torchvision-20250730-51859-7x5bu1/vision-0.22.1 Preparing metadata (pyproject.toml): finished with status 'error' error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. hint: See above for details. ==> Formula Path: /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/t/torchvision.rb ==> Configuration HOMEBREW_VERSION: 4.5.13-28-g7fb928c ORIGIN: https://github.com/Homebrew/brew HEAD: 7fb928ccf40849ad258e45325f8b828fcd389bbb Last commit: 2 hours ago Branch: main Core tap HEAD: 3bf1e98b9ffc25a40fc99bd35444196c2d664ca3 Core tap last commit: 2 hours ago Core tap JSON: 30 Jul 21:00 UTC HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew HOMEBREW_CASK_OPTS: [] HOMEBREW_COLOR: set HOMEBREW_CURL_PATH: /usr/bin/curl HOMEBREW_FAIL_LOG_LINES: 150 HOMEBREW_GITHUB_API_TOKEN: set HOMEBREW_GIT_EMAIL: 1589480+BrewTestBot@users.noreply.github.com HOMEBREW_GIT_NAME: BrewTestBot HOMEBREW_GIT_PATH: /usr/bin/git HOMEBREW_LOGS: /github/home/bottles/logs HOMEBREW_MAKE_JOBS: 4 HOMEBREW_NO_AUTO_UPDATE: set HOMEBREW_NO_EMOJI: set HOMEBREW_NO_ENV_HINTS: set HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: set HOMEBREW_NO_INSTALL_FROM_API: set HOMEBREW_SORBET_RUNTIME: set HOMEBREW_VERIFY_ATTESTATIONS: set Homebrew Ruby: 3.4.5 => /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.4.5/bin/ruby CPU: quad-core 64-bit zen3 Clang: N/A Git: 2.50.1 => /usr/bin/git Curl: 7.81.0 => /usr/bin/curl Kernel: Linux 6.11.0-1018-azure x86_64 GNU/Linux OS: Ubuntu 22.04.5 LTS Host glibc: 2.35 /usr/bin/gcc: 11.4.0 /usr/bin/ruby: N/A glibc: N/A gcc@11: N/A gcc: 15.1.0 xorg: N/A ==> ENV HOMEBREW_CC: gcc-11 HOMEBREW_CXX: g++-11 MAKEFLAGS: -j4 CMAKE_PREFIX_PATH: /home/linuxbrew/.linuxbrew/opt/binutils:/home/linuxbrew/.linuxbrew/opt/berkeley-db@5:/home/linuxbrew/.linuxbrew PKG_CONFIG_PATH: /home/linuxbrew/.linuxbrew/opt/python@3.13/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/jpeg-turbo/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/zlib/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/libpng/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/gmp/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/isl/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/mpfr/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/lz4/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/xz/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/zstd/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/openblas/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/bzip2/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/freetype/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/brotli/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/highway/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/imath/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/libtiff/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/little-cms2/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/libdeflate/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/openexr/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/webp/lib/pkgconfig:/home/linuxbrew/.linuxbrew/opt/mpdecimal/lib/pkgconfig:/home/linuxbrew/.linuxbr
# Avoid overlinking to `abseil`, `libomp` and `protobuf`
args = OS.mac? ? ["-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-dead_strip_dylibs"] : []

Expand Down
Loading