Cannot run Prophet from the pyQGIS console

Open
#2,656 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
32/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
pandas, python

Research direction

Reproduce the minimal Prophet and pandas script in the pyQGIS console on Windows 11 with QGIS 3.34.12, then compare it with execution outside QGIS. Start by reading the displayed traceback around the NoneType write failure and Prophet optimization command. Done means the script fits the model successfully in the pyQGIS console or the environment incompatibility is documented.

Written by the indexing model from the issue text.

Description

I am developping a QGIS plugin that uses the Prophet library. While my scripts run outside the QGIS environments, they don't work in the QGIS console.
Here are the steps to reproduce the issue:

Simple script calling Prophet:

from prophet import Prophet
import pandas as pd
df = pd.DataFrame({'ds': ['2024-01-28', '2024-01-29', '2024-01-30'], 'y': [3, 4, 7]})

model = Prophet()
model.fit(df)

Errors:

AttributeError: 'NoneType' object has no attribute 'write'
(...)
RuntimeError: Error during optimization! Command 'C:\Users\[me]\AppData\Roaming\python\Python312\site-packages\prophet\stan_model\prophet_model.bin random seed=40062 data file=C:\Users\[me]\AppData\Local\Temp\tmpvgt3h7aq\9btiqwne.json init=C:\Users\[me]\AppData\Local\Temp\tmpvgt3h7aq\s6atri3h.json output file=C:\Users\[me]\AppData\Local\Temp\tmpvgt3h7aq\prophet_model1w6jn7o2\prophet_model-20250128234237.csv method=optimize algorithm=newton iter=10000' failed:

OS: Windows 11 Pro
QGIS version: 3.34.12

Any help would be appreciated so we can combine the power of these two wonderful open source tools.

Dominant language
Python
Stars
20.5k
Forks
4.6k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from facebook/prophet

All issues in facebook/prophet

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.