Skip to content

FileNotFoundError: Shared library with base name 'llama' not found #1475

@0xWOLAND

Description

@0xWOLAND

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest code. Development is very rapid so there are no tagged versions as of now.
  • I carefully followed the README.md.
  • I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • I reviewed the Discussions, and have a new bug or useful enhancement to share.

Expected Behavior

I am trying to import llama_cpp into a PyQt app that is compiled with Pyinstaller. I expect that I should be able to build with Pyinstaller and use llama_cpp in the app.

Current Behavior

Currently, if I import anything other than llama_cpp (e.g. torch), Pyinstaller works perfectly. However, if I replace the import with llama_cpp (not even using it anywhere), Pyinstaller throws

FileNotFoundError: Shared library with base name 'llama' not found
[24507] Failed to execute script 'setup' due to unhandled exception: Shared library with base name 'llama' not found

Environment and Context

OS: macOS 14.5 23F79 arm64 
Shell: zsh 5.9 
CPU: Apple M2 Max 
GPU: Apple M2 Max 
Memory: 5062MiB / 32768MiB 
g++: 
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.5.0
Thread model: posix

make: GNU Make 3.81
python: Python 3.9.19

# Python Env Requirements
PySide6==6.7.0
llama_cpp_python==0.2.64

Failure Information (for bugs)

Steps to Reproduce

Please provide detailed steps for reproducing the issue. We are not sitting in front of your screen, so the more detail the better.

  1. Run main.py
# main.py
from PySide6.QtWidgets import QApplication, QMainWindow, QSystemTrayIcon, QMenu
from llama_cpp import Llama
import sys
import os


class SystemTrayIcon(QMainWindow):
    def __init__(self):
        super().__init__()
        self.menu = QMenu()
        showAction = self.menu.addAction("Show")
        showAction.triggered.connect(self.show)

    def exit(self):
        sys.exit()


if __name__ == "__main__":
    app = QApplication()
    app.setQuitOnLastWindowClosed(False)
    trayIcon = SystemTrayIcon()

    app.exec()
  1. Compile with pyinstaller main.py --onefile
  2. Run executable dist/main
  3. Currently getting the error FileNotFoundError: Shared library with base name 'llama' not found

Thank you so much for the help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions