gpt-researcher icon indicating copy to clipboard operation
gpt-researcher copied to clipboard

Output style issues + did not manage to locate a library called 'gobject-2.0-0'

Open sonicviz opened this issue 1 year ago • 8 comments

I'm running GPT-Researcher locally on Windows 11 with Python 3.12.4 x64, according to the install instructions. I've used it with both OpenAI and Anthropic and the below issues occur with both.

The output text has a lot of styling issues, which must be due to the WaesyPrint issue below I guess, and it seems there are also pdf issues. I did not see any issues when I did pip install, apart from the other bug report about missing exa-py https://github.com/assafelovic/gpt-researcher/issues/634

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


Error in converting Markdown to PDF: cannot load library 'gobject-2.0-0': error 0x7e. Additionally, ctypes.util.find_library() did not manage to locate a library called 'gobject-2.0-0'

sonicviz avatar Jul 01 '24 08:07 sonicviz

If you are using conda environment on Windows, make sure you have GTK3 installed before you install the rest of the requirements:

conda install -c conda-forge gtk3

JustUser1410 avatar Jul 01 '24 23:07 JustUser1410

I'm not using conda, I'm using a straight VSCode git clone with .venv for pip install requirements.txt I'd rather KISS.

Is there any way to get it working properly using this most basic of all setups, which is what the install instructions advise as well? There's nothing about needing GTK in there afaik. Not sure what it has to do with styling of the output in a browser anyway?

sonicviz avatar Jul 02 '24 01:07 sonicviz

It has something top do with the fact that WaesyPrint requires GTK3 and that cannot be installed using pip. If you are not using conda, then simply installing GTK3 before installing requirements should do the trick.

To find out "why" you would have to dig into WeasyPrint source. Here is a good start: https://github.com/Kozea/WeasyPrint/issues/2011#issue-2019640880

Using anaconda is pretty basic: conda create --name myenv python=3.11 conda activate myenv conda install -c conda-forge gtk3

and then just continue from step_1 of the installation instructions.

Once environment is setup, just select that Python interpreter for your project in VSCode.

JustUser1410 avatar Jul 02 '24 01:07 JustUser1410

Okay, thanks for the info.

@assafelovic Any thoughts? Could you adjust the installation documentation to reflect this?

Even better, replace WeasyPrint due to the GTK dependency and hassle installing it on Windows. Is there a simpler yet functional replacement?

sonicviz avatar Jul 02 '24 01:07 sonicviz

Hey @sonicviz I've been looking for a decent Markdown->PDF library without any success. This is why I've decided to include it for users who can get it working instead of removing completely. The service still runs but there's an issue with the PDF right?

assafelovic avatar Jul 02 '24 11:07 assafelovic

Well, there two issues here, perhaps I should have done them separately.

  1. The pdf issue with the error: Error in converting Markdown to PDF: cannot load library 'gobject-2.0-0': error 0x7e. Additionally, ctypes.util.find_library() did not manage to locate a library called 'gobject-2.0-0'
  2. The output text has a lot of styling issues, which must be due to the WaesyPrint issue mentioned above.

I can get by without the pdf as I use the word export, and it's about 95% ok, just some of the bulleted lists seem to have an extra carriage return at the start of the sentence. The bigger issue is the text in the browser window is much worse, nowhere near what it looks like in Docker on on the cloud version. Pretty unreadable, much worse than the word export.

Does that make sense?

sonicviz avatar Jul 02 '24 12:07 sonicviz

can you please attach a screenshot of how it looks like?

assafelovic avatar Jul 02 '24 13:07 assafelovic

Sure. This is messy, not how it looks on the Cloud or Docker. image

sonicviz avatar Jul 03 '24 01:07 sonicviz

Hey all, found a very easy way of resolving this. If you're using Mac do as follows: brew install pango glib If you see a linking issue afterwards simply run: brew link glib

Lmk that this solves it or feel free to reopen this

assafelovic avatar Aug 13 '24 06:08 assafelovic

Actually this was opened as a Windows issue, not a mac issue.

sonicviz avatar Aug 13 '24 08:08 sonicviz

same issue in windows, looking for help

XavierWangHX avatar Jul 08 '25 08:07 XavierWangHX