conda-forge / weasyprint-feedstock

A conda-smithy repository for weasyprint.
BSD 3-Clause "New" or "Revised" License
2 stars 4 forks source link

Windows missing library 'fontconfig-1' #31

Open dhimmel opened 2 years ago

dhimmel commented 2 years ago

I wasn't clear on the outcome of https://github.com/conda-forge/weasyprint-feedstock/issues/15 (whether windows is supported or not).

We're getting the following error in a windows GitHub actions build (Microsoft Windows Server 2019 10.0.17763):

Traceback (most recent call last):
  File "C:\Miniconda3\envs\manubot\Scripts\weasyprint-script.py", line 5, in <module>
    from weasyprint.__main__ import main
  File "C:\Miniconda3\envs\manubot\lib\site-packages\weasyprint\__init__.py", line 322, in <module>
    from .css import preprocess_stylesheet  # noqa isort:skip
  File "C:\Miniconda3\envs\manubot\lib\site-packages\weasyprint\css\__init__.py", line 27, in <module>
    from . import computed_values, counters, media_queries
  File "C:\Miniconda3\envs\manubot\lib\site-packages\weasyprint\css\computed_values.py", line 16, in <module>
    from ..text.ffi import ffi, pango, units_to_double
  File "C:\Miniconda3\envs\manubot\lib\site-packages\weasyprint\text\ffi.py", line 389, in <module>
    fontconfig = _dlopen(
  File "C:\Miniconda3\envs\manubot\lib\site-packages\weasyprint\text\ffi.py", line 377, in _dlopen
    return ffi.dlopen(names[0])  # pragma: no cover
  File "C:\Miniconda3\envs\manubot\lib\site-packages\cffi\api.py", line 150, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
  File "C:\Miniconda3\envs\manubot\lib\site-packages\cffi\api.py", line 832, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
  File "C:\Miniconda3\envs\manubot\lib\site-packages\cffi\api.py", line 827, in _load_backend_lib
    raise OSError(msg)
OSError: ctypes.util.find_library() did not manage to locate a library called 'fontconfig-1'

In https://github.com/manubot/rootstock/pull/448, we use conda to install weasyprint=53.4 as part of this environment.yml.

Note that weasyprint is being called by Pandoc here, but I don't think that should matter.

Any advice on how to install fontconfig-1 on windows and whether this should be a dependency in weasyprint-feedstock? Let me know if there's a better place to report this.

dhimmel commented 2 years ago

@liZe have you seen this error message before / happen to know a quick fix?

liZe commented 2 years ago

@liZe have you seen this error message before / happen to know a quick fix?

Hello!

I’ve often seen this message, as explained in the documentation. Conda is supposed to avoid this. Is Conda’s fontconfig package installed on your computer?

agitter commented 2 years ago

I'm testing the same environment locally in Windows 10 and get the same error. conda list reports fontconfig version 2.13.1 is installed.

Some fontconfig-related files are in the conda environment directory. I'm not sure what I should be looking for here to know that fontconfig is available. Should there be a .dll?

$ find "C:\Users\agitter\.conda\envs\manubot-tmp" -name *fontconfig*
C:\Users\agitter\.conda\envs\manubot-tmp/conda-meta/fontconfig-2.13.1-h1989441_1005.json
C:\Users\agitter\.conda\envs\manubot-tmp/Library/include/fontconfig
C:\Users\agitter\.conda\envs\manubot-tmp/Library/include/fontconfig/fontconfig.h
C:\Users\agitter\.conda\envs\manubot-tmp/Library/lib/fontconfig.lib
C:\Users\agitter\.conda\envs\manubot-tmp/Library/lib/pkgconfig/fontconfig.pc
C:\Users\agitter\.conda\envs\manubot-tmp/Library/share/fontconfig
C:\Users\agitter\.conda\envs\manubot-tmp/Library/share/gettext/its/fontconfig.its
C:\Users\agitter\.conda\envs\manubot-tmp/Library/share/gettext/its/fontconfig.loc
C:\Users\agitter\.conda\envs\manubot-tmp/Library/share/xml/fontconfig
C:\Users\agitter\.conda\envs\manubot-tmp/Library/var/cache/fontconfig

My PATH visible to Python does have the conda-related directories I would expect.

$ python -c "import os; print(*os.environ['PATH'].split(os.pathsep), sep='\n')" | grep manubot-tmp
C:\Users\agitter\.conda\envs\manubot-tmp
C:\Users\agitter\.conda\envs\manubot-tmp\Library\mingw-w64\bin
C:\Users\agitter\.conda\envs\manubot-tmp\Library\usr\bin
C:\Users\agitter\.conda\envs\manubot-tmp\Library\bin
C:\Users\agitter\.conda\envs\manubot-tmp\Scripts
C:\Users\agitter\.conda\envs\manubot-tmp\bin

Note that weasyprint is being called by Pandoc here, but I don't think that should matter.

Yes, I get the same error if I import weasyprint from the Python interpreter.

liZe commented 2 years ago

Should there be a .dll?

Yes, there should be a DLL. I have no idea why you don’t have one :/. You could try to reinstall the package.

agitter commented 2 years ago

A fresh installation with a minimal conda environment didn't help. There still isn't a DLL. I opened https://github.com/conda-forge/fontconfig-feedstock/issues/49 with details.

raysalem commented 1 year ago

i still see the issue, did : conda install -c conda-forge fontconfig

and now get --> OSError: cannot load library 'pangoft2-1.0-0': error 0x7e. Additionally, ctypes.util.find_library() did not manage to locate a library called 'pangoft2-1.0-0'