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

RuntimeError: Error during optimization! using Quickstart sample code #2655

Open
joarobles opened this issue Jan 21, 2025 · 1 comment
Open

Comments

@joarobles
Copy link

When I try to execute the Quickstart sample code I get the following error:

Stan Path: /workspaces/prophet/.venv/lib/python3.11/site-packages/prophet/stan_model/cmdstan-2.33.1
15:21:12 - cmdstanpy - INFO - Chain [1] start processing
15:21:12 - cmdstanpy - INFO - Chain [1] done processing
15:21:12 - cmdstanpy - ERROR - Chain [1] error: terminated by signal 11 Unknown error -11
Optimization terminated abnormally. Falling back to Newton.
15:21:12 - cmdstanpy - INFO - Chain [1] start processing
15:21:12 - cmdstanpy - INFO - Chain [1] done processing
15:21:12 - cmdstanpy - ERROR - Chain [1] error: terminated by signal 11 Unknown error -11
Traceback (most recent call last):
  File "/workspaces/prophet/.venv/lib/python3.11/site-packages/prophet/models.py", line 121, in fit
    self.stan_fit = self.model.optimize(**args)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/prophet/.venv/lib/python3.11/site-packages/cmdstanpy/model.py", line 659, in optimize
    raise RuntimeError(msg)
RuntimeError: Error during optimization! Command '/workspaces/prophet/.venv/lib/python3.11/site-packages/prophet/stan_model/prophet_model.bin random seed=70637 data file=/tmp/tmp5e6qrx3k/tsthnvvx.json init=/tmp/tmp5e6qrx3k/p6pq0vgn.json output file=/tmp/tmp5e6qrx3k/prophet_modelfgk7tw4y/prophet_model-20250121152112.csv method=optimize algorithm=lbfgs iter=10000' failed: 

My code is the following:

import pandas as pd
from prophet import Prophet

df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_peyton_manning.csv')
m = Prophet()

m.fit(df)

I'm using the following requirements:

prophet==1.1.6
pandas==2.1.4

And this is the devcontainer Dockerfile:

ARG VARIANT="3.11-bullseye"
FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/python:0-${VARIANT}

RUN apt-get update && apt-get install -y \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

USER vscode

Any ideas?

@joarobles
Copy link
Author

I can confirm this bug appears in prophet==1.1.5 and up.

Downgrading to prophet==1.1.4 seems to solve the issue, steps to reproduce:

Dockerfile

ARG VARIANT="3.11-slim"

FROM python:${VARIANT}

RUN apt-get update && apt-get install -y \
    build-essential \
    libssl-dev \
    pkg-config \
    gcc \
    g++ \
    make \
    cmake \
    && rm -rf /var/lib/apt/lists/*

# Install cmdstanpy version first
RUN pip install --no-cache-dir cmdstanpy==1.2.5

# Install cmdstan before
RUN python -c "import cmdstanpy; cmdstanpy.install_cmdstan()"

WORKDIR /usr/src/app

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD [ "python", "./main.py" ]

requirements.txt

prophet==1.1.4
pandas==2.1.4

main.py (example from Prophet's Quick Start)

# Python
import pandas as pd
import cmdstanpy
from prophet import Prophet

df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_peyton_manning.csv')
m = Prophet()
m.fit(df)

If you change the prophet version in the requirements file to 1.1.5 or 1.1.6 you can reproduce the bug.

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

1 participant