6

I tried using the pre-built wheels for Pillow and corresponding libraqm DLL from here:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pillow

But the following returns False:

from PIL import features
features.check('raqm')

Am I missing anything?

Context: I need libraqm with Pillow to work with complex fonts on images, as shown here.

2
  • 4
    Place the 32/64-bit libraqm.dll and fribidi-0.dll next to 32/64-bit python.exe
    – cgohlke
    Commented Jul 16, 2020 at 16:42
  • 1
    Works now, I was placing it in C:\Windows\System32 as we generally do with most DLLs. Thanks a lot, both for the help and your binaries!! :)
    – Gokul NC
    Commented Jul 16, 2020 at 16:47

5 Answers 5

12

For anyone who wants RAQM with PIL on Windows, just do pip install Pillow.

Then place the libraqm DLLs in some directory, and then append that directory to environment/shell variable PATH. That's it.

Or you could place those DLLs along with your python.exe as commented by @cgohlke.

6
  • 3
    I think this should be stated somewhere officially. It's kinda hard to find this answer although the solution was simple
    – GTHell
    Commented Sep 2, 2020 at 17:01
  • It won't be stated officially, because it is not an official build.
    – Gokul NC
    Commented Sep 3, 2020 at 6:04
  • @GokulNC I did as mentioned here. Installed Pillow using pip Took the x64 DLLs from the path and pasted them next to python.exe at C:\Python39\ But I still get "False" when I check for raqm feature. And get no text when using PIL to draw Hindi/Telugu text on images Windows 10, Python 3.9 and Pillow 8.2.0 Can you please help?
    – cvipul
    Commented Apr 30, 2021 at 19:34
  • @cvipul The 8.2.0 and 8.3.0 releases were built without Raqm support, you should upgrade to 8.3.1. See the discussion starting here: github.com/python-pillow/Pillow/issues/…
    – Nulano
    Commented Aug 3, 2021 at 16:00
  • Thanks @Nulano let me upgrade and check. I remember 8.2.0 working on linux with raqm, which the thread also says. So I assumed it would work in windows too.
    – cvipul
    Commented Aug 9, 2021 at 11:29
4

The top-voted answer by @GokulNC is now slightly outdated; Pillow 8.2.0+ no longer uses libraqm.dll, but instead fribidi.dll.

From the installation documentation:

Pillow wheels since version 8.2.0 include a modified version of libraqm that loads libfribidi at runtime if it is installed. On Windows this requires compiling FriBiDi and installing fribidi.dll into a directory listed in the Dynamic-link library search order (Microsoft Learn) (fribidi-0.dll or libfribidi-0.dll are also detected). [...]

So, to use Raqm on Windows with the precompiled wheels (i.e. after running python.exe -m pip install Pillow), you now need to place fribidi.dll in any of the searched directories; I usually use the Python install directory, i.e. where python.exe is located, e.g. C:\Program Files\Python312\.

You can download a precompiled fribidi.dll from the Pillow wheels.yml workflow on GitHub: select a recent passing build and download and extract the correct fribidi-... artifact for your version of Python, x86/x64/ARM64 (you may have to log in to download artifacts).

1

Just some extra information about Gokul NC answer.

I tried adding the folder path where I put the libraries to PYTHONPATH but it did not work for me. What it worked for me was adding the folder path to PATH.

There is an important difference between them. PYTHONPATH will be used for Python to search for modules whereas PATH will be used for Windows to dynamically load dlls.

1

Just to add a further data point:

@GokulNC's answer didn't work on Python 3.10 with Pillow 9.5.0 (most recent at the time of writing).

Using Python 3.7 with Pillow 8.0.0 does work as described, when adding a folder including the x64 versions of the two dlls to the PATH variable.

I'm on Windows 11.

1
  • You now need fribidi.dll instead of libraqm.dll, see my answer below.
    – Nulano
    Commented Dec 20, 2023 at 23:00
0

if you need a working fribidi.dll for Windows 10/Server 2022, I downloaded it from here: https://www.dllme.com/dll/files/fribidi/01d9e9034c25718fa4b03cb5ac415cc7/download

and put it into the python.exe directory (usually, c:/Program Files/Python 3xx)

I tested the DLL with virustotal.com. seems legit compile version of fribidi without trash.

my setup:

  • Windows Server 2022
  • Python 3.10.10
  • Pillow 9.5.0 (pip install pillow==9.5.0)

Works like a charm.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.