kaifcoder / gemini_multipdf_chat

Gemini PDF Chatbot: A Streamlit-based application powered by the Gemini conversational AI model. Upload multiple PDF files, extract text, and engage in natural language conversations to receive detailed responses based on the document context. Enhance your interaction with PDF documents using this intuitive and intelligent chatbot.
https://gmultichat.streamlit.app/
129 stars 110 forks source link

PermissionError: [Errno 13] Permission denied: 'faiss_index' #5

Closed CevreMuhendisi closed 6 months ago

CevreMuhendisi commented 6 months ago

I used a Docker image, but it's giving an error. I'm getting the following error

image

PermissionError: [Errno 13] Permission denied: 'faiss_index' Traceback: File "/usr/local/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script exec(code, module.dict) File "/app/app.py", line 144, in main() File "/app/app.py", line 103, in main get_vector_store(text_chunks) File "/app/app.py", line 44, in get_vector_store vector_store.save_local("faiss_index") File "/usr/local/lib/python3.10/site-packages/langchain_community/vectorstores/faiss.py", line 1078, in save_local path.mkdir(exist_ok=True, parents=True) File "/usr/local/lib/python3.10/pathlib.py", line 1173, in mkdir self._accessor.mkdir(self, mode)

kaifcoder commented 6 months ago

try to create a folder named faiss_index then re create the container

CevreMuhendisi commented 6 months ago

try to create a folder named faiss_index then re create the container

Runtime error :(

image

RuntimeError: Error in faiss::FileIOWriter::FileIOWriter(const char) at /project/faiss/faiss/impl/io.cpp:97: Error: 'f' failed: could not open faiss_index/index.faiss for writing: Permission denied Traceback: File "/usr/local/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script exec(code, module.dict) File "/app/app.py", line 144, in main() File "/app/app.py", line 103, in main get_vector_store(text_chunks) File "/app/app.py", line 44, in get_vector_store vector_store.save_local("faiss_index") File "/usr/local/lib/python3.10/site-packages/langchain_community/vectorstores/faiss.py", line 1082, in save_local faiss.write_index( File "/usr/local/lib/python3.10/site-packages/faiss/swigfaiss_avx2.py", line 10200, in write_index return _swigfaiss_avx2.write_index(args)

Dribo commented 6 months ago

@CevreMuhendisi

The user "appuser" does not have ownership of the folder "app", where faiss is attempting to store vectors. I fixed this by adding the following to the dockerfile. The line should be added just after creating the user with the "adduser" command.

[...]

# Change the ownership of the /app directory to appuser    
RUN chown appuser:appuser /app                                          

[...]

Simply save the dockerfile, run docker compose again, and it should work as it did for me.

And remember to press "Submit & Process" in the interface ;)

kaifcoder commented 6 months ago

@Dribo create a pull request with changes you suggest

kaifcoder commented 6 months ago

Issue is resolved

CevreMuhendisi commented 6 months ago

Does work, thanks