Skip to content
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

Backend container error #41

Open
a-mian-lateral opened this issue Jun 13, 2023 · 5 comments
Open

Backend container error #41

a-mian-lateral opened this issue Jun 13, 2023 · 5 comments

Comments

@a-mian-lateral
Copy link

Hi, I'm trying to run the application in a local environment, but when I run the command
docker-compose up --build
docker start to build the container but after a while it fails and returns this error

Traceback (most recent call last): File "/data/main.py", line 3, in <module> from doc_util import Doc File "/data/doc_util.py", line 19, in <module> CJKPDFReader = download_loader("CJKPDFReader") File "/usr/local/lib/python3.9/site-packages/llama_index/readers/download.py", line 125, in download_loader library = json.loads(library_raw_content) File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode raise JSONDecodeError("Extra data", s, end) json.decoder.JSONDecodeError: Extra data: line 1 column 4 (char 3)

Can someone help with this issue? Am I doing something wrong?

@kotnibf
Copy link

kotnibf commented Jun 13, 2023

The error message suggests that the JSON data being loaded is incorrect, containing extra data. You can fix this issue by identifying and correcting the JSON file.

Here's how you can do it:

  1. Identify the JSON file causing the error. In your case, it's likely in the method download_loader("CJKPDFReader") within /usr/local/lib/python3.9/site-packages/llama_index/readers/download.py. Inspect the file to find out which JSON it's trying to load.

  2. Once you have found the JSON file or string, validate its content using a JSON validator (such as JSONLint). If there are errors in the JSON content, correct them until the validator shows no issues.

To demonstrate, let's assume your JSON file contains the following:

{"key": "value"}{"key2": "value2"}

This JSON content is incorrect because it has two separate objects without any delimiter. To correct this, either separate them with a comma and wrap them in an array, like so:

[
  {"key": "value"},
  {"key2": "value2"}
]

Or merge them into a single object, like this:

{
  "key": "value",
  "key2": "value2"
}
  1. After fixing the JSON content, save the changes and re-run the docker-compose up --build command. This should resolve the error.

Hope to solve the problem with this advice. Good luck

@a-mian-lateral
Copy link
Author

a-mian-lateral commented Jun 13, 2023

Looks that the json file is being downloaded from an url
get_file_content(loader_hub_url, "/library.json")
The complete url is https://raw.githubusercontent.com/emptycrown/loader-hub/main/loader_hub/library.json, and returns a 404.

@kotnibf
Copy link

kotnibf commented Jun 13, 2023

I see.
Maybe you need to reset the docker by yourself.

@a-mian-lateral
Copy link
Author

I don't know, I already deleted and recreated the containers (also with different versions of python) multiple times and also tried to run the application with python without docker. I tried also to create the container in different os, Windows, Ubuntu and in WSL. Anyway I don't see a reason why I should edit a library, that url is not generated on my data but is hard coded so I think the problem is the library or the way its used.

@kotnibf
Copy link

kotnibf commented Jun 13, 2023

Then, I don't know too. I am really sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants