Alpaca icon indicating copy to clipboard operation
Alpaca copied to clipboard

App won’t run on macOS

Open iPyGuy opened this issue 9 months ago • 11 comments

Describe the bug The app immediately crashes upon opening.

Expected behavior The app opens without crashing.

Screenshots Image

Debugging information N/a for macOS.


This is with the current version of Alpaca 5.2.0 on macOS 15.

I thought maybe it is because you have to install ollama first but Alpaca is supposed to include it already, at least according to this page.

iPyGuy avatar Mar 16 '25 08:03 iPyGuy

It seems there's something wrong with venv. There are /Applications/Alpaca.app/Contents/Resources/venv/bin/python3, but app is looking for venv/Python3. I'm not really good at python and venvs, but i don't remember ever seeing anything named Python3 at venv root, it always was at /bin/python3. Image

Y-T04KA avatar Mar 16 '25 21:03 Y-T04KA

I played with it for a bit and tried making a symlink to venv/bin/python3 and it said dyld[93063]: Symbol not found: _Py_Initialize. It seems dyld expects something like Python3.dylib or Python3.framework, and doesn't like plain binary. Looks like a packaging problem.

I also checked 5.0.5 and 5.0 and 4.0.1 and they all have the same issue.

Y-T04KA avatar Mar 16 '25 22:03 Y-T04KA

Yeah, it sounds like perhaps macOS and most Linux distros store python in different locations or something and Alpaca seems to be mostly aimed at Linux, so even the Mac build of the app is looking in the wrong location?

iPyGuy avatar Mar 17 '25 05:03 iPyGuy

Is not that, the path is set for the python instance inside the app itself, looking for a solution for the next version, thanks for the report

Jeffser avatar Mar 18 '25 19:03 Jeffser

No problem and thank you!

iPyGuy avatar Mar 19 '25 04:03 iPyGuy

Just to update you guys on this.

Apparently Alpaca works in my MacOS instance because I had installed adwaita, gtk4 and other libraries directly into the system while testing.

Now the thing is, I need to find a way of packaging everything correctly inside of Alpaca, for the time being I will stop supporting MacOS, I also want to wait until Adwaita 1.7 is available in MacOS so that it can have the same features as Linux.

Jeffser avatar Mar 28 '25 02:03 Jeffser

Hmm, is adwaita, gtk4 and the other stuff available in homebrew?

Then it would be easy to install all the dependencies with a simple one liner like brew install adwaita gtk4 etc..

iPyGuy avatar Mar 28 '25 06:03 iPyGuy

well yeah you could do that but it's not ideal.

You would need

  • libadwaita
  • gtk4 (Included with Adwaita as dependency)
  • libspelling
  • vte3

Ideally I would package all of that inside Alpaca's libraries, thing is, I'm not sure how to tell python where the libraries are located

Jeffser avatar Mar 29 '25 17:03 Jeffser

Hmm, if someone could add Alpaca to homebrew, then those other packages could be installed automatically as dependencies with a brew install alpaca command, which would be easy enough.

Though I’m not sure if that would fix the python libraries issue you mentioned.

iPyGuy avatar Mar 30 '25 07:03 iPyGuy

I have all these libs installed but dmg still crashes. However, i've managed to run Alpaca built from source, for this i made another venv, installed all required packages, installed Alpaca to /opt/homebrew and edited /opt/homebrew/bin/alpaca to use my venv. This way it launches, however graphics is missing (in logs there are lots of <unknown>:58961): Gtk-WARNING **: 17:18:33.674: Theme parser error: style.css:102:249-250: Unrecognized image file format). I also tried to add remote ollama instance and it doesn't work, logs said every time i tried to add instance. I assume i missed something during build, will rerun it later when i'll have free time

P.S. Right before hitting Comment i thought -- if i patched brewed Alpaca to use my venv, could not i do the same for DMG? so i did, i patched all references to built-in venv in Alpaca.app/Contents/MacOS/Alpaca to use my venv and guess what...now it launches! Unfortunately, without graphics and can't add ollama instance too, can it be because some files from brewed version?

Traceback (most recent call last):
  File "/opt/homebrew/share/Alpaca/alpaca/instance_manager.py", line 562, in <lambda>
    save_button.connect('clicked', lambda button: save())
  File "/opt/homebrew/share/Alpaca/alpaca/instance_manager.py", line 541, in save
    if default_model_el.get_selected_item():
NameError: free variable 'default_model_el' referenced before assignment in enclosing scope
Image

Y-T04KA avatar Mar 30 '25 14:03 Y-T04KA

https://github.com/Jeffser/Alpaca/issues/597

olumolu avatar Apr 09 '25 03:04 olumolu