WeasyPrint: Cannot access from my virtual environment

I followed the docs for installation to Windows 10, and as long as I’m not in my Django project’s virtual environment, everything works fine. When I activate my virtual environment, I get the


OSError: no library called "cairo" was found
cannot load library 'C:\Users\####\####\Lib\site-packages\GTK3-Runtime Win64\bin\libcairo-2.dll': error 0x7e
cannot load library 'libcairo.so.2': error 0x7e
cannot load library 'libcairo.2.dylib': error 0x7e
cannot load library 'libcairo-2.dll': error 0x7e

When I check the

WHERE zlib1.dll

From the environment, the path is found and correct. And the same is true for WHERE libcairo-2.dll.

Since the path is clearly visible within the environment, I don’t understand why I’m getting the error when I run the test command:

python -m weasyprint http://weasyprint.org weasyprint.pdf

From my environment, but not from the standard command prompt.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (11 by maintainers)

Most upvoted comments

What is the output of

python -c "import os; print(*os.environ['PATH'].split(os.pathsep), sep='\n')"

when you run it in your Django environment?