jaseg / python-mpv

Python interface to the awesome mpv media player
https://git.jaseg.de/python-mpv.git
Other
531 stars 67 forks source link

"Cannot find libmpv in the usual places" on Arch Linux, Hypnotix #270

Closed ivan-hc closed 5 months ago

ivan-hc commented 5 months ago

Hi, I'm developing an AppImage of Hypnotix using an ArchLinux container named Junest, so all I must do is to install applications the same way we do on Arch Linux.

I'm creating the AppImage from AUR and I've tested all three versions listed here without success.

I've also tried to install mpv using one of these packages:

mpv / mpv-git / mpv-git-full / mpv-full / mpv-build-git / mpv-full-build-git

in all cases I get the same error:

 File "/usr/lib/hypnotix/hypnotix.py", line 27, in <module>
    import mpv
  File "/usr/lib/hypnotix/mpv.py", line 49, in <module>
    raise OSError("Cannot find libmpv in the usual places. Depending on your distro, you may try installing an "
OSError: Cannot find libmpv in the usual places. Depending on your distro, you may try installing an mpv-devel or mpv-libs package. If you have libmpv around but this script can't find it, consult the documentation for ctypes.util.find_library which this script uses to look up the library filename.

How can I solve this issue?

To see how my script works see the workflow run at https://github.com/ivan-hc/Hypnotix-appimage/actions

https://github.com/ivan-hc/Hypnotix-appimage/issues/1

jaseg commented 5 months ago

This error message means that when mpv.py calls find_library from Python's ctypes standard library module, that function does not find libmpv.so. On arch, libmpv.so is definitely included in the mpv package, so I can imagine two likely reasons for this error. One is that somehow, libmpv.so never makes it into the container image. The other is that for whatever reason the python that runs hypnotix.py gets called with a weird LD_LIBRARY_PATH environment variable or an otherwise broken system config.

I know debugging appimages is annoying, but my suggestion would be:

  1. Try getting a shell inside the built and running Appimage.
  2. Get a dump of all environment variables with env and post the output here.
  3. Look around if you find libmpv.so somewhere in /lib or /usr/lib, and update us here.
  4. Try running this code in a python shell and post here what happens: import ctypes, ctypes.util; print(repr(ctypes.util.find_library('mpv')), repr(ctypes.CDLL(ctypes.util.find_library('mpv'))))
ivan-hc commented 5 months ago

libmpv.so never makes it into the container image

No it is in place.

However, I've discovered that I miss some binaries in the bundled /usr/bin directory (something related to ld), now the error related to mpv.py is disappeared... ant the AppImage works quite well (just some crashes, due to the unrecognized VDPAU backend from the host to the container... I have an Nvidia on the host).

I can close this issue (and open others), thank you very much!