axcore / tartube

A GUI front-end for youtube-dl, partly based on youtube-dl-gui and written in Python 3 / Gtk 3
GNU Lesser General Public License v2.1
1.92k stars 105 forks source link

Doesn't start - Unable to locate package cairo #592

Closed cipricus closed 8 months ago

cipricus commented 8 months ago

Just installed python3-tartube_2.4.412.deb in Kubuntu23.10, the launcher doesn't work. In terminal:

~$ tartube
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 176, in require_foreign
    _gi.require_foreign(namespace, symbol)
ModuleNotFoundError: No module named 'gi._gi_cairo'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/matplotlib/backends/_backend_gtk.py", line 22, in <module>
    gi.require_foreign("cairo")
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 178, in require_foreign
    raise ImportError(str(e))
ImportError: No module named 'gi._gi_cairo'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/bin/tartube", line 42, in <module>
    import mainapp
  File "/usr/lib/python3/dist-packages/tartube/mainapp.py", line 96, in <module>
    import config
  File "/usr/lib/python3/dist-packages/tartube/config.py", line 56, in <module>
    from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg
  File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_gtk3agg.py", line 4, in <module>
    from . import backend_agg, backend_gtk3
  File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_gtk3.py", line 29, in <module>
    from . import _backend_gtk
  File "/usr/lib/python3/dist-packages/matplotlib/backends/_backend_gtk.py", line 24, in <module>
    raise ImportError("Gtk-based backends require cairo") from e
ImportError: Gtk-based backends require cairo
cip@cip-MacBookAir:~$ sudo apt install cairo
[sudo] password for cip: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package cairo
axcore commented 8 months ago

It might be a day or two before I have the opportunity to test Kubuntu specifically, in the meantime you can try this:

  1. Other methods of installation are available, if the .deb package isn't working. And installation is not actually necessary, you should be able to run the source code directly. (See https://github.com/axcore/tartube for a full description of these methods).

  2. The dependency you're missing might be pycairo, so try this:

pip3 install pycairo

cipricus commented 8 months ago

pip3 install pycairo

Thank you for the quick reply. I have big problems installing pip in k/ubuntu, as well as pipx, even in virtual environment (venv), and the "portable" use from source also complains about absence of cairo. I'll see what happens, not something you have to care about. Maybe even close this.

I was just curious about this tool, otherwise I use yt-dlp in terminal through "launchers" (for different commands) listed when I copy a link in Plasma.

image

cipricus commented 8 months ago

I will close it myself, not really a bug.

axcore commented 8 months ago

Kubuntu won't install itself in Virtualbox, don't know what the problem is, but it prevents me from doing any testing.

Cairo documentation says that the correct install method is

sudo apt-get install libcairo2-dev

...but that's for vanilla Ubuntu, it doesn't mention anything about KDE derivatives.

cipricus commented 8 months ago

sudo apt-get install libcairo2-dev

just for reference: the command works in Kubuntu, and it also installs libbrotli-dev libbz2-dev libfontconfig-dev libfreetype-dev libice-dev libpixman-1-dev libpng-dev libpng-tools libsm-dev libxcb-render0-dev libxcb-shm0-dev libxrender-dev but that changes nothing, not even after restart. - I don't see why Kubuntu as such would be the problem, I think it's Ubuntu problem.

It all started with this:

~$ pip install pycairo
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.

    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.

    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.

    See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

But that doesn't seem to have fixed it. Something was installed: sudo apt install python3-cairo says it is already installed - so that I see this:

~$ dpkg --list '*cairo*'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                               Version      Architecture Description
+++-==================================-============-============-======================================================
un  cairo-5c                           <none>       <none>       (no description available)
un  gir1.2-cairo-1.0                   <none>       <none>       (no description available)
un  gir1.2-pangocairo-1.0              <none>       <none>       (no description available)
un  libcairo-dev                       <none>       <none>       (no description available)
ii  libcairo-gobject2:amd64            1.18.0-1     amd64        Cairo 2D vector graphics library (GObject library)
ii  libcairo-gobject2:i386             1.18.0-1     i386         Cairo 2D vector graphics library (GObject library)
ii  libcairo-script-interpreter2:amd64 1.18.0-1     amd64        Cairo 2D vector graphics library (script interpreter)
ii  libcairo2:amd64                    1.18.0-1     amd64        Cairo 2D vector graphics library
ii  libcairo2:i386                     1.18.0-1     i386         Cairo 2D vector graphics library
ii  libcairo2-dev:amd64                1.18.0-1     amd64        Development files for the Cairo 2D graphics library
un  libcairo2-doc                      <none>       <none>       (no description available)
un  libcairomm-1.0-1                   <none>       <none>       (no description available)
ii  libcairomm-1.0-1v5:amd64           1.14.4-2     amd64        C++ wrappers for Cairo (shared libraries)
ii  libdecor-0-plugin-1-cairo:amd64    0.1.1-2      amd64        default decoration plugin
ii  libdecor-0-plugin-1-cairo:i386     0.1.1-2      i386         default decoration plugin
un  libdecor-plugin-cairo              <none>       <none>       (no description available)
ii  libpangocairo-1.0-0:amd64          1.51.0+ds-2  amd64        Layout and rendering of internationalized text
ii  libpangocairo-1.0-0:i386           1.51.0+ds-2  i386         Layout and rendering of internationalized text
ii  python3-cairo:amd64                1.24.0-3     amd64        Python3 bindings for the Cairo vector graphics library
un  python3-cairocffi                  <none>       <none>       (no description available)
un  python3-gi-cairo                   <none>       <none>       (no description available)
ii  python3-rlpycairo                  0.3.0-2      all          plugin for the ReportLab PDF Toolkit.
axcore commented 8 months ago

Noted. If it were an Ubuntu-wide problem, then it should be affecting me too, since Tartube is developed on Linux Mint.

I haven't spent much time playing with python virtual environments, so I have no more suggestions. I would use pip3 install rather than pip install, but I can no longer remember whether it's just a habit or something I started doing for a reason.

If you find a solution to get cairo correctly installed, do let me know, so I can think about whether the .deb package needs to be modified.