0

I plan to install llama-cpp-python. However, I get error about "Could not find module 'D:\anaconda\Lib\site-packages\llama_cpp\lib\llama.dll' (or one of its dependencies). "

I have Microsoft visual c++, and I am using anaconda jupyterlab to run the code. I only have cpu to run in my local.

pip install llama_cpp_python-0.3.4-cp312-cp312-win_amd64.whl

: no error here (after i check, i install the correct version of whl which matched my python and processor version)

Then I run,

import llama_cpp

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
File D:\anaconda\Lib\site-packages\llama_cpp\_ctypes_extensions.py:67, in load_shared_library(lib_base_name, base_path)
     66 try:
---> 67     return ctypes.CDLL(str(lib_path), **cdll_args)  # type: ignore
     68 except Exception as e:

File D:\anaconda\Lib\ctypes\__init__.py:379, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
    378 if handle is None:
--> 379     self._handle = _dlopen(self._name, mode)
    380 else:

FileNotFoundError: Could not find module 'D:\anaconda\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:

RuntimeError                              Traceback (most recent call last)
Cell In[1], line 1
----> 1 import llama_cpp

File D:\anaconda\Lib\site-packages\llama_cpp\__init__.py:1
----> 1 from .llama_cpp import *
      2 from .llama import *
      4 __version__ = "0.3.4"

File D:\anaconda\Lib\site-packages\llama_cpp\llama_cpp.py:38
     36 _base_path = pathlib.Path(os.path.abspath(os.path.dirname(__file__))) / "lib" if _override_base_path is None else pathlib.Path(_override_base_path)
     37 # Load the library
---> 38 _lib = load_shared_library(_lib_base_name, _base_path)
     40 ctypes_function = ctypes_function_for_shared_library(_lib)
     43 # from ggml.h
     44 # // NOTE: always add types at the end of the enum to keep backward compatibility
     45 # enum ggml_type {
   (...)
     76 #     GGML_TYPE_COUNT,
     77 # };

File D:\anaconda\Lib\site-packages\llama_cpp\_ctypes_extensions.py:69, in load_shared_library(lib_base_name, base_path)
     67             return ctypes.CDLL(str(lib_path), **cdll_args)  # type: ignore
     68         except Exception as e:
---> 69             raise RuntimeError(f"Failed to load shared library '{lib_path}': {e}")
     71 raise FileNotFoundError(
     72     f"Shared library with base name '{lib_base_name}' not found"
     73 )

RuntimeError: Failed to load shared library 'D:\anaconda\Lib\site-packages\llama_cpp\lib\llama.dll': Could not find module 'D:\anaconda\Lib\site-packages\llama_cpp\lib\llama.dll' (or one of its dependencies). Try using the full path with constructor syntax.

How to solve this error? helppp I really need this to be working...

1 Answer 1

0

You are using Anaconda. You should use conda to install your packages whenever possible, not pip. Pip does not play nice with conda environments.

conda install llama-cpp-python -c conda-forge
Sign up to request clarification or add additional context in comments.

1 Comment

omggg, thanks!! I solved the error!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.