AttributeError: 'TenVad' object has no attribute 'vad_library'
AttributeError: 'TenVad' object has no attribute 'vad_library'
Hi Mohamed,
please paste the whole error log, so that we can analyze it much better. Also you can provide us how you used it, and what code you ran, etc... Please provide us more details :-)
Traceback (most recent call last):
File "/workspace/try_ten_vad.py", line 3, in
vad = TenVad()
^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/ten_vad.py", line 27, in init
self.vad_library = CDLL(
^^^^^
File "/usr/lib/python3.11/ctypes/init.py", line 376, in init
self._handle = _dlopen(self._name, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: ../usr/local/lib/python3.11/dist-packages/./ten_vad_library/libten_vad.so: invalid ELF header
Exception ignored in: <function TenVad.__del__ at 0x7f7e97bfaf20>
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/ten_vad.py", line 70, in del
self.vad_library.ten_vad_destroy(
^^^^^^^^^^^^^^^^
AttributeError: 'TenVad' object has no attribute 'vad_library'
@Ziyi223
I installed apt install libc++1
then i ran pip install -U --force-reinstall -v git+https://huggingface.co/TEN-framework/ten-vad
then ran this script
from ten_vad import TenVad
vad = TenVad()
print(dir(vad))
and it gave me the error you have seen
@MohamedRashad On which platform, which CPU architecture you ran the code?
Platform: Linux or?
Arch: x86, x86_64, arm64?
@MohamedRashad I guess the reason is that you did not pull the .so file from the Git LFS. Check the size of the Linux lib, the size should be about 300 KB, otherwise you have to pull it from Git LFS.
Run the code below:git lfs pull
I get this error now:
× python setup.py develop did not run successfully.
│ exit code: 1
╰─> [48 lines of output]
running develop
/usr/local/lib/python3.11/dist-packages/setuptools/_distutils/cmd.py:90: DevelopDeprecationWarning: develop command is deprecated.
!!
********************************************************************************
Please avoid running ``setup.py`` and ``develop``.
Instead, use standards-based tools like pip or uv.
By 2025-Oct-31, you need to update your project and remove deprecated calls
or your builds will no longer be supported.
See https://github.com/pypa/setuptools/issues/917 for details.
********************************************************************************
!!
self.initialize_options()
WARNING: Ignoring invalid distribution ~en-vad (/usr/local/lib/python3.11/dist-packages)
Obtaining file:///workspace/audio_experiments/ten-vad
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Checking if build backend supports build_editable: started
Checking if build backend supports build_editable: finished with status 'done'
Getting requirements to build editable: started
Getting requirements to build editable: finished with status 'done'
Preparing editable metadata (pyproject.toml): started
Preparing editable metadata (pyproject.toml): finished with status 'done'
WARNING: Ignoring invalid distribution ~en-vad (/usr/local/lib/python3.11/dist-packages)
Building wheels for collected packages: ten_vad
Building editable for ten_vad (pyproject.toml): started
Building editable for ten_vad (pyproject.toml): finished with status 'done'
Created wheel for ten_vad: filename=ten_vad-1.0-0.editable-py3-none-any.whl size=2581 sha256=00ba31389c9825c00c95ac1404cfa5b616d7a8fcc0f6a8f852a26623ff5dd5c1
Stored in directory: /tmp/pip-ephem-wheel-cache-eebav7jt/wheels/ea/05/3b/bcc923ea6b6037b382acd4cf4d1ceea40f33232aa301c9dcbd
Successfully built ten_vad
Installing collected packages: ten_vad
WARNING: Ignoring invalid distribution ~en-vad (/usr/local/lib/python3.11/dist-packages)
Successfully installed ten_vad-1.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
WARNING: Ignoring invalid distribution ~en-vad (/usr/local/lib/python3.11/dist-packages)
WARNING: Ignoring invalid distribution ~en-vad (/usr/local/lib/python3.11/dist-packages)
[notice] A new release of pip is available: 25.0.1 -> 25.1.1
[notice] To update, run: python -m pip install --upgrade pip
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/workspace/audio_experiments/ten-vad/setup.py", line 23, in <module>
os.remove(f"{root_dir}/ten_vad.py")
FileNotFoundError: [Errno 2] No such file or directory: '/workspace/audio_experiments/ten-vad/ten_vad.py'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
Sorry for the late reply. I think the reason is the LFS storage system seems does not support the way of "pip install". We also have the same repository on github, you can install it via github by the following command:pip install -U --force-reinstall -v git+https://github.com/TEN-framework/ten-vad.git
I think this will solve the problem.
It's working now, thanks a lot