"Could not find module 'ggml.dll' " when trying to run the Python bindings example on Windows
I'm trying to use this library on Windows. I've built the library with cmake and mingw.
I put the DLLs in examples/python_bindings/clip_cpp as the documentation suggests, I also tried in the folder of the Python script and in the \.venv\Lib\site-packages\clip_cpp folder and the error still occured. I've also tried manually setting the path of the DLL but the error persisted.
This is the error I encounter when I try to run the example:
PS C:\Users\edward\Documents\cod\clip.cpp\examples\python_bindings> python example_main.py
Traceback (most recent call last):
File "C:\Users\edward\Documents\cod\clip.cpp\examples\python_bindings\example_main.py", line 3, in <module>
from clip_cpp import Clip
File "C:\Users\edward\Documents\cod\clip.cpp\examples\python_bindings\clip_cpp\__init__.py", line 1, in <module>
from .clip import Clip
ggml_lib = ctypes.CDLL(ggml_lib_path)
File "C:\Users\edward\AppData\Local\Programs\Python\Python313\Lib\ctypes\__init__.py", line 390, in __init__
self._handle = _dlopen(self._name, mode)
~~~~~~~^^^^^^^^^^^^^^^^^^
FileNotFoundError: Could not find module 'ggml.dll' (or one of its dependencies). Try using the full path with constructor syntax.
libclip.dll and libggml.dll are what the build process produced, I copied them to clip.dll and ggml.dll to ensure that they are read. I believe I have all the dependencies, given I built it. If more details are needed I would be glad to provide them. Thanks in advance!
I am having the same issue with pip install -U clip_cpp. Which leads me to believe the issue is not in your build process.
Did you manage to solve it?
@Ahmad-ElHajj
I am having the same issue with
pip install -U clip_cpp. Which leads me to believe the issue is not in your build process.Did you manage to solve it?
pip install -U clip_cpp will not work on Windows because the provided library binaries from Pypi are built for Linux.
The documentation for the python bindings states this:
If you are on a X64 Linux distribution, you can simply Pip-install it If you are on another operating system [...] you can build it from source
You have to build it yourself for Windows. Despite me doing that and placing the binaries in appropriate locations, Python does not load them and returns only a vague error. I've checked with Dependencies that all modules can load correctly, which is the case. I don't know what else to try in order to solve this, given how vague the error message is.
If you attempt to build it yourself and you're able to successfully run it, please document all of the tools you used and post them here.