Coder Social home page Coder Social logo

Mac os native build not working about localai HOT 13 OPEN

glebnaz avatar glebnaz commented on June 11, 2024 1
Mac os native build not working

from localai.

Comments (13)

themeaningofmeaning avatar themeaningofmeaning commented on June 11, 2024

Interesting, I'm getting the same error as well with multiple build attempts.

LocalAI version:
v2.5.1

Environment, CPU architecture, OS, and Version:
MBP 16 M1 PRO

I've tried using Docker to build this after cloning the repo and it shows "unable to locate package conda" even though the build instructions do specify conda as a required dependency. I also ran a variety of make prepare build attempts and it throws an error about golang not existing even though the mentioned gpt4all-bindings/golang does in fact exist and contains the necessary dependencies. Strange.

  1. Docker log:
1.254 E: Unable to locate package conda
------
Dockerfile:60
--------------------
  59 |     
  60 | >>> RUN curl https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc | gpg --dearmor > conda.gpg && \
  61 | >>>     install -o root -g root -m 644 conda.gpg /usr/share/keyrings/conda-archive-keyring.gpg && \
  62 | >>>     gpg --keyring /usr/share/keyrings/conda-archive-keyring.gpg --no-default-keyring --fingerprint 34161F5BF5EB1D4BFBBB8F0A8AEB4F8B29D82806 && \
  63 | >>>     echo "deb [arch=amd64 signed-by=/usr/share/keyrings/conda-archive-keyring.gpg] https://repo.anaconda.com/pkgs/misc/debrepo/conda stable main" > /etc/apt/sources.list.d/conda.list && \
  64 | >>>     echo "deb [arch=amd64 signed-by=/usr/share/keyrings/conda-archive-keyring.gpg] https://repo.anaconda.com/pkgs/misc/debrepo/conda stable main" | tee -a /etc/apt/sources.list.d/conda.list && \
  65 | >>>     apt-get update && \
  66 | >>>     apt-get install -y conda && apt-get clean
  67 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c curl https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc | gpg --dearmor > conda.gpg &&     install -o root -g root -m 644 conda.gpg /usr/share/keyrings/conda-archive-keyring.gpg &&     gpg --keyring /usr/share/keyrings/conda-archive-keyring.gpg --no-default-keyring --fingerprint 34161F5BF5EB1D4BFBBB8F0A8AEB4F8B29D82806 &&     echo \"deb [arch=amd64 signed-by=/usr/share/keyrings/conda-archive-keyring.gpg] https://repo.anaconda.com/pkgs/misc/debrepo/conda stable main\" > /etc/apt/sources.list.d/conda.list &&     echo \"deb [arch=amd64 signed-by=/usr/share/keyrings/conda-archive-keyring.gpg] https://repo.anaconda.com/pkgs/misc/debrepo/conda stable main\" | tee -a /etc/apt/sources.list.d/conda.list &&     apt-get update &&     apt-get install -y conda && apt-get clean" did not complete successfully: exit code: 100

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/zasirx96yr7cszlyhxyn4ddi4

  1. make prepare log:
Switched to a new branch 'build'
touch get-sources
go mod edit -replace github.com/nomic-ai/gpt4all/gpt4all-bindings/golang=/Users/meaning/Desktop/uploading d1/LocalAI/sources/gpt4all/gpt4all-bindings/golang
go: open d1/LocalAI/sources/gpt4all/gpt4all-bindings/golang: no such file or directory
make: *** [replace] Error 1

from localai.

muellest avatar muellest commented on June 11, 2024

@themeaningofmeaning: Unfortunately I get the same error =(. Any news on this?

LocalAI version:
v.2.3.1
v.2.4.0
v2.5.1

Environment, CPU architecture, OS, and Version:
MBP 14 M1 PRO

Logs

failed to solve: executor failed running [/bin/sh -c curl https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc | gpg --dearmor > conda.gpg && install -o root -g root -m 644 conda.gpg /usr/share/keyrings/conda-archive-keyring.gpg && gpg --keyring /usr/share/keyrings/conda-archive-keyring.gpg --no-default-keyring --fingerprint 34161F5BF5EB1D4BFBBB8F0A8AEB4F8B29D82806 && echo "deb [arch=amd64 signed-by=/usr/share/keyrings/conda-archive-keyring.gpg] https://repo.anaconda.com/pkgs/misc/debrepo/conda stable main" > /etc/apt/sources.list.d/conda.list && echo "deb [arch=amd64 signed-by=/usr/share/keyrings/conda-archive-keyring.gpg] https://repo.anaconda.com/pkgs/misc/debrepo/conda stable main" | tee -a /etc/apt/sources.list.d/conda.list && apt-get update && apt-get install -y conda]: exit code: 100

from localai.

glebnaz avatar glebnaz commented on June 11, 2024

@themeaningofmeaning i have the same error with docker. Should we wait help from author?

from localai.

themeaningofmeaning avatar themeaningofmeaning commented on June 11, 2024

@glebnaz @muellest - I haven't been able to figure out a solution as it appears to be an issue with the release and Apple Silicon. I haven't tried installing conda or Miniconda before doing a Docker build....that would be one thing to test, but I think we need to wait to hear from the author. I've tried every build in the book and it's not working on the M1

from localai.

muellest avatar muellest commented on June 11, 2024

Perhaps this is an alternative to using Docker: https://localai.io/basics/build/ (not tested yet).

from localai.

gaoyifan avatar gaoyifan commented on June 11, 2024

The following patch allows me to compile on the Apple Silicon platform. However, the error messages I encountered during compilation are different from @glebnaz , so please take them as reference only.

diff --git a/Makefile b/Makefile
index 6afc644..4414eaa 100644
--- a/Makefile
+++ b/Makefile
@@ -112,7 +112,7 @@ ifeq ($(BUILD_TYPE),hipblas)
 endif

 ifeq ($(BUILD_TYPE),metal)
-	CGO_LDFLAGS+=-framework Foundation -framework Metal -framework MetalKit -framework MetalPerformanceShaders
+	CGO_LDFLAGS+=-framework Foundation -framework Metal -framework MetalKit -framework MetalPerformanceShaders -framework CoreML
 	export LLAMA_METAL=1
 	export WHISPER_METAL=1
 endif

from localai.

glebnaz avatar glebnaz commented on June 11, 2024

@gaoyifan For me your patch doesn't help.

go mod edit -replace github.com/nomic-ai/gpt4all/gpt4all-bindings/golang=/Users/glebnaz/Documents/#main/workspace/localai/sources/gpt4all/gpt4all-bindings/golang
go mod edit -replace github.com/go-skynet/go-ggml-transformers.cpp=/Users/glebnaz/Documents/#main/workspace/localai/sources/go-ggml-transformers
go mod edit -replace github.com/donomii/go-rwkv.cpp=/Users/glebnaz/Documents/#main/workspace/localai/sources/go-rwkv
go mod edit -replace github.com/ggerganov/whisper.cpp=/Users/glebnaz/Documents/#main/workspace/localai/sources/whisper.cpp
go mod edit -replace github.com/ggerganov/whisper.cpp/bindings/go=/Users/glebnaz/Documents/#main/workspace/localai/sources/whisper.cpp/bindings/go
go mod edit -replace github.com/go-skynet/go-bert.cpp=/Users/glebnaz/Documents/#main/workspace/localai/sources/go-bert
go mod edit -replace github.com/mudler/go-stable-diffusion=/Users/glebnaz/Documents/#main/workspace/localai/sources/go-stable-diffusion
go mod edit -replace github.com/M0Rf30/go-tiny-dream=/Users/glebnaz/Documents/#main/workspace/localai/sources/go-tiny-dream
go mod edit -replace github.com/mudler/go-piper=/Users/glebnaz/Documents/#main/workspace/localai/sources/go-piper
go mod download
touch prepare-sources
touch prepare
CGO_LDFLAGS=" -lcblas -framework Accelerate -framework Foundation -framework Metal -framework MetalKit -framework MetalPerformanceShaders -framework CoreML" C_INCLUDE_PATH=/Users/glebnaz/Documents/#main/workspace/localai/sources/go-ggml-transformers LIBRARY_PATH=/Users/glebnaz/Documents/#main/workspace/localai/sources/go-ggml-transformers \
	go build -ldflags " -X "github.com/go-skynet/LocalAI/internal.Version=v2.4.1-2-g62a02cd" -X "github.com/go-skynet/LocalAI/internal.Commit=62a02cd1feb7cf8a75bcbe253fb95f204f022c1f"" -tags "" -o backend-assets/grpc/falcon-ggml ./backend/go/llm/falcon-ggml/
backend/go/llm/transformers/dolly.go:11:2: falcon.go: malformed #cgo argument: -I/Users/glebnaz/Documents/#main/workspace/localai/sources/go-ggml-transformers/ggml.cpp/include/
make: *** [backend-assets/grpc/falcon-ggml] Error 1

but thank you for your comment

from localai.

muellest avatar muellest commented on June 11, 2024

Anything new on this topic? - Are there any identified workarounds or solutions?

@mudler , could you please confirm whether this can be recognized as a confirmed bug?

from localai.

glebnaz avatar glebnaz commented on June 11, 2024

@mudler do you have time to participate to solution?

from localai.

mudler avatar mudler commented on June 11, 2024

I don't have a Mac (yet) to double check, but the CI doesn't show the same symptoms. Actually the falcon-ggml backend is a candidate for deprecation (see: #1126 for more context).

Maybe @dave-gray101 can chime in here, I think you fixed MacOS builds lately right?

However, in any case I think you could workaround that but selectively choose what backend to build during build time, for instance to build only llama.cpp, you can run:

make GRPC_BACKENDS=backend-assets/grpc/llama-cpp build

see also: https://localai.io/basics/build/#build-only-a-single-backend

from localai.

muellest avatar muellest commented on June 11, 2024

@dave-gray101 Can you support/help us?

from localai.

jamu85 avatar jamu85 commented on June 11, 2024

I am reproducable able to build 2.7 with BUILD_TYPE=metal BUILD_GRPC_FOR_BACKEND_LLAMA=true on Mac M2 Max(12) on Sonoma with 32GB Ram. However it's a memory heavy compilation and takes a while.
I was not able to build it by linking against installed dependencies.

EDIT:

make BUILD_TYPE=metal BUILD_GRPC_FOR_BACKEND_LLAMA=true build  5209.78s user 20787.18s system 526% cpu 1:22:15.54 total

from localai.

jamu85 avatar jamu85 commented on June 11, 2024

I was able to compile today with tts,stablediffusion and tinydream backend. It builds but it's a bit of a mess. I made a PR for one issue but I'm not sure where to implement the remaining fixes.

from localai.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.