Search code examples
pythonmacosvlc

VLC library error; cannot import it into code


I'm attempting to run this code from GitHub: https://github.com/hemantapkh/PyBirthdayWish. I downloaded and imported VLC into python, but now I'm getting this error:

Traceback (most recent call last): File "/Users/ashleen/Downloads/PyBirthdayWish-main/PyBirthdayWish.py", line 7, in import vlc File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/vlc.py", line 210, in dll, plugin_path = find_lib() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/vlc.py", line 182, in find_lib ctypes.CDLL(c) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ctypes/init.py", line 374, in init self._handle = _dlopen(self._name, mode) OSError: dlopen(/Applications/VLC.app/Contents/MacOS/lib/libvlccore.dylib, 0x0006): tried: '/Applications/Python 3.10/IDLE.app/Contents/Frameworks/libvlccore.dylib' (no such file), '/Applications/VLC.app/Contents/MacOS/lib/libvlccore.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/libvlccore.dylib' (no such file), '/Applications/Python 3.10/IDLE.app/Contents/Frameworks/libvlccore.9.dylib' (no such file), '/Applications/VLC.app/Contents/MacOS/lib/libvlccore.9.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/libvlccore.9.dylib' (no such file)

I'm on Mac, and I'm using Python (3.10.0 and 64 bits) and I'm also using VLC (64 bits).

I don't have any coding experience/knowledge so I'm not exactly sure what to do, so any help would be appreciated!! Apologies in advance for any ignorant questions.


Solution

  • Did you install the requirements using pip install -r requirements.txt?
    If you did, you may have possibly installed the wrong version of VLC, since it seems you have the wrong version of a certain library (see the last line of your error message).
    When installing VLC (and other software) make sure you install the "apple silicon" version of it. This just means it will be able to run correctly on your computer.
    The apple silicon version of VLC is available here