infiniflow / ragflow

RAGFlow is an open-source RAG (Retrieval-Augmented Generation) engine based on deep document understanding.
https://ragflow.io
Apache License 2.0
21.25k stars 2.08k forks source link

[Question]: In the Windows platform, launching the project through source code will result in an error #1754

Closed Lxx-c closed 2 months ago

Lxx-c commented 3 months ago

Describe your problem

This is one of the errors, and the other error is that it cannot load a certain file, which does not exist in the 'rag/res' directory

[WARNING] [2024-07-31 14:22:56,156] [synonym.__init__] [line:36]: Missing synonym.json
[WARNING] [2024-07-31 14:22:56,156] [synonym.__init__] [line:40]: Realtime synonym is disabled, since no redis connection.
[WARNING] [2024-07-31 14:22:56,156] [synonym.__init__] [line:43]: Fail to load synonym
Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Applications\Projects\ragflow\api\apps\__init__.py", line 96, in <module>
    client_urls_prefix = [
                         ^
  File "C:\Applications\Projects\ragflow\api\apps\__init__.py", line 97, in <listcomp>
    register_page(path)
  File "C:\Applications\Projects\ragflow\api\apps\__init__.py", line 83, in register_page
    spec.loader.exec_module(page)
  File "C:\Applications\Projects\ragflow\api\apps\api_app.py", line 27, in <module>
    from api.db.services.dialog_service import DialogService, chat
  File "C:\Applications\Projects\ragflow\api\db\services\dialog_service.py", line 25, in <module>
    from rag.app.resume import forbidden_select_fields4resume
  File "C:\Applications\Projects\ragflow\rag\app\resume.py", line 23, in <module>
    from deepdoc.parser.resume import step_one, step_two
  File "C:\Applications\Projects\ragflow\deepdoc\parser\resume\step_two.py", line 17, in <module>
    from deepdoc.parser.resume.entities import degrees, schools, corporations
  File "C:\Applications\Projects\ragflow\deepdoc\parser\resume\entities\schools.py", line 20, in <module>
    GOOD_SCH = json.load(open(os.path.join(current_file_path, "res\good_sch.json"), "r"))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Applications\miniconda3\envs\ragflow\Lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
                 ^^^^^^^^^
UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 5: illegal multibyte sequence
KevinHuSh commented 2 months ago

It seems Windows change the file encoding automatically.

yzztin commented 2 months ago

It seems Windows change the file encoding automatically.

@Lxx-c

Set the windows environment variables:

PYTHONUTF8
1

then restart Pycharm