Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: name 'c_int_p' is not defined in pyogg library #113

Open
santiarr opened this issue Oct 27, 2024 · 2 comments
Open

NameError: name 'c_int_p' is not defined in pyogg library #113

santiarr opened this issue Oct 27, 2024 · 2 comments

Comments

@santiarr
Copy link

I encountered a NameError when trying to use the pyogg library. The error message indicates that c_int_p is not defined. This issue occurs when attempting to use the OpusDecoder from the pyogg library.

OS: macOS (M1)
Python version: 3.10.0
pyogg version: [Specify the version you are using]
Additional Information: I have installed the necessary dependencies for libopus using Homebrew:

I have also set the DYLD_LIBRARY_PATH environment variable in my .env file:

ibopus.opus_encoder_create.argtypes = [opus_int32, c_int, c_int, c_int_p] NameError: name 'c_int_p' is not defined. Did you mean: 'c_int'?

@goodpeter-sun
Copy link

I ran into the same. no solution?

@ozanyurt
Copy link

I found a solution for MacOS M1/M2. The issue occurs because system libraries are located in a different path and opuslib cannot find them.

Solution Steps:

  1. First, install required libraries using Homebrew:
brew install libogg opus opusfile libopusenc libvorbis flac
brew install opus-tools
  1. On M1/M2 Macs, Homebrew libraries are located under /opt/homebrew/lib/. Verify the libraries exist:
ls /opt/homebrew/lib/libopus*
  1. Set system library paths. Add these lines to your ~/.zshrc (or your shell config file):
export DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH
export LIBRARY_PATH=/opt/homebrew/lib:$LIBRARY_PATH
export PKG_CONFIG_PATH=/opt/homebrew/lib/pkgconfig:$PKG_CONFIG_PATH
  1. Apply the changes:
source ~/.zshrc
  1. Reinstall PyOgg or opuslib:
pip uninstall opuslib
pip install --no-cache-dir opuslib

After following these steps, the library should work correctly. This solution addresses the issue caused by Homebrew installing libraries under /opt/homebrew/lib/ on M1/M2 Macs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants