Skip to content

OSError: sndfile library not found using ctypes.util.find_library #468

@inhahe

Description

@inhahe

I tried installing python-sound-file by running python setup.py install and then installing modules until it worked
But when I run my program, I get

Traceback (most recent call last):
  File "C:\python13\Lib\site-packages\soundfile.py", line 192, in <module>
    import _soundfile_data  # ImportError if this doesn't exist
    ^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named '_soundfile_data'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\python13\Lib\site-packages\soundfile.py", line 201, in <module>
    raise OSError('sndfile library not found using ctypes.util.find_library')
OSError: sndfile library not found using ctypes.util.find_library

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\py\recorder.py", line 1, in <module>
    import soundfile, pyaudio, numpy
  File "C:\python13\Lib\site-packages\soundfile.py", line 223, in <module>
    _snd = _ffi.dlopen(_explicit_libname)
OSError: cannot load library 'libsndfile.dll': error 0x7e

Here's everything I did:

C:\py\python-soundfile-master>pip install numpy
Collecting numpy
  Downloading numpy-2.3.2-cp313-cp313-win_amd64.whl.metadata (60 kB)
Downloading numpy-2.3.2-cp313-cp313-win_amd64.whl (12.8 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.8/12.8 MB 24.1 MB/s eta 0:00:00
Installing collected packages: numpy
Successfully installed numpy-2.3.2

[notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip

C:\py\python-soundfile-master>python setup.py install
Traceback (most recent call last):
  File "C:\py\python-soundfile-master\setup.py", line 4, in <module>
    from setuptools import setup
ModuleNotFoundError: No module named 'setuptools'

C:\py\python-soundfile-master>pip install setuptools
Collecting setuptools
  Using cached setuptools-80.9.0-py3-none-any.whl.metadata (6.6 kB)
Using cached setuptools-80.9.0-py3-none-any.whl (1.2 MB)
Installing collected packages: setuptools
Successfully installed setuptools-80.9.0

[notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip

C:\py\python-soundfile-master>python setup.py install
C:\python13\Lib\site-packages\setuptools\__init__.py:92: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
!!

        ********************************************************************************
        Requirements should be satisfied by a PEP 517 installer.
        If you are using pip, you can try `pip install --use-pep517`.

        By 2025-Oct-31, you need to update your project and remove deprecated calls
        or your builds will no longer be supported.
        ********************************************************************************

!!
  dist.fetch_build_eggs(dist.setup_requires)
Traceback (most recent call last):
  File "C:\py\python-soundfile-master\.eggs\cffi-1.17.1-py3.13-win-amd64.egg\cffi\cparser.py", line 5, in <module>
    from . import _pycparser as pycparser
ImportError: cannot import name '_pycparser' from 'cffi' (C:\py\python-soundfile-master\.eggs\cffi-1.17.1-py3.13-win-amd64.egg\cffi\__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\py\python-soundfile-master\setup.py", line 85, in <module>
    setup(
    ~~~~~^
        name='soundfile',
        ^^^^^^^^^^^^^^^^^
    ...<32 lines>...
        cmdclass=cmdclass,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "C:\python13\Lib\site-packages\setuptools\__init__.py", line 115, in setup
    return distutils.core.setup(**attrs)
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "C:\python13\Lib\site-packages\setuptools\_distutils\core.py", line 148, in setup
    _setup_distribution = dist = klass(attrs)
                                 ~~~~~^^^^^^^
  File "C:\python13\Lib\site-packages\setuptools\dist.py", line 321, in __init__
    _Distribution.__init__(self, dist_attrs)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "C:\python13\Lib\site-packages\setuptools\_distutils\dist.py", line 309, in __init__
    self.finalize_options()
    ~~~~~~~~~~~~~~~~~~~~~^^
  File "C:\python13\Lib\site-packages\setuptools\dist.py", line 784, in finalize_options
    ep(self)
    ~~^^^^^^
  File "C:\python13\Lib\site-packages\setuptools\dist.py", line 804, in _finalize_setup_keywords
    ep.load()(self, ep.name, value)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "C:\py\python-soundfile-master\.eggs\cffi-1.17.1-py3.13-win-amd64.egg\cffi\setuptools_ext.py", line 216, in cffi_modules
    add_cffi_module(dist, cffi_module)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "C:\py\python-soundfile-master\.eggs\cffi-1.17.1-py3.13-win-amd64.egg\cffi\setuptools_ext.py", line 49, in add_cffi_module
    execfile(build_file_name, mod_vars)
    ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\py\python-soundfile-master\.eggs\cffi-1.17.1-py3.13-win-amd64.egg\cffi\setuptools_ext.py", line 25, in execfile
    exec(code, glob, glob)
    ~~~~^^^^^^^^^^^^^^^^^^
  File "soundfile_build.py", line 5, in <module>
    ffibuilder = FFI()
  File "C:\py\python-soundfile-master\.eggs\cffi-1.17.1-py3.13-win-amd64.egg\cffi\api.py", line 65, in __init__
    from . import cparser
  File "C:\py\python-soundfile-master\.eggs\cffi-1.17.1-py3.13-win-amd64.egg\cffi\cparser.py", line 7, in <module>
    import pycparser
ModuleNotFoundError: No module named 'pycparser'

C:\py\python-soundfile-master>pip install pycparser
Collecting pycparser
  Using cached pycparser-2.22-py3-none-any.whl.metadata (943 bytes)
Using cached pycparser-2.22-py3-none-any.whl (117 kB)
Installing collected packages: pycparser
Successfully installed pycparser-2.22

[notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip

C:\py\python-soundfile-master>python setup.py install
C:\python13\Lib\site-packages\setuptools\__init__.py:92: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
!!

        ********************************************************************************
        Requirements should be satisfied by a PEP 517 installer.
        If you are using pip, you can try `pip install --use-pep517`.

        By 2025-Oct-31, you need to update your project and remove deprecated calls
        or your builds will no longer be supported.
        ********************************************************************************

!!
  dist.fetch_build_eggs(dist.setup_requires)
C:\python13\Lib\site-packages\setuptools\dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
!!

        ********************************************************************************
        Please consider removing the following classifiers in favor of a SPDX license expression:

        License :: OSI Approved :: BSD License

        See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
        ********************************************************************************

!!
  self._finalize_license_expression()
running install
C:\python13\Lib\site-packages\setuptools\_distutils\cmd.py:90: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        By 2025-Oct-31, you need to update your project and remove deprecated calls
        or your builds will no longer be supported.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
  self.initialize_options()
running build
running build_py
file _soundfile.py (for module _soundfile) not found
file _soundfile.py (for module _soundfile) not found
generating cffi module 'build\\lib\\_soundfile.py'
already up-to-date
running install_lib
copying build\lib\soundfile.py -> C:\python13\Lib\site-packages
copying build\lib\_soundfile.py -> C:\python13\Lib\site-packages
byte-compiling C:\python13\Lib\site-packages\soundfile.py to soundfile.cpython-313.pyc
byte-compiling C:\python13\Lib\site-packages\_soundfile.py to _soundfile.cpython-313.pyc
running install_egg_info
running egg_info
writing soundfile.egg-info\PKG-INFO
writing dependency_links to soundfile.egg-info\dependency_links.txt
writing requirements to soundfile.egg-info\requires.txt
writing top-level names to soundfile.egg-info\top_level.txt
reading manifest file 'soundfile.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
writing manifest file 'soundfile.egg-info\SOURCES.txt'
Copying soundfile.egg-info to C:\python13\Lib\site-packages\soundfile-0.13.1-py3.13.egg-info
running install_scripts

C:\py\python-soundfile-master>\py\recorder.py

C:\py\python-soundfile-master>python \py\recorder.py
Traceback (most recent call last):
  File "C:\py\recorder.py", line 1, in <module>
    import soundfile, pyaudio, numpy
  File "C:\python13\Lib\site-packages\soundfile.py", line 19, in <module>
    from typing_extensions import TypeAlias, Self, Final
ModuleNotFoundError: No module named 'typing_extensions'

C:\py\python-soundfile-master>pip install tying_extensions
ERROR: Could not find a version that satisfies the requirement tying_extensions (from versions: none)

[notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
ERROR: No matching distribution found for tying_extensions

C:\py\python-soundfile-master>pip install typing_extensions
Collecting typing_extensions
  Using cached typing_extensions-4.14.1-py3-none-any.whl.metadata (3.0 kB)
Using cached typing_extensions-4.14.1-py3-none-any.whl (43 kB)
Installing collected packages: typing_extensions
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
soundfile 0.13.1 requires cffi>=1.0, which is not installed.
Successfully installed typing_extensions-4.14.1

[notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip

C:\py\python-soundfile-master>python \py\recorder.py
Traceback (most recent call last):
  File "C:\py\recorder.py", line 1, in <module>
    import soundfile, pyaudio, numpy
  File "C:\python13\Lib\site-packages\soundfile.py", line 20, in <module>
    from _soundfile import ffi as _ffi
  File "C:\python13\Lib\site-packages\_soundfile.py", line 2, in <module>
    import _cffi_backend
ModuleNotFoundError: No module named '_cffi_backend'

C:\py\python-soundfile-master>  pip install cffi
Collecting cffi
  Using cached cffi-1.17.1-cp313-cp313-win_amd64.whl.metadata (1.6 kB)
Requirement already satisfied: pycparser in c:\python13\lib\site-packages (from cffi) (2.22)
Using cached cffi-1.17.1-cp313-cp313-win_amd64.whl (182 kB)
Installing collected packages: cffi
Successfully installed cffi-1.17.1

[notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip

C:\py\python-soundfile-master>python \py\recorder.py
Traceback (most recent call last):
  File "C:\python13\Lib\site-packages\soundfile.py", line 192, in <module>
    import _soundfile_data  # ImportError if this doesn't exist
    ^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named '_soundfile_data'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\python13\Lib\site-packages\soundfile.py", line 201, in <module>
    raise OSError('sndfile library not found using ctypes.util.find_library')
OSError: sndfile library not found using ctypes.util.find_library

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\py\recorder.py", line 1, in <module>
    import soundfile, pyaudio, numpy
  File "C:\python13\Lib\site-packages\soundfile.py", line 223, in <module>
    _snd = _ffi.dlopen(_explicit_libname)
OSError: cannot load library 'libsndfile.dll': error 0x7e

C:\py\python-soundfile-master>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions