sbraz / pymediainfo

A Python wrapper around the MediaInfo library
https://pymediainfo.readthedocs.org/
Other
316 stars 57 forks source link

Add support for macOS ARM #127

Open Tohrusky opened 1 year ago

Tohrusky commented 1 year ago

In Mac OS arm, use pip to install, the libmediainfo.0.dylib is not found like. So I copy the lib in pypi pkg for macos x64, it work.

We found that in https://mediaarea.net/en/MediaInfo/Download/Mac_OS, libmediainfo.0.dylib is a universal lib for mac, so just add a package named like pymediainfo-6.0.1-py3-none-macosx_10_15_universal2.whl in PYPI, it can work

sbraz commented 1 year ago

Hi, the wheel for v6.0.1 contains the x86_64+arm64 dylib, see my comment here: https://github.com/sbraz/pymediainfo/issues/24#issuecomment-1327887190

If you get https://files.pythonhosted.org/packages/a7/73/9f6602d6356bcf4c671f0d10999365cff6ebade197050f910d92f7501838/pymediainfo-6.0.1-py3-none-macosx_10_15_x86_64.whl, it should work. What version did your pip install command try to install? I need all that info in order to help you.

Tohrusky commented 1 year ago

just pip install pymediainfo

yep. I know the wheel for v6.0.1 contains the x86_64+arm64 dylib, but pip for arm mac will not install it. To use pip install, a arm64 or universal2 tag like https://pypi.org/project/opencv-python/#files is needed ,or it will not install the Binary Wheel which contained the lib

sbraz commented 1 year ago

OK, so the wheel is fine but it lacks a universal2 tag, right? I assume I have to change https://github.com/sbraz/pymediainfo/blob/f97cd5482a86e7b9bb553550ef2436a203984a98/setup.py#L29 I'll have to check this, the issue is that I don't have a MacOS system other than the AppVeyor CI so it makes it difficult to debug this.

Tohrusky commented 1 year ago

https://github.com/Tohrusky/realcugan-ncnn-py/blob/main/setup.py In my repo, I force-name the platform. Hope it can help ya lol

And when python < 3.9, universal2 tag is not enabled, so add a extra pkg with arm64 tag is more easy

sbraz commented 1 year ago

Thanks, that's really helpful. In my case, I probably also need to force a platform name because I run code on a non-universal2 Python apparently.

Do you know if pip will find the universal2 wheel properly even if sysconfig.get_platform() returns macosx-10.9-x86_64 or macosx-arm64? Is that something you can test?

Also why do you disable this tag before Python 3.9?

Tohrusky commented 1 year ago

Do you know if pip will find the universal2 wheel properly even if sysconfig.get_platform() returns macosx-10.9-x86_64 or macosx-arm64? Is that something you can test?

When python >= 3.9, arm x86 and arm can find it. I have tested it in github action in the repo Also why do you disable this tag before Python 3.9?

Python3.8 for arm seems not a official build.So the uni tag is enabled after 3.8

cerrutopolaris commented 1 year ago

Hi, when launch my application with pymedia info I have this error: OSError: Failed to load library from libmediainfo.0.dylib, libmediainfo.dylib - dlopen(libmediainfo.0.dylib, 0x0006): tried: 'libmediainfo.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibmediainfo.0.dylib' (no such file), '/usr/lib/libmediainfo.0.dylib' (no such file, not in dyld cache), 'libmediainfo.0.dylib' (no such file), '/usr/local/lib/libmediainfo.0.dylib' (no such file), '/usr/lib/libmediainfo.0.dylib' (no such file, not in dyld cache), dlopen(libmediainfo.dylib, 0x0006): tried: 'libmediainfo.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibmediainfo.dylib' (no such file), '/usr/lib/libmediainfo.dylib' (no such file, not in dyld cache), 'libmediainfo.dylib' (no such file), '/usr/local/lib/libmediainfo.dylib' (no such file), '/usr/lib/libmediainfo.dylib' (no such file, not in dyld cache)

I have a problem with this library on my Mac arm m1/m2 mini. Can I solve and fix this problem?

Tohrusky commented 1 year ago

Hi, when launch my application with pymedia info I have this error:嗨,当使用 pymedia 信息启动我的应用程序时,我遇到此错误: OSError: Failed to load library from libmediainfo.0.dylib, libmediainfo.dylib - dlopen(libmediainfo.0.dylib, 0x0006): tried: 'libmediainfo.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibmediainfo.0.dylib' (no such file), '/usr/lib/libmediainfo.0.dylib' (no such file, not in dyld cache), 'libmediainfo.0.dylib' (no such file), '/usr/local/lib/libmediainfo.0.dylib' (no such file), '/usr/lib/libmediainfo.0.dylib' (no such file, not in dyld cache), dlopen(libmediainfo.dylib, 0x0006): tried: 'libmediainfo.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibmediainfo.dylib' (no such file), '/usr/lib/libmediainfo.dylib' (no such file, not in dyld cache), 'libmediainfo.dylib' (no such file), '/usr/local/lib/libmediainfo.dylib' (no such file), '/usr/lib/libmediainfo.dylib' (no such file, not in dyld cache)OSError:无法从libmediainfo.0.dylib加载库,libmediainfo.dylib - dlopen(libmediainfo.0.dylib, 0x0006): 尝试: 'libmediainfo.0.dylib' (没有这样的文件), '/System/Volumes/Preboot/Cryptexes/OSlibmediainfo.0.dylib' (没有这样的文件), '/usr/lib/libmediainfo.0.dylib' (没有这样的文件, 不在dyld cache中), 'libmediainfo.0.dylib' (没有这样的文件), '/usr/local/lib/libmediainfo.0.dylib' (没有这样的文件), '/usr/lib/libmediainfo.0.dylib' (没有这样的文件, 不在dyld cache中), dlopen(libmediainfo.dylib, 0x0006): 尝试: 'libmediainfo.dylib' (没有这样的文件), '/System/Volumes/Preboot/Cryptexes/OSlibmediainfo.dylib' (没有这样的文件), '/usr/lib/libmediainfo.dylib' (没有这样的文件, 不在 dyld 缓存中), 'libmediainfo.dylib' (没有这样的文件), '/usr/local/lib/libmediainfo.dylib' (没有这样的文件), '/usr/lib/libmediainfo.dylib' (没有这样的文件,不在 dyld 缓存中)

I have a problem with this library on my Mac arm m1/m2 mini.我的 Mac arm m1/m2 mini 上的这个库有问题。 Can I solve and fix this problem?我可以解决并解决此问题吗?

just copy a libmediainfo.dylib from here or the x86 mac pypi wheel to the package root directory. its a universal2 lib.

cerrutopolaris commented 1 year ago

how I try this have this error pip install https://files.pythonhosted.org/packages/a7/73/9f6602d6356bcf4c671f0d10999365cff6ebade197050f910d92f7501838/pymediainfo-6.0.1-py3-none-macosx_10_15_x86_64.whl ERROR: pymediainfo-6.0.1-py3-none-macosx_10_15_x86_64.whl is not a supported wheel on this platform.

I downloaded DyLib | v23.04 (https://mediaarea.net/download/binary/libmediainfo0/23.04/MediaInfo_DLL_23.04_Mac_x86_64+arm64.tar.bz2) but where should I place it and configure it?

Sorry in both cases I think I'm doing something wrong, can you be more detailed? Thank you

Tohrusky commented 1 year ago

how I try this have this error pip install https://files.pythonhosted.org/packages/a7/73/9f6602d6356bcf4c671f0d10999365cff6ebade197050f910d92f7501838/pymediainfo-6.0.1-py3-none-macosx_10_15_x86_64.whl ERROR: pymediainfo-6.0.1-py3-none-macosx_10_15_x86_64.whl is not a supported wheel on this platform.

I downloaded DyLib | v23.04 (https://mediaarea.net/download/binary/libmediainfo0/23.04/MediaInfo_DLL_23.04_Mac_x86_64+arm64.tar.bz2) but where should I place it and configure it?

Sorry in both cases I think I'm doing something wrong, can you be more detailed? Thank you

not use pip, just download it, rename it to zip, unzip and find the lib.

to the package dir where you install it.

https://stackoverflow.com/questions/31384639/what-is-pythons-site-packages-directory

cerrutopolaris commented 1 year ago

how I try this have this error pip install https://files.pythonhosted.org/packages/a7/73/9f6602d6356bcf4c671f0d10999365cff6ebade197050f910d92f7501838/pymediainfo-6.0.1-py3-none-macosx_10_15_x86_64.whl ERROR: pymediainfo-6.0.1-py3-none-macosx_10_15_x86_64.whl is not a supported wheel on this platform. I downloaded DyLib | v23.04 (https://mediaarea.net/download/binary/libmediainfo0/23.04/MediaInfo_DLL_23.04_Mac_x86_64+arm64.tar.bz2) but where should I place it and configure it? Sorry in both cases I think I'm doing something wrong, can you be more detailed? Thank you

not use pip, just download it, rename it to zip, unzip and find the lib.

to the package dir where you install it.

https://stackoverflow.com/questions/31384639/what-is-pythons-site-packages-directory

thank you, perfect now is all ok!

wuzhen810 commented 1 year ago

Hi, when launch my application with pymedia info I have this error:嗨,当使用 pymedia 信息启动我的应用程序时,我遇到此错误: OSError: Failed to load library from libmediainfo.0.dylib, libmediainfo.dylib - dlopen(libmediainfo.0.dylib, 0x0006): tried: 'libmediainfo.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibmediainfo.0.dylib' (no such file), '/usr/lib/libmediainfo.0.dylib' (no such file, not in dyld cache), 'libmediainfo.0.dylib' (no such file), '/usr/local/lib/libmediainfo.0.dylib' (no such file), '/usr/lib/libmediainfo.0.dylib' (no such file, not in dyld cache), dlopen(libmediainfo.dylib, 0x0006): tried: 'libmediainfo.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibmediainfo.dylib' (no such file), '/usr/lib/libmediainfo.dylib' (no such file, not in dyld cache), 'libmediainfo.dylib' (no such file), '/usr/local/lib/libmediainfo.dylib' (no such file), '/usr/lib/libmediainfo.dylib' (no such file, not in dyld cache)OSError:无法从libmediainfo.0.dylib加载库,libmediainfo.dylib - dlopen(libmediainfo.0.dylib, 0x0006): 尝试: 'libmediainfo.0.dylib' (没有这样的文件), '/System/Volumes/Preboot/Cryptexes/OSlibmediainfo.0.dylib' (没有这样的文件), '/usr/lib/libmediainfo.0.dylib' (没有这样的文件, 不在dyld cache中), 'libmediainfo.0.dylib' (没有这样的文件), '/usr/local/lib/libmediainfo.0.dylib' (没有这样的文件), '/usr/lib/libmediainfo.0.dylib' (没有这样的文件, 不在dyld cache中), dlopen(libmediainfo.dylib, 0x0006): 尝试: 'libmediainfo.dylib' (没有这样的文件), '/System/Volumes/Preboot/Cryptexes/OSlibmediainfo.dylib' (没有这样的文件), '/usr/lib/libmediainfo.dylib' (没有这样的文件, 不在 dyld 缓存中), 'libmediainfo.dylib' (没有这样的文件), '/usr/local/lib/libmediainfo.dylib' (没有这样的文件), '/usr/lib/libmediainfo.dylib' (没有这样的文件,不在 dyld 缓存中) I have a problem with this library on my Mac arm m1/m2 mini.我的 Mac arm m1/m2 mini 上的这个库有问题。 Can I solve and fix this problem?我可以解决并解决此问题吗?

just copy a libmediainfo.dylib from here or the x86 mac pypi wheel to the package root directory. its a universal2 lib.

thank you~

Tohrusky commented 2 weeks ago

fork. https://github.com/TensoRaws/pymediainfo-tensoraws

sbraz commented 2 weeks ago

Please do not close this, we're working on this with @getzze, see #138.