A strange error was encountered after pip install yara-python

Open
#263 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
c, python
Domain
tooling

Research direction

Start with yara/init.py, yara/rules.py, and yara/libyara_wrapper.py, then reproduce the failure after pip install yara-python on Python 3.11. Trace how the native library path is constructed and compare it with the reported libyara.dll location; done means the installed package imports successfully and loads the DLL.

Written by the indexing model from the issue text.

Description

Failed to import 'C:\Users\Name\AppData\Local\Programs\Python\Python311\DLLs\libyara.dll'
Traceback (most recent call last):
File "C:\Users\Name\AppData\Local\Programs\Python\Python311\Lib\site-packages\yara_init_.py", line 7, in
from yara.rules import compile
File "C:\Users\Name\AppData\Local\Programs\Python\Python311\Lib\site-packages\yara\rules.py", line 17, in
from yara.libyara_wrapper import *
File "C:\Users\Name\AppData\Local\Programs\Python\Python311\Lib\site-packages\yara\libyara_wrapper.py", line 315, in
libyaradll = cdll.LoadLibrary(library)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Name\AppData\Local\Programs\Python\Python311\Lib\ctypes_init_.py", line 454, in LoadLibrary
return self.dlltype(name)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\Name\AppData\Local\Programs\Python\Python311\Lib\ctypes_init
.py", line 376, in init
self._handle = _dlopen(self._name, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: Could not find module 'C:\Users\Name\AppData\Local\Programs\Python\Python311\DLLs\libyara.dll' (or one of its dependencies). Try using the full path with constructor syntax.

when I looked for the file, it turned out to be in this directory for me:
C:\Users\Name\AppData\Local\Programs\Python\Python311\Lib\site-packages\Users\Name\AppData\Local\Programs\Python\Python310\DLLs

Dominant language
C
Stars
754
Forks
190
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from VirusTotal/yara-python

All issues in VirusTotal/yara-python

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.