Skip to content

Failed to load shared library #208

Closed

Description

@teristam

I compiled and installed the latest code (0.1.5) in Windows 11 with Python 3.10.11 and CUDA 11.8. The compilation with cuBLAS flag and installation were successful. When importing the module via from llama_cpp import Llama, python reported

Failed to load shared library 'C:\Users\teristam\Anaconda3\envs\textgen\Lib\site-packages\llama_cpp\llama.dll': 
Could not find module 'C:\Users\teristam\Anaconda3\envs\textgen\Lib\site-packages\llama_cpp\llama.dll' (or one of its dependencies). Try using the full path with constructor syntax.

But when I change

return ctypes.CDLL(str(_lib_path))

to ctypes.CDLL(str(_lib_path),winmode=0), the dll is able to load succesfully. It may be related to a bug in ctype in Windows:

https://stackoverflow.com/questions/59330863/cant-import-dll-module-in-python/64472088#64472088
https://bugs.python.org/issue42114

Activity

  1. abetlen commented on May 15, 2023

    @abetlen
    Owner

    @teristam thanks for the bug report / solution, I'll update it so winmode=0. Are there any side-effects?

  2. aneeshjoy commented on May 17, 2023

    @aneeshjoy
    Contributor

    The winmod=0 alone did not fix this issue for me. I had add CUDA_PATH to dll dir. #225

  3. added a commit that references this issue on May 17, 2023
    0df288e
  4. added a commit that references this issue on Feb 5, 2024
    c804efe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    windowsA Windoze-specific issue

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions