abetlen / llama-cpp-python

Python bindings for llama.cpp
https://llama-cpp-python.readthedocs.io
MIT License
8.01k stars 950 forks source link

pip install llama-cpp-python on anaconda #1654

Open werruww opened 2 months ago

werruww commented 2 months ago

(base) C:\Users\m>pip install llama-cpp-python Collecting llama-cpp-python Using cached llama_cpp_python-0.2.85.tar.gz (49.3 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: typing-extensions>=4.5.0 in c:\users\m\appdata\local\anaconda3\lib\site-packages (from llama-cpp-python) (4.7.1) Requirement already satisfied: numpy>=1.20.0 in c:\users\m\appdata\local\anaconda3\lib\site-packages (from llama-cpp-python) (1.24.3) Requirement already satisfied: diskcache>=5.6.1 in c:\users\m\appdata\local\anaconda3\lib\site-packages (from llama-cpp-python) (5.6.3) Requirement already satisfied: jinja2>=2.11.3 in c:\users\m\appdata\local\anaconda3\lib\site-packages (from llama-cpp-python) (3.1.2) Requirement already satisfied: MarkupSafe>=2.0 in c:\users\m\appdata\local\anaconda3\lib\site-packages (from jinja2>=2.11.3->llama-cpp-python) (2.1.1) Building wheels for collected packages: llama-cpp-python Building wheel for llama-cpp-python (pyproject.toml) ... | ########He stands and does not complete

werruww commented 2 months ago

conda install conda-forge::llama-cpp-python not work

werruww commented 2 months ago

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. gensim 4.3.0 requires FuzzyTM>=0.4.0, which is not installed. tables 3.8.0 requires blosc2~=2.0.0, which is not installed. tables 3.8.0 requires cython>=0.29.21, which is not installed. numba 0.57.1 requires numpy<1.25,>=1.21, but you have numpy 2.0.1 which is incompatible. scipy 1.11.1 requires numpy<1.28.0,>=1.21.6, but you have numpy 2.0.1 which is incompatible.

jcardonnet commented 2 months ago

I had the same issue. I got it working using uv to install the package: uv pip install -U llama-cpp-python The difference seems to be that pip tried to build the wheel instead of using the prebuilt one, but uv did the right thing.

werruww commented 2 months ago

pip install -U llama-cpp-python

.uvuv pip install -U llama-cpp-pythonpipuv

What do you mean and what is the correct installation command that stops in pyproject.toml?

werruww commented 2 months ago

(u) C:\Users\m\Desktop\1>python 1.py Traceback (most recent call last): File "C:\Users\m\AppData\Local\anaconda3\envs\u\Lib\site-packages\llama_cpp\llama_cpp.py", line 75, in _load_shared_library return ctypes.CDLL(str(_lib_path), **cdll_args) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\m\AppData\Local\anaconda3\envs\u\Lib\ctypes__init.py", line 376, in init__ self._handle = _dlopen(self._name, mode) ^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: Could not find module 'C:\Users\m\AppData\Local\anaconda3\envs\u\Lib\site-packages\llama_cpp\lib\llama.dll' (or one of its dependencies). Try using the full path with constructor syntax.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\m\Desktop\1\1.py", line 2, in from llama_cpp import Llama File "C:\Users\m\AppData\Local\anaconda3\envs\u\Lib\site-packages\llama_cpp__init__.py", line 1, in from .llama_cpp import * File "C:\Users\m\AppData\Local\anaconda3\envs\u\Lib\site-packages\llama_cpp\llama_cpp.py", line 88, in _lib = _load_shared_library(_lib_base_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\m\AppData\Local\anaconda3\envs\u\Lib\site-packages\llama_cpp\llama_cpp.py", line 77, in _load_shared_library raise RuntimeError(f"Failed to load shared library '{_lib_path}': {e}") RuntimeError: Failed to load shared library 'C:\Users\m\AppData\Local\anaconda3\envs\u\Lib\site-packages\llama_cpp\lib\llama.dll': Could not find module 'C:\Users\m\AppData\Local\anaconda3\envs\u\Lib\site-packages\llama_cpp\lib\llama.dll' (or one of its dependencies). Try using the full path with constructor syntax.

(u) C:\Users\m\Desktop\1>