jaseg / python-mpv

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

python-mpv not finding libmpv DLL on MSYS2 #263

Closed gpraceman closed 1 year ago

gpraceman commented 1 year ago

I am running Python 3.10 on Windows 10 via MSYS2, with GTK3 for the UI. I have python-mpy 1.0.3 installed. I also installed the mingw-w64-x86_64-mpv package to MSYS2. That installs libmpv-2.dll, mpv, mpv.com, and mpv.exe files to the mingw64\bin folder. When I try to import mpv with my Python code, I get the "Cannot find mpv-1.dll or mpv-2.dll in your system %PATH%" error, so something is wrong with my setup. Any guidance would be appreciated.

jaseg commented 1 year ago

I mean, did you check what %PATH% gets passed to python? Is mingw64\bin in there?

gpraceman commented 1 year ago

Yes, I have C:\msys64\mingw64\bin at the top of my path variables, which is the location for my MSYS2 environment. There is no mpv-1.dll or mpv-2.dll in that folder, only libmpv-2.dll.

Maybe it is just as simple as renaming libmpv-2.dll to mpv-2.dll. I did try that and was able to run an AVI file but I tried several of the examples at https://pypi.org/project/python-mpv/. Some did nothing, some errored out. So, not sure that the renaming of the DLL file is the correct solution or not.

jaseg commented 1 year ago

Did you install the python you ran this with through msys2 too? If not, that would be likely to cause issues.

jaseg commented 1 year ago

I think the different file name might be due to MSYS2 here bringing over a naming convention from UNIX land to Windows. If your python installation is outside of MSYS2, you could also just try using mpv's normal windows builds from https://sourceforge.net/projects/mpv-player-windows/files/libmpv/

gpraceman commented 1 year ago

The only way I could get GTK3, which is the UI framework that I use for all of my projects, to run on Windows is via MSYS2. That is also where I setup Python.

If mpv-2.dll and libmpv-2.dll are the same, then a renaming of the file to get rid of the error would be the trick. I would just have to remember that whenever I do an update.

gpraceman commented 1 year ago

The files that you pointed me to has the DLL being named libmpv-2.dll

jaseg commented 1 year ago

I'm putting out a release adding the filename libmpv-2.dll to the search list. I think it once was named mpv-2.dll and they just renamed it.