-
-
Notifications
You must be signed in to change notification settings - Fork 712
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
Weasyprint not working on Windows 7 x64 / Python 3.6.2 x64 / GTK3 runtime x64 #589
Comments
I found something called "GTK#" in my installed application list and decided to uninstall it. After this, I've repeated all the steps and now weasyprint works. Perhaps the info could be added as a note to the installation instructions here: Btw it's hard to miss the strange tone directed exclusively to Windows users ("Dear Windows user", "Don’t cheat", "kittens will die because of you", etc.). |
I am.
Btw it's hard to miss the strange tone from Windows users too! A lot of users reported problems like this one (see #590 just after you, or #573 for example), that's why I'm angry. Not against users, against the OS.
WeasyPrint relies on CairoCFFI, that uses
I'd really and sincerely appreciate a PR with kind installation instructions and some useful hints. |
Yes I got the point already, a few windows users accidentally mixed up components designed to work on different architectures. Feel free to blame the OS as well but weasyprint is one of the few exceptions in Windows where a tool is harder to install than in linux, perhaps because of some deliberate development design choices (no interest in providing a pre-built binary) or lack of better deployment options provided by python (not sure about this). As for the hint, you could simply add a note that says:
|
I don't like to be blamed for the work I don't do when I spend so much time providing an open source tool for free. When there's something wrong on Wikipedia, you have two options:
It's the same choice with WeasyPrint. You can blame me for my poor work and my "deliberate development design choices", or you can become a contributor. As I said earlier, I'd really appreciate a pull request with better documentation. |
First of all thanks for the good work you have put into this project. As for the documentation PR request, like stated in my 2nd post above, the documentation works as is and the issue was caused by another version of GTK installed by some other software. Of course I am not going to redact your jokes, that would be weird. Not sure if relevant but, for your information, I also put my free time in free software work (released under MIT license elsewhere / not on github). |
Indeed, I was contemplating on a PR explaining to Windows users how to install a working environment. On Linux and OS X that's almost part of the system. The average user never tinkers with that. The really hard part is the GTK runtime. Your advice not to cheat because You're on your own! recalled the lessons learned from my various attempts to install GTK -- MinGW? MinGW-w64? MSYS? MSYS2? Pacman? Anybody please tell me: Which package? library? do I need? There should be a manpage! What? Requires groff and Perl and and and.... Yes, you're on your own and kittens will die. I really enjoyed that sentence. Please, please never remove it! Ok, WeasyPrint requires an appropriate GTK Runtime. In principle, it's easy:
That should be enough for users used to work in the command prompt. Such users, I suppose, know how to persist that path in their Not-so-advanced (!?) users know nothing about PATHs and expect that checking "Set up PATH environment variable to include GTK+" does the trick. And indeed, it does. In principle. @mchlsndrn -- I don't know much about other GTK frameworks and whether they all manifest themselves in the "System Settings". But I know that it's not about finding a "GTK framework" but about finding DLLs. If WeasyPrint requires, for example, If WeasyPrint was a standalone application it could provide and force Windows to use its own local GTK-For-WeasyPrint-On-Win32-Win64 [just kidding]. |
@Tontyna: I dont know much about GTK in general mainly because GTK-based UIs are not really that popular in windows, in part because they tend to give a low-quality feel compared to other alternatives available on Windows. As for DLL Hell, there are some solutions: https://en.wikipedia.org/wiki/DLL_Hell#Solutions Anyway I tried weasyprint because I am looking for a simple command line tool to convert an html5 page to a PDF. After seeing that media queries are not supported and I could not convert a page layout based on bootstrap 4, I switched to another tool which so far seems be able to handle the task. Still good luck with the project as it looks very promising. |
I posted this issue #590. The error in my case was that zlib1.dll was present in a different folder.
So it turns out that the
In my PATH variable i put GTK/bin before Intel/wifi/bin
Now weasyprint executes as expected. |
Yepp, DLL hell at its best. BTW: Most of the libraries/DLLs required by WeasyPrint aren't loaded by WeasyPrint itself. |
I've updated the documentation with a small paragraph about this error and a link to this issue. Pull requests are welcome for documentation too 😉. |
More on dll hell.
This Error not necessarily states that there is no cairo.dll in your PATH. It is also raised when the cairo library can't load other libraries it depends on -- e.g libfontconfig -- dunno how and where cairo.dll itself looks for its dependencies, definitely not via pythonic OMG! Contemplating this I can imagine more and more really bad constellations ... at least on Windows. @micsan13br: WeasyPrint can't escape from Windows DLL hell, as long as the required Cairo/Pango libraries are loaded by cairocffi, which only scans the PATH, no way to dictate a full-path-to-cairo.dll |
@Tontyna: Speaking of windows and DLL hell, I've installed THOUSANDS of softwares (from large IDEs to tiny utilities like weasyprint), giant suites of visual effects softwares, etc. If you cannot statically link against whatever library you need, This attitude reminds me of software wars from a decade ago and so does the fact that you blame the OS or the user for failing to install something. |
@Tontyna and if Cairocffi (whatever that is) only scans the path (which, I guess, implies also that it can't find a DLL sitting in the same folder), then according to you the problem is obviously DLL hell and not that Cairocffi is limited / could use some improvements? |
Cairocffi is a Python package that's imported and used by the WeasyPrint package -- like cffi, cssselect2, html5lib, pdfrw, tinycss2 etc. As @mchlsndrn said, avoiding DLL hell, its quite easy. Supposed you are the one who controls the code that loads the libraries. I didn't blame Windows or the average user for anything. If I cursed anybody in the last days (and I'm cursing a lot when programming), it was Python. I was tempted to curse the Linux-centric maintainer of cairocffi, which happens to be @liZe 😄 , until I changed my mind and instead, in the near future, when time allows, I'll create a PR, or at least comment on Kozea/cairocffi#103 |
After a lot of tries following http://weasyprint.org steps, I found that weasyprint is working in windows using command line without issues but it is not working using Git Bash which I was working with!!! |
The order of the items in PATH variable is important. I had to put C:\Program Files\GTK3-Runtime Win64\bin at the top. |
I also encountered this problem, and finally I was able to use cairosvg on the command line, and I can't always use it in the IDE, which is really a strange library.
|
OS: Windows 10 Enterprise x64 20H2 EDIT: This is a Python issue. Apparently Python 3.8+ changed the way it looks for modules. https://bugs.python.org/issue43173 |
Ok I figure this out. you can have a 64 bit version of python that doesn't work. What I have found to work and this could change is the installing the 64 bit version of python from python's website, not from the Microsoft store!
|
1 similar comment
Ok I figure this out. you can have a 64 bit version of python that doesn't work. What I have found to work and this could change is the installing the 64 bit version of python from python's website, not from the Microsoft store!
|
Hello,
I tried to follow the installation instructions as carefully as possible (and repeated the process twice with python 3.6.4 and 3.6.2 without getting installation errors). I am running windows 64 bit, using python 64 bit and GTK 3 64 bit (gtk3-runtime-3.22.26-2017-11-15-ts-win64.exe).
Visual C++ Build Tools were already installed on the system previously as well as Visual Studio 2017.
I did run the line "pip install --upgrade setuptools" as instructed in Python's wiki.
WeasyPrint just prints multiple error messages when testing using the command:
python -m weasyprint http://weasyprint.org weasyprint.pdf
Traceback (most recent call last):
File "C:\Users\sad1lo\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, Error)
File "C:\Users\sad1lo\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 142, in get_module_details
return get_module_details(pkg_main_name, error)
File "C:\Users\sad1lo\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 109, in get_module_details
import(pkg_name)
File "C:\Users\sad1lo\AppData\Local\Programs\Python\Python36\lib\site-packages\weasyprint_init.py", line 375, in
from .css import preprocess_stylesheet # noqa
File "C:\Users\sad1lo\AppData\Local\Programs\Python\Python36\lib\site-packages\weasyprint\css_init.py", line 29, in
from . import computed_values
File "C:\Users\sad1lo\AppData\Local\Programs\Python\Python36\lib\site-packages\weasyprint\css\computed_values.py", line 16, in
from .. import text
File "C:\Users\sad1lo\AppData\Local\Programs\Python\Python36\lib\site-packages\weasyprint\text.py", line 18, in
import cairocffi as cairo
File "C:\Users\sad1lo\AppData\Local\Programs\Python\Python36\lib\site-packages\cairocffi_init.py", line 41, in
cairo = dlopen(ffi, 'cairo', 'cairo-2')
File "C:\Users\sad1lo\AppData\Local\Programs\Python\Python36\lib\site-packages\cairocffi_init.py", line 38, in dlopen
raise OSError("dlopen() failed to load a library: %s" % ' / '.join(names)) OSError: dlopen() failed to load a library: cairo / cairo-2
The text was updated successfully, but these errors were encountered: