Reputation: 1292
In my Python code I use yara to compile yara rules.
The documentation located at https://yara.readthedocs.io/en/stable/yarapython.html says that I can use it by importing it like this:
import yara
However when I run the code I get
FileNotFoundError: Could not find module 'C:\Users\bruker\Pycharmprojects\projectx\venv\DLLs\libyara.dll' (or one of its dependencies). Try using the full path with constructor syntax.
I am using a venv python enviroment for this project running in Windows 11.
I have tried the following:
However I still get that the libyara.dll file is missing:
Traceback (most recent call last):
File "C:\Users\bruker\Pycharmprojects\projectx\deploygate.py", line 14, in <module>
import yara
File "C:\Users\bruker\Pycharmprojects\projectx\venv\lib\site-packages\yara\__init__.py", line 7, in <module>
from yara.rules import compile
File "C:\Users\bruker\Pycharmprojects\projectx\venv\lib\site-packages\yara\rules.py", line 17, in <module>
from yara.libyara_wrapper import *
File "C:\Users\bruker\Pycharmprojects\projectx\venv\lib\site-packages\yara\libyara_wrapper.py", line 315, in <module>
libyaradll = cdll.LoadLibrary(library)
File "C:\Users\bruker\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 452, in LoadLibrary
return self._dlltype(name)
File "C:\Users\bruker\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Users\bruker\Pycharmprojects\projectx\venv\DLLs\libyara.dll' (or one of its dependencies). Try using the full path with constructor syntax.
How can I fix the yara dll file missing? I am using Python 3.10.
Upvotes: 0
Views: 2735
Reputation: 16
pip uninstall yara
pip install yara-python
Does the trick. Basically, you need to install yara-python instead of yara
Upvotes: 0