Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

presenterm-export dependencies update #345

Open
jacanchaplais opened this issue Aug 18, 2024 · 1 comment
Open

presenterm-export dependencies update #345

jacanchaplais opened this issue Aug 18, 2024 · 1 comment

Comments

@jacanchaplais
Copy link

jacanchaplais commented Aug 18, 2024

Hi there! Very cool work with this tool, I think I'll make a lot of use out of it!

I just wanted to say, for the export functionality, the statement in the docs

The only external dependency you'll need is tmux.

Is not quite right. I installed it fresh on my system using micromamba.

My system specs
❯ fastfetch                                                                                   slides   impure 16:04:15
          ▗▄▄▄       ▗▄▄▄▄    ▄▄▄▖             jacan@nixos
          ▜███▙       ▜███▙  ▟███▛             -----------
           ▜███▙       ▜███▙▟███▛              OS: NixOS 24.11.20240811.a58bc8a (Vicuna) x86_64
            ▜███▙       ▜██████▛               Host: 20EQS3MB07 (ThinkPad P50)
     ▟█████████████████▙ ▜████▛     ▟▙         Kernel: Linux 6.6.44
    ▟███████████████████▙ ▜███▙    ▟██▙        Uptime: 7 hours, 23 mins
           ▄▄▄▄▖           ▜███▙  ▟███▛        Packages: 5661 (nix-system), 5104 (nix-user)
          ▟███▛             ▜██▛ ▟███▛         Shell: zsh 5.9
         ▟███▛               ▜▛ ▟███▛          Display (AUO61ED): 1920x1080 @ 60 Hz in 16″ [Built-in]
▟███████████▛                  ▟██████████▙    DE: none+bspwm
▜██████████▛                  ▟███████████▛    WM: bspwm (X11)
      ▟███▛ ▟▙               ▟███▛             Theme: Breeze [GTK2], Adwaita-dark [GTK3/4]
     ▟███▛ ▟██▙             ▟███▛              Terminal: bwrap
    ▟███▛  ▜███▙           ▝▀▀▀▀               CPU: Intel(R) Core(TM) i7-6820HQ (8) @ 3.60 GHz
    ▜██▛    ▜███▙ ▜██████████████████▛         GPU 1: Intel HD Graphics 530 @ 1.05 GHz [Integrated]
     ▜▛     ▟████▙ ▜████████████████▛          GPU 2: NVIDIA Quadro M1000M [Discrete]
           ▟██████▙       ▜███▙                Memory: 2.82 GiB / 15.45 GiB (18%)
          ▟███▛▜███▙       ▜███▙               Swap: Disabled
         ▟███▛  ▜███▙       ▜███▙              Disk (/): 0 B / 7.73 GiB (0%) - tmpfs
         ▝▀▀▀    ▀▀▀▀▘       ▀▀▀▘              Disk (/mnt/crucial2TB): 814.65 GiB / 1.82 TiB (44%) - btrfs
                                               Disk (/nix): 183.97 GiB / 237.97 GiB (77%) - btrfs [Read-only]
                                               Local IP (wlp4s0): 192.168.0.39/24
                                               Battery: 45% [Discharging]
                                               Locale: en_GB.UTF-8

                                                                       
                                                                       

I found that I needed to additionally install pygobject and pango from conda-forge to get the install working, otherwise the program would try to load libraries which weren't there.

Error logs

Before installing pygobject:

❯ presenterm-export --version                                                                 slides   impure 15:51:47

-----

WeasyPrint could not import some external libraries. Please carefully follow the installation steps before reporting an issue:
https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#installation
https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#troubleshooting 

-----

Traceback (most recent call last):
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/bin/presenterm-export", line 5, in <module>
    from presenterm_export.cli import main
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/lib/python3.12/site-packages/presenterm_export/cli.py", line 14, in <module>
    from presenterm_export.pdf import PdfOptions, generate_pdf
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/lib/python3.12/site-packages/presenterm_export/pdf.py", line 3, in <module>
    import weasyprint
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/lib/python3.12/site-packages/weasyprint/__init__.py", line 419, in <module>
    from .css import preprocess_stylesheet  # noqa: I001, E402
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/lib/python3.12/site-packages/weasyprint/css/__init__.py", line 28, in <module>
    from .computed_values import COMPUTER_FUNCTIONS
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/lib/python3.12/site-packages/weasyprint/css/computed_values.py", line 9, in <module>
    from ..text.ffi import ffi, pango, units_to_double
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/lib/python3.12/site-packages/weasyprint/text/ffi.py", line 431, in <module>
    gobject = _dlopen(
              ^^^^^^^^
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/lib/python3.12/site-packages/weasyprint/text/ffi.py", line 420, in _dlopen
    return ffi.dlopen(names[0])  # pragma: no cover
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/lib/python3.12/site-packages/cffi/api.py", line 150, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/lib/python3.12/site-packages/cffi/api.py", line 832, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/lib/python3.12/site-packages/cffi/api.py", line 827, in _load_backend_lib
    raise OSError(msg)
OSError: cannot load library 'gobject-2.0-0': gobject-2.0-0: cannot open shared object file: No such file or directory.  Additionally, ctypes.util.find_library() did not manage to locate a library called 'gobject-2.0-0'

Before installing pango:

❯ presenterm-export --version                                                                  14s   slides   impure 15:55:19

-----

WeasyPrint could not import some external libraries. Please carefully follow the installation steps before reporting an issue:
https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#installation
https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#troubleshooting 

-----

Traceback (most recent call last):
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/bin/presenterm-export", line 5, in <module>
    from presenterm_export.cli import main
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/lib/python3.12/site-packages/presenterm_export/cli.py", line 14, in <module>
    from presenterm_export.pdf import PdfOptions, generate_pdf
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/lib/python3.12/site-packages/presenterm_export/pdf.py", line 3, in <module>
    import weasyprint
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/lib/python3.12/site-packages/weasyprint/__init__.py", line 419, in <module>
    from .css import preprocess_stylesheet  # noqa: I001, E402
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/lib/python3.12/site-packages/weasyprint/css/__init__.py", line 28, in <module>
    from .computed_values import COMPUTER_FUNCTIONS
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/lib/python3.12/site-packages/weasyprint/css/computed_values.py", line 9, in <module>
    from ..text.ffi import ffi, pango, units_to_double
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/lib/python3.12/site-packages/weasyprint/text/ffi.py", line 434, in <module>
    pango = _dlopen(
            ^^^^^^^^
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/lib/python3.12/site-packages/weasyprint/text/ffi.py", line 420, in _dlopen
    return ffi.dlopen(names[0])  # pragma: no cover
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/lib/python3.12/site-packages/cffi/api.py", line 150, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/lib/python3.12/site-packages/cffi/api.py", line 832, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jacan/Documents/code/python/.micromamba/envs/slides/lib/python3.12/site-packages/cffi/api.py", line 827, in _load_backend_lib
    raise OSError(msg)
OSError: cannot load library 'pango-1.0-0': pango-1.0-0: cannot open shared object file: No such file or directory.  Additionally, ctypes.util.find_library() did not manage to locate a library called 'pango-1.0-0'

It now works, and I have a minimal environment.yml file with contents:

name: slides
channels:
  - conda-forge
dependencies:
  - python=3.12.5
  - pygobject=3.48.2
  - pango=1.54.0
  - pip:
    - presenterm-export==0.2.4

But you may want to consider updating your documentation, or the automatically installed dependencies.

Thanks for your great work on this project!

@mfontanini
Copy link
Owner

Sorry I never replied here! I think this is not presenterm-export's fault but instead weasyprint's. They should be specifying those dependencies, not every consumer of their library. Weirdly, I can install presenterm-export in a clean virtual env and I see none of those 2 dependencies installed and the tool works fine for me 🤷.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants