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

instructlab 0.21.2 (new formula) #200460

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

reidliu41
Copy link

  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

@github-actions github-actions bot added python Python use is a significant feature of the PR or issue new formula PR adds a new formula to Homebrew/homebrew-core labels Dec 8, 2024
Copy link
Contributor

github-actions bot commented Dec 8, 2024

Thanks for contributing to Homebrew! 🎉 It looks like you're having trouble with a CI failure. See our contribution guide for help. You may be most interested in the section on dealing with CI failures. You can find the CI logs in the Checks tab of your pull request.

@reidliu41 reidliu41 force-pushed the instructlab-formula branch from 3a55a77 to 041dc82 Compare December 8, 2024 08:40
@reid41
Copy link

reid41 commented Dec 8, 2024

==> Changing dylib ID of /opt/homebrew/Cellar/instructlab/0.21.2/libexec/lib/python3.11/site-packages/PIL/.dylibs/libpng16.16.dylib
  from /DLC/PIL/.dylibs/libpng16.16.dylib
    to /opt/homebrew/opt/instructlab/libexec/lib/python3.11/site-packages/PIL/.dylibs/libpng16.16.dylib
Error: Failed changing dylib ID of /opt/homebrew/Cellar/instructlab/0.21.2/libexec/lib/python3.11/site-packages/PIL/.dylibs/libpng16.16.dylib
  from /DLC/PIL/.dylibs/libpng16.16.dylib
    to /opt/homebrew/opt/instructlab/libexec/lib/python3.11/site-packages/PIL/.dylibs/libpng16.16.dylib
Error: Failed to fix install linkage
The formula built, but you may encounter issues using it or linking other
formulae against it.
==> Updated load commands do not fit in the header of /opt/homebrew/Cellar/instructlab/0.21.2/libexec/lib/python3.11/site-packages/PIL/.dylibs/libpng16.16.dylib. /opt/homebrew/Cellar/instructlab/0.21.2/libexec/lib/python3.11/site-packages/PIL/.dylibs/libpng16.16.dylib needs to be relinked, possibly with -headerpad or -headerpad_max_install_names

depends_on "pkgconf" => :build
depends_on "python@3.11"

def fix_dylib_paths(target_files: nil)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This really shouldn't be part of a formula. If this is broken it should be reported to brew and fixed there.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for your feedback.This is my first time to write the formula. May I know any possible situations that will hit the Error: Failed to fix install linkage issue during the installation???
Because never hit it without brew install.

depends_on "ccache" => :build
depends_on "cmake" => :build
depends_on "pkgconf" => :build
depends_on "python@3.11"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not the latest?

sha256 "99c2ba360214005088f6ee1a94d60fb89c622e78e5b6c1d8df2f67b8cbf36fd3"
license "Apache-2.0"

depends_on "ccache" => :build
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean why use "ccache"? I also tested from different local machines, one need, another is no need, I not sure whether missed it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can you tell it needs ccache?

Comment on lines +50 to +54
# Fix -flat_namespace being used on Big Sur and later.
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/03cf8088210822aa2c1ab544ed58ea04c897d9c4/libtool/configure-big_sur.diff"
sha256 "35acd6aebc19843f1a2b3a63e880baceb0f5278ab1ace661e57a502d9d78c93c"
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be reported and fixed upstream

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just hit -flat_namespace in local test, so tried to add it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that's the case the upstream configure script should be regenerated with a modern version of autoconf. This was fixed years ago.

end

def install
odie "This tool only supports Apple Silicon (M1/M2/M3) systems. Installation aborted." unless Hardware::CPU.arm?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be depends_on arch: :arm then

Comment on lines +66 to +67
# Replace universal binaries with native slices.
deuniversalize_machos
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it building universal binaries if it doesn't support non ARM?

# Fix dynamic library paths in PIL dependencies
fix_dylib_paths(target_files: [libexec/"lib/python3.11/site-packages/PIL/.dylibs/libpng16.16.dylib"])

# Installation success message
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a caveat if it's specific to Homebrew and removed if it's not

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I tried caveat, but it is strange, it called twice at the end..

Formula/i/instructlab.rb Show resolved Hide resolved
system libexec/"bin/python", "-m", "pip", "install", "--upgrade", "pip", "setuptools", "wheel"
system libexec/"bin/python", "-m", "pip", "cache", "remove", "llama_cpp_python"
venv.pip_install_and_link buildpath
system libexec/"bin/python", "-m", "pip", "install", "-r", buildpath/"requirements.txt"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not allowed, all downloads should be resources

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please share a good example of this(similar with this install with pip and python project)? thanks a lot.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything in this repo that mentions venv will probably do exactly that.

Copy link
Author

@reidliu41 reidliu41 Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May i confirm only can use tar.gz in resources? Or the others e.g. .whl

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All resources for Homebrew formula need to be built from source.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an mlx Homebrew formula: https://formulae.brew.sh/formula/mlx#default

Depending on Homebrew formulae means less time spent compiling dependencies (because other Homebrew formulae have already been compiled before), not more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, yeah, already used mlx formula, but also for torch and easyocr

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, more things to compile will always mean slower builds.

bottle will help to speed up to install?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I still can see some using .whl.

  • gptme: multiprocessing-logging
  • scoutsuite: asyncio-throttle
  • pocsuite3: dacite
  • parsedmarc: events

I mean I tried many times on some packages, still failed, e.g. pydantic-core

 Compiling pydantic-core v2.23.4 (/private/tmp/instructlab--pydantic-core-20241211-55519-ki01jd/pydantic_core-2.23.4)
     Compiling yoke v0.7.4
     Compiling strum v0.26.3
  error: failed to run custom build command for pydantic-core v2.23.4 (/private/tmp/instructlab--pydantic-core-20241211-55519-ki01jd/pydantic_core-2.23.4)

  Caused by:
    process didn't exit successfully: /private/tmp/instructlab--pydantic-core-20241211-55519-ki01jd/pydantic_core-2.23.4/target/release/build/pydantic-core-a958d6f7523c4c99/build-script-build (exit status: 101)
    --- stdout
    cargo:rustc-check-cfg=cfg(Py_LIMITED_API)
    cargo:rustc-check-cfg=cfg(PyPy)
    cargo:rustc-check-cfg=cfg(GraalPy)
    cargo:rustc-check-cfg=cfg(py_sys_config, values("Py_DEBUG", "Py_REF_DEBUG", "Py_TRACE_REFS", "COUNT_ALLOCS"))
    cargo:rustc-check-cfg=cfg(invalid_from_utf8_lint)
    cargo:rustc-check-cfg=cfg(pyo3_disable_reference_pool)
    cargo:rustc-check-cfg=cfg(pyo3_leak_on_drop_without_reference_pool)
    cargo:rustc-check-cfg=cfg(diagnostic_namespace)
    cargo:rustc-check-cfg=cfg(c_str_lit)
    cargo:rustc-check-cfg=cfg(Py_3_7)
    cargo:rustc-check-cfg=cfg(Py_3_8)
    cargo:rustc-check-cfg=cfg(Py_3_9)
    cargo:rustc-check-cfg=cfg(Py_3_10)
    cargo:rustc-check-cfg=cfg(Py_3_11)
    cargo:rustc-check-cfg=cfg(Py_3_12)
    cargo:rustc-check-cfg=cfg(Py_3_13)
    cargo:rustc-cfg=Py_3_6
    cargo:rustc-cfg=Py_3_7
    cargo:rustc-cfg=Py_3_8
    cargo:rustc-cfg=Py_3_9
    cargo:rustc-cfg=Py_3_10
    cargo:rustc-cfg=Py_3_11
    cargo:rustc-check-cfg=cfg(has_coverage_attribute)
    cargo:rustc-check-cfg=cfg(specified_profile_use)
    cargo:rerun-if-changed=python/pydantic_core/core_schema.py
    cargo:rerun-if-changed=generate_self_schema.py

    --- stderr
    thread 'main' panicked at build.rs:23:6:
    failed to execute process: Os { code: 2, kind: NotFound, message: "No such file or directory" }
    stack backtrace:
       0:        0x10021b0f0 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h2260af3a60e707d0
       1:        0x100232fa4 - core::fmt::write::h40c2acd4666eb4d3
       2:        0x10022747c - std::io::Write::write_fmt::h41d6e98dca6ecc3d
       3:        0x10021afa4 - std::sys::backtrace::BacktraceLock::print::h6927682eb47cb165
       4:        0x1002133d0 - std::panicking::default_hook::{{closure}}::h3800acb1d5aa9da8
       5:        0x100213278 - std::panicking::default_hook::hdb07ba29d8151fe7
       6:        0x1002139d4 - std::panicking::rust_panic_with_hook::h3a42c361c08813d5
       7:        0x10021bb78 - std::panicking::begin_panic_handler::{{closure}}::h483101861bc4cead
       8:        0x10021b348 - std::sys::backtrace::__rust_end_short_backtrace::he99aa938f9475e2a
       9:        0x100213460 - _rust_begin_unwind
      10:        0x10023a6c0 - core::panicking::panic_fmt::h5a90ea35d2c8d236
      11:        0x10023a5f4 - core::result::unwrap_failed::h1004b19edf1ee39c
      12:        0x1001c5e4c - core::result::Result<T,E>::expect::h3cfa09ac261c995d
                                   at /private/tmp/rust-20241128-8290-tgv7i0/rustc-1.83.0-src/library/core/src/result.rs:1061:23
      13:        0x1001c6330 - build_script_build::generate_self_schema::h8998121fd627a745
                                   at /private/tmp/instructlab--pydantic-core-20241211-55519-ki01jd/pydantic_core-2.23.4/build.rs:15:18
      14:        0x1001c683c - build_script_build::main::h3408e214aa52d7ff
                                   at /private/tmp/instructlab--pydantic-core-20241211-55519-ki01jd/pydantic_core-2.23.4/build.rs:48:5
      15:        0x1001c5b74 - core::ops::function::FnOnce::call_once::h11534ba8fc470188
                                   at /private/tmp/rust-20241128-8290-tgv7i0/rustc-1.83.0-src/library/core/src/ops/function.rs:250:5
      16:        0x1001c5974 - std::sys::backtrace::__rust_begin_short_backtrace::h9308af8abe66a92e
                                   at /private/tmp/rust-20241128-8290-tgv7i0/rustc-1.83.0-src/library/std/src/sys/backtrace.rs:154:18
      17:        0x1001c590c - std::rt::lang_start::{{closure}}::h1e4794855c4666b3
                                   at /private/tmp/rust-20241128-8290-tgv7i0/rustc-1.83.0-src/library/std/src/rt.rs:195:18
      18:        0x10020c31c - std::rt::lang_start_internal::hadea728b8c40134b
      19:        0x1001c58d8 - std::rt::lang_start::h055df2df94d70e77
                                   at /private/tmp/rust-20241128-8290-tgv7i0/rustc-1.83.0-src/library/std/src/rt.rs:194:17
      20:        0x1001c69d4 - _main
  warning: build failed, waiting for other jobs to finish...
  💥 maturin failed
    Caused by: Failed to build a native library through cargo
    Caused by: Cargo build finished with "exit status: 101": env -u CARGO MACOSX_DEPLOYMENT_TARGET="11.0" PYO3_ENVIRONMENT_SIGNATURE="cpython-3.11-64bit" PYO3_PYTHON="/opt/homebrew/Cellar/instructlab/0.21.2/libexec/bin/python" PYTHON_SYS_EXECUTABLE="/opt/homebrew/Cellar/instructlab/0.21.2/libexec/bin/python" "cargo" "rustc" "--features" "pyo3/extension-module" "--message-format" "json-render-diagnostics" "--manifest-path" "/private/tmp/instructlab--pydantic-core-20241211-55519-ki01jd/pydantic_core-2.23.4/Cargo.toml" "--release" "--lib" "--crate-type" "cdylib" "--" "-C" "link-arg=-undefined" "-C" "link-arg=dynamic_lookup" "-C" "link-args=-Wl,-install_name,@rpath/pydantic_core._pydantic_core.cpython-311-darwin.so"
  Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/opt/homebrew/Cellar/instructlab/0.21.2/libexec/bin/python', '--compatibility', 'off'] returned non-zero exit status 1
  error: subprocess-exited-with-error

  × Building wheel for pydantic_core (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /opt/homebrew/Cellar/instructlab/0.21.2/libexec/bin/python /opt/homebrew/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /private/tmp/tmp1j6kzjhh
  cwd: /private/tmp/instructlab--pydantic-core-20241211-55519-ki01jd/pydantic_core-2.23.4
  Building wheel for pydantic_core (pyproject.toml): finished with status 'error'
  ERROR: Failed building wheel for pydantic_core
Failed to build pydantic_core
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pydantic_core)
/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --version
/opt/homebrew/Library/Homebrew/ignorable.rb:27:in block in raise'
BuildError: Failed executing: python3.11 -m pip --python=/opt/homebrew/Cellar/instructlab/0.21.2/libexec/bin/python install --verbose --no-deps --no-binary=:all: --ignore-installed --no-compile /private/tmp/instructlab--pydantic-core-20241211-55519-ki01jd/pydantic_core-2.23.4
1. raise
2. ignore
3. backtrace
4. irb
5. shell
Choose an action:

so I would like to try .whl,
but the weird thing is that my test is failed for ERROR: Directory '/private/tmp/instructlab--pydantic-core-20241211-40347-vjaz8v' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.

if you have any ideas, feel free to share, thanks a lot.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I still can see some using .whl.

  • gptme: multiprocessing-logging
  • scoutsuite: asyncio-throttle
  • pocsuite3: dacite
  • parsedmarc: events

This is only accepted when the .whl is tagged as py3-none-any and if there are no sdists (.tar.gzs) available on PyPI.

# check dylibs
dylibs_path = libexec/"lib/python3.11/site-packages/PIL/.dylibs"

dylib_path = dylibs_path/"libpng16.16.dylib"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use Homebrew libpng instead of vendoring a different one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new formula PR adds a new formula to Homebrew/homebrew-core python Python use is a significant feature of the PR or issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants