abetlen / abetlen/llama-cpp-python
[WinError 87] The parameter is incorrect : {'winmode': 0} after upgrading from 0.2.23 to 0.2.25
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 1.4k
- PR merge metrics
- PR metrics pending
Description
# Expected Behavior
I was trying to just install and use llama-cpp-python on a freshly set up anaconda environment.
I updated my anaconda navigator to the 2023.09 release version.
I created a new environment with python 3.11.5
I installed llama-cpp-python using `pip install llama-cpp-python`
I tried to run
```python
from llama_cpp import Llama, LlamaTokenizer
```
I expected it would import the classes into my script.
# Current Behavior
It resulted in an error [WinError87] unable to load the DLL.
I got an error:
```text
C:/Users/username/Anaconda3/envs/project_env/python.exe c:/Users/username/Desktop/python/project/test.py
LLAMA_CPP_LIB NOT IN OS ENVIRON Loading shared library from: [WindowsPath('C:/Users/username/Anaconda3/envs/project_env/Lib/site-packages/llama_cpp/llama.dll'), WindowsPath('C:/Users/username/Anaconda3/envs/project_env/Lib/site-packages/llama_cpp/libllama.dll')]
Added C:\Users\username\Anaconda3\envs\project_env\Lib\site-packages\llama_cpp to DLL search path
cdll_args: {'winmode': 0}
Traceback (most recent call last):
File "C:\Users\username\Anaconda3\envs\project_env\Lib\site-packages\llama_cpp\llama_cpp.py", line 80, in _load_shared_library
return ctypes.CDLL(str(_lib_path), **cdll_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\username\Anaconda3\envs\project_env\Lib\ctypes\__init__.py", line 376, in __init__
self._handle = _dlopen(self._name, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 87] The parameter is incorrect
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\username\Desktop\python\project\test.py", line 2, in
from ai import LlamaAI
File "c:\Users\username\Desktop\python\project\ai.py", line 1, in
from llama_cpp import Llama, LlamaTokenizer
File "C:\Users\username\Anaconda3\envs\project_env\Lib\site-packages\llama_cpp\__init__.py", line 1, in
from .llama_cpp import *
File "C:\Users\username\Anaconda3\envs\project_env\Lib\site-packages\llama_cpp\llama_cpp.py", line 93, in
_lib = _load_shared_library(_lib_base_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\username\Anaconda3\envs\project_env\Lib\site-packages\llama_cpp\llama_cpp.py", line 82, in _load_shared_library
raise RuntimeError(f"Failed to load shared library '{_lib_path}': {e} : {cdll_args}")
RuntimeError: Failed to load shared library 'C:\Users\username\Anaconda3\envs\project_env\Lib\site-packages\llama_cpp\llama.dll': [WinError 87] The parameter is incorrect : {'winmode': 0}
```
* username and project details are anonymized with generic placeholders.
# Environment and Context
Win 11 Enterprise 10.0 22621, Anaconda Navigator 2023.09.0, Python 3.11.5, llama-ccp-python 0.2.25
It's worth noting that before Anaconda upgrade I was never able to install this package via `pip install llama-cpp-python` and instead had to use git+https method.
After I encountered the error I uninstalled with pip uninstall llama-cpp-python and use git+https method to reinstall but it did not help.
My previous environments that use 0.2.23 version of llama-cpp-python still work correctly also with the updated Anaconda Navigator, so I doubt there's a problem with the Anaconda.
# Steps to Reproduce
Described in what i've done
#Side note
Thank you so much for your work and this amazing project!
Contributor guide
Assessment
This issue has not been assessed yet.