abetlen / abetlen/llama-cpp-python
The compiled libllama.dll could NOT be found.
- Lenguaje dominante
- Python
- Estrellas
- 10.6k
- Forks
- 1.4k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
# Prerequisites
Please answer the following questions for yourself before submitting an issue.
- [x] I am running the latest code. Development is very rapid so there are no tagged versions as of now.
- [x] I carefully followed the [[README.md](https://github.com/abetlen/llama-cpp-python/blob/main/README.md)](https://github.com/abetlen/llama-cpp-python/blob/main/README.md).
- [x] I [[searched using keywords relevant to my issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/filtering-and-searching-issues-and-pull-requests)](https://docs.github.com/en/issues/tracking-your-work-with-issues/filtering-and-searching-issues-and-pull-requests) to make sure that I am creating a new issue that is not already open (or closed).
- [x] I reviewed the [[Discussions](https://github.com/abetlen/llama-cpp-python/discussions)](https://github.com/abetlen/llama-cpp-python/discussions), and have a new bug or useful enhancement to share.
# Expected Behavior
- I hope the compiled **libllama.dll** file can be used normally in other directories as well.
- I hope the following Python script can run correctly.
# Current Behavior
- The currently compiled **libllama.dll** file reports errors and cannot be used normally in other directories.
- The following Python script can NOT run correctly.
# Environment and Context
Physical hardware i am using:
- Operating System: Windows 10 Pro 21H2 19044.2965 64bit x64
- CPU: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz 2.42 GHz
SDK version(The CMake and MinGW folders were copied from CLion and added separately to the environment variables):
- python: 3.10.9
- llama_cpp_python: 0.2.69
- pywin32-ctypes: 0.2.2
- cmake: 3.28.1 (CMake; JetBrains IDE bundle; build 16)
- g++: 13.1.0
- gcc: 13.1.0
# Steps to Reproduce
1. step 1: Create **env** folder and placed in the same directory level as llama-cpp-python.
2. step 2: Copy the **CMake** and **MinGW folders** from CLion directory and add to the **env** folder.
3. step 3: Add CMake and MinGW to the system environment variables.(cmake: `***\env\cmake\win\x64\bin`; mingw:`***\env\mingw\bin`)
4. step 4: `cd llama-cpp-python`
5. step 5: `mkdir build`
6. step 6: `cd build`
7. step 7: `cmake .. -DBUILD_SHARED_LIBS=ON -G "MinGW Makefiles"`
8. step 8: `cmake --build . --config Release`
9. step 9: Then, I can find the **libllama.dll** file in the directory `***\llama-cpp-python\build\bin\`.
10. step 10: Then, I copied the generated libllama.dll to another directory for testing, but the test failed. I pinpointed the issue to the following code:
```python
import ctypes
import os
cdll_args = dict()
cdll_args["winmode"] = ctypes.RTLD_GLOBAL
os.add_dll_directory('D:/temp/test/llama_cpp')
_lib_path = 'D:/temp/test/llama_cpp/libllama.dll'
ctypes.CDLL(str(_lib_path), **cdll_args)
```
# Failure Logs
The ERROR log as following:
```
Traceback (most recent call last):
File "D:\temp\test.py", line 25, in
ctypes.CDLL(str(_lib_path), **cdll_args)
File "C:\Users\testuser\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 127] The specified procedure could not be found
```
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.