microsoft / lida

Automatic Generation of Visualizations and Infographics using Large Language Models
https://microsoft.github.io/lida/
MIT License
2.57k stars 260 forks source link

Errors @ docker compose up: #124

Open sid-newby opened 2 weeks ago

sid-newby commented 2 weeks ago

Hey folks, trying to get a docker together for the demo app, hopefully I can get the page source to add gpt-4o as an option. When I try to compose up, I get

lida2 % docker compose up
WARN[0000] /Users/sidnewby/Prog/lida2/docker-compose.yml: `version` is obsolete
[+] Running 1/1
 => ERROR [web 3/3] RUN pip install --no-cache-dir lida                                                               

It looks like we might just have some legacy dependencies? If there are known versions of these that I should use instead, I can?

 21.24   Getting requirements to build wheel: started
21.51   Getting requirements to build wheel: finished with status 'error'
21.52   error: subprocess-exited-with-error
21.52
21.52   × Getting requirements to build wheel did not run successfully.
21.52   │ exit code: 1
21.52   ╰─> [3 lines of output]
21.52       <string>:86: DeprecationWarning: The 'warn' function is deprecated, use 'warning' instead
21.52       WARNING:root:Failed to get options via gdal-config: [Errno 2] No such file or directory: 'gdal-config'
21.52       CRITICAL:root:A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
21.52       [end of output]
21.52
21.52   note: This error originates from a subprocess, and is likely not a problem with pip.
21.52 error: subprocess-exited-with-error
21.52
21.52 × Getting requirements to build wheel did not run successfully.
21.52 │ exit code: 1
21.52 ╰─> See above for output.
21.52
21.52 note: This error originates from a subprocess, and is likely not a problem with pip.
------
failed to solve: process "/bin/sh -c pip install --no-cache-dir lida" did not complete successfully: exit code: 1
sid-newby commented 2 weeks ago

I think I solved it. Just in case anyone needs this later:

Updated dockerfile:

# Use the official Miniconda image as the base image
FROM continuumio/miniconda3

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONBUFFERED 1

# Create and set the working directory
WORKDIR /app

# Install mamba for faster package management and create a new environment
RUN conda install -y mamba -n base -c conda-forge \
    && mamba create -n myenv python=3.10 -y \
    && conda run -n myenv mamba install -c conda-forge gdal libgdal gcc fiona wordcloud \
    && conda clean -afy

# Activate the environment
SHELL ["conda", "run", "-n", "myenv", "/bin/bash", "-c"]

# Copy the requirements file into the container
COPY requirements.txt .

# Install pip in the conda environment
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of your application code into the container
COPY . .

# Expose the port that the application will listen on
EXPOSE 8080

# Start the Web UI
CMD ["conda", "run", "-n", "myenv", "lida", "ui", "--host", "0.0.0.0", "--port", "8080", "--docs"]

Updated docker-compose.yaml (version: is depreciated)

services:
  web:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "8080:8080"
    environment:
      - OPENAI_API_KEY=${OPENAI_API_KEY}

The repo's requirements.txt file is currently blank. This is what I negotiated and worked..

lida
numpy
statsmodels
pydantic
python-multipart
altair
geopandas
scipy
typer
plotnine
matplotlib-venn
matplotlib
seaborn
networkx
fastapi
uvicorn
kaleido
plotly
pandas
llmx>=0.0.21a
diskcache
google.auth
cohere
tiktoken
pyyaml
openai
typing-extensions>=4.0.1
jsonschema>=3.0
jinja2
toolz
packaging
tzdata>=2022.7
python-dateutil>=2.8.2
pytz>=2020.1
email_validator>=2.0.0
httpx>=0.23.0
starlette<0.38.0,>=0.37.2
orjson>=3.2.1
fastapi-cli>=0.0.2
ujson!=4.0.2,!=4.1.0,!=4.2.0,!=5.0.0,!=5.1.0,>=4.0.1
pydantic-core==2.18.4
annotated-types>=0.4.0
fiona>=1.8.21

then:

docker-compose build
docker-compose up

closing.