assafelovic / gpt-researcher

GPT based autonomous agent that does online comprehensive research on any given topic
https://gptr.dev
MIT License
13.05k stars 1.61k forks source link

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

Open sonicviz opened 4 days ago

sonicviz commented 4 days ago

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'

JustUser1410 commented 3 days ago

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

sonicviz commented 3 days ago

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?

JustUser1410 commented 3 days ago

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.

sonicviz commented 3 days ago

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?

assafelovic commented 3 days ago

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?

sonicviz commented 3 days ago

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?

assafelovic commented 3 days ago

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

sonicviz commented 2 days ago

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