flet icon indicating copy to clipboard operation
flet copied to clipboard

libmpv.so.1 not found (when libmpv is already installed) - fixable but hacky

Open yashasolutions opened this issue 11 months ago • 24 comments

The problem

error while loading shared libraries: libmpv.so.1

$ python counter.py
/home/user/.flet/bin/flet-0.21.1/flet/flet: error while loading shared libraries: libmpv.so.1: cannot open shared object file: No such file or directory
Traceback (most recent call last):
  File "/home/user/code/flet/counter.py", line 29, in <module>
    flet.app(target=main)
  File "/home/user/code/flet/.venv/lib/python3.11/site-packages/flet_runtime/app.py", line 70, in app
    return asyncio.run(
           ^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/user/code/flet/.venv/lib/python3.11/site-packages/flet_runtime/app.py", line 207, in app_async
    await conn.close()
  File "/home/user/code/flet/.venv/lib/python3.11/site-packages/flet_runtime/flet_socket_server.py", line 191, in close
    if self.__receive_loop_task:
       ^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'FletSocketServer' object has no attribute '_FletSocketServer__receive_loop_task'. Did you mean: '_FletSocketServer__receive_loop'?

However, mpv is installed on the system (linux Arch):

$ ls -l /usr/lib/libmpv.so*
libmpv.so        libmpv.so.2      libmpv.so.2.2.0

The hacky fix

so a quick symlink can fix the problem:

 sudo ln -s /usr/lib/libmpv.so /usr/lib/libmpv.so.1

and then it works but I am sure the dependency resolution could figure this out on its own without this kind solution.

(side note: just found about Flet today, it looks amazing, can't wait to give a go with a real project)

yashasolutions avatar Mar 07 '24 12:03 yashasolutions

well, for me I had to link the libraries again and again and still no improved, had to link libmpv, libmujs, lua5.2 and then jepg turbo still no improvement

Lucifer516-hp avatar Mar 08 '24 16:03 Lucifer516-hp

apt install libmpv1 this works for me at least under ubuntu 22.04

I do however get following: ** (flet:29655): CRITICAL **: 03:35:11.411: void update_pressing_state(FlKeyEmbedderResponder *, uint64_t, uint64_t): assertion 'lookup_hash_table(self->pressing_records, physical_key) != 0' failed /usr/local/lib/python3.12/dist-packages/flet_core/page.py:292: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). self.__expires_at = datetime.utcnow() + timedelta(

The counter app however does work as intended

syleishere avatar Mar 09 '24 11:03 syleishere

There is a bigger problem though Screenshot 2024-03-09 042006

Picture on left is running as root, picture on right is running as normal user....

syleishere avatar Mar 09 '24 12:03 syleishere

Hmm this only happening with WSL Ubuntu-22.04, I don't see it happening as normal VM Ubuntu-22.04.

syleishere avatar Mar 09 '24 13:03 syleishere

Can you try it on a arch vm ?

Lucifer516-sudoer avatar Mar 11 '24 14:03 Lucifer516-sudoer

You mean under WSL? Only reason I install Ubuntu 22.04LTS is 90% of developers develop there and all code examples use latest Ubuntu LTS distro, any reason you use arch? I could try it, I think I'd have to be persuaded though, my main go to OS is FreeBSD for anything that needs to run rock solid for a decade, with godly ports collection bigger than any other OS :) For flutter/flet I run flutter/flet under apache in FreeBSD as well.

My main development environment though is Windows 11, Ubuntu WSL. From there I can test windows, Linux, android and android TV with adb, as well as web with FreeBSD and apache.

I mean if you were gonna release an APP, you would want to install it mainly on google play store, apple store. Package it for windows/mac and offer it as a service under apache/nginx right? I may see a point if you are trying to run a GUI for a raspberry pi, other than that I can't see why anyone would run arch over FreeBSD.

Here are some instructions for running latest Ubuntu WSL under windows 11: https://blog.sunsaturn.com/wsl/using-wsl-as-regular-linux-host-on-same-network-with-10-gigabit-and-nfs/

syleishere avatar Mar 14 '24 11:03 syleishere

In Debian 12 - Debian GNU/Linux 12 (bookworm) Being root: apt install libmpv-dev mpv dpkg -L libmpv-dev the output is:

/usr /usr/include /usr/include/mpv /usr/include/mpv/client.h /usr/include/mpv/render.h /usr/include/mpv/render_gl.h /usr/include/mpv/stream_cb.h /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/pkgconfig /usr/lib/x86_64-linux-gnu/pkgconfig/mpv.pc /usr/share /usr/share/doc /usr/share/doc/libmpv-dev /usr/share/doc/libmpv-dev/changelog.Debian.gz /usr/share/doc/libmpv-dev/changelog.gz /usr/share/doc/libmpv-dev/copyright /usr/lib/x86_64-linux-gnu/libmpv.so

Then I've applied the symbol: ln -s /usr/lib/x86_64-linux-gnu/libmpv.so /usr/lib/libmpv.so.1

and it worked for me.

lokcito avatar Apr 10 '24 13:04 lokcito

In the documentation it currently says "libmpv libraries must be installed if your Flet app uses Video control." This deserves more investigation, or the docs should be corrected if libmpv is a requirement for all projects.

loleg avatar Apr 19 '24 21:04 loleg

to add to @loleg, it would also be good to know which version is required, because I had libmpv, just libmpv.so.2 didn't cut it and it required libmpv.so.1

yashasolutions avatar Apr 19 '24 21:04 yashasolutions