Sinaptik-AI / pandas-ai

Chat with your database (SQL, CSV, pandas, polars, mongodb, noSQL, etc). PandasAI makes data analysis conversational using LLMs (GPT 3.5 / 4, Anthropic, VertexAI) and RAG.
https://pandas-ai.com
Other
12.41k stars 1.18k forks source link

Error while building docker compose #1277

Open jithin77 opened 1 month ago

jithin77 commented 1 month ago

System Info

pandas AI v2.2.10, Windows 10, Python Python 3.11.9

🐛 Describe the bug

I am trying to build the docker compose which is failing with error "poetry not found". The server docker file have "ENV PATH="/root/.local/bin:$PATH" but not sure why poetry is not recognized.

image

dosubot[bot] commented 1 month ago

Hey @jithin77! 👋 I'm here to help you with any bugs, questions, or contributions you have. Let's squash those bugs together!

To resolve the "poetry not found" error during the Docker build process, ensure that poetry is correctly installed and added to the PATH. The Dockerfile should include the following steps:

# Install Poetry
RUN curl -sSL https://install.python-poetry.org | python3 -

# Add Poetry to PATH
ENV PATH="/root/.local/bin:$PATH"

Make sure these lines are placed before any poetry commands are run. If the issue persists, try rebuilding the Docker image without cache:

docker build --no-cache -t your_image_name .

Additionally, you can use a script to ensure poetry is properly activated during the build process. Here is an example script:

#!/bin/bash

# Load environment variables from .env file if it exists
if [ -f .env ]; then
    echo "Loading environment variables from .env file"
    export $(cat .env | sed 's/#.*//g' | xargs)
else
    echo ".env file not found, skipping"
fi

# Activate Poetry environment
source $(poetry env info --path)/bin/activate

# Lock dependencies without updating
poetry lock --no-update

# Install dependencies
make install

# Wait for any dependent services
/bin/sh wait-for-it.sh

# Run database migrations
make migrate

# Start the server in the background
make start

This script ensures that poetry is activated and its environment is used for subsequent commands [1][2].

To continue talking to Dosu, mention @dosu.

jasonchanhku commented 1 month ago

having similar issue as well with docker compose build