question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OSError: ctypes.util.find_library() did not manage to locate a library called 'CoreAudio'

See original GitHub issue

Getting this error:

`
OSError: ctypes.util.find_library() did not manage to locate a library called 'CoreAudio'

When trying to import soundcard into my project. OS: macOS

Any idea on how I can solve that?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
andresmntrcommented, Mar 1, 2021

I have solved it temporarily by following these steps

Seeing the same issue with the same OS version and python 3.8.6:

Traceback (most recent call last):
  File "sound.py", line 1, in <module>
    import soundcard as sc
  File ".venv/lib/python3.8/site-packages/soundcard/__init__.py", line 11, in <module>
    from soundcard.coreaudio import *
  File ".venv/lib/python3.8/site-packages/soundcard/coreaudio.py", line 16, in <module>
    _ca = _ffi.dlopen('CoreAudio')
  File ".venv/lib/python3.8/site-packages/cffi/api.py", line 150, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
  File ".venv/lib/python3.8/site-packages/cffi/api.py", line 832, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
  File ".venv/lib/python3.8/site-packages/cffi/api.py", line 827, in _load_backend_lib
    raise OSError(msg)
OSError: ctypes.util.find_library() did not manage to locate a library called 'CoreAudio'

I have temporarily avoided the error by adding this code in …/lib/python3.8/site-packages/cffi/api.py

    if name=='CoreAudio':
        path='/System/Library/Frameworks/CoreAudio.framework/CoreAudio'
    if name=='AudioUnit':
        path='/System/Library/Frameworks/AudioUnit.framework/AudioUnit'

like so: solution

Hope it helps

0reactions
bastibecommented, Dec 19, 2022

I just installed Python 3.10.9 on my Big Sur MacBook Air, and ctypes.util.find_library() now works properly.

That’s very good to hear!

Since I don’t have access to a modern Mac, one of you will have to step in with a solution to the silence issue. I have no way of debugging this, unfortunately.

Read more comments on GitHub >

github_iconTop Results From Across the Web

In docker : OSError: ctypes.util.find_library() did not manage to ...
txt file. When i run docker container i got the below message. OSError: ctypes.util.find_library() did not manage to locate a library called ' ......
Read more >
Issue 44689: ctypes.util.find_library() does not find macOS 11 ...
Code that attempts to check for dynamic library presence by looking for a file at a path or enumerating a directory will fail....
Read more >
Python Examples of ctypes.util.find_library - ProgramCreek.com
The following are 30 code examples of ctypes.util.find_library(). You can vote up the ... except OSError as ex: print name, "import(%d): Library not...
Read more >
Don't use ctypes.util.find_library in ipaclient - freeipa - Pagure.io
ipaclient.csrgen_ffi uses ctypes.util.find_library('crypto') to locate OpenSSL's libcrypto.so . The function is costly and should be avoided in interactive ...
Read more >
OSError: ctypes.util.find_library() did not manage to locate a ...
OSError : ctypes.util.find_library() did not manage to locate a library called 'sndfile'. arrow_drop_up 1. I am getting this error when i tried to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found