docker / genai-stack

Langchain + Docker + Neo4j + Ollama
Creative Commons Zero v1.0 Universal
4.02k stars 868 forks source link

pull-model-1 | ERROR invalid setting OLLAMA_MODELS="" error="$HOME is not defined" #170

Closed mingtaoloreal closed 3 weeks ago

mingtaoloreal commented 4 months ago

I am testing the code in Google Workstation (Ubuntu 22.04), but it appears the error below and seem no solutions to detect how to modify it. Would you happen to have any idea? Thank you so much.

pull-model-1  | pulling ollama model llama2 using http://llm:11434
pull-model-1  |  ERROR invalid setting OLLAMA_MODELS="" error="$HOME is not defined"
llm-1         | [GIN]  | 200 |     124.528µs |       | HEAD     "/"
llm-1         | [GIN]  | 200 |   31.835815ms |       | POST     "/api/show"
database-1    | 
database-1    | Folder /data is not accessible for user: 7474 or group 7474. This is commonly a file permissions issue on the mounted folder.
database-1    | 
database-1    | Hints to solve the issue:
database-1    | 1) Make sure the folder exists before mounting it. Docker will create the folder using root permissions before starting the Neo4j container. The root permissions disallow Neo4j from writing to the mounted folder.
database-1    | 2) Pass the folder owner's user ID and group ID to docker run, so that docker runs as that user.
database-1    | If the folder is owned by the current user, this can be done by adding this flag to your docker run command:
database-1    |   --user=$(id -u):$(id -g)
database-1    |        
pull-model-1 exited with code 0
database-1 exited with code 1
Gracefully stopping... (press Ctrl+C again to force)
dependency failed to start: container genai-stack-database-1 exited (1)
Sean-lx commented 4 months ago

I encountered the same issue on macOS, and I figured out a way to solve this successfully, but I did not test it on linux. Maybe you can take this as references and try to fix it by yourself.

  1. Run "docker compose down" in your terminal.
  2. Install ollama and pull the model you want manually.
  3. Search and comment out all things about "pull-model" in docker-compose.yml file.

like this:

# pull-model:
  #   image: genai-stack/pull-model:latest
  #   build:
  #     context: .
  #     dockerfile: pull_model.Dockerfile
  #   environment:
  #     - OLLAMA_BASE_URL=${OLLAMA_BASE_URL-http://host.docker.internal:11434}
  #     - LLM=${LLM-llama2}
  #   networks:
  #     - net
  #   tty: true

and this:

# pull-model:
      #   condition: service_completed_successfully
  1. (Optional) Search "Streamlit UI" in bot.py file, and comment out the markdown style like this:
    
    # Streamlit UI
    # styl = f"""
    # <style>
    #     /* not great support for :has yet (hello FireFox), but using it for now */
    #     .element-container:has([aria-label="Select RAG mode"]) {{
    #         position: fixed;
    #         bottom: 33px;
    #         background: white;
    #         z-index: 101;
    #     }}
    #     .stChatFloatingInputContainer {{
    #         bottom: 20px;
    #     }}

/ Generate ticket text area /

textarea[aria-label="Description"] {{

height: 200px;

}}

"""

st.markdown(styl, unsafe_allow_html=True)

5. If you use neo4j desktop app locally, check your .env file and make sure your  database uri variable is like this:

NEO4J_URI="neo4j://database:7687"


6. Run "docker compose up --build" in your terminal. 
7. Done, have fun!