Using Meta/Facebook Prophet with Conda/PyCall

Hi,

I run into problems when trying to run the example code from:

What I did:

import Pkg
ENV["PYTHON"]=""
Pkg.build("PyCall")

Restarted the Julia CLI, then:

import Pkg

Pkg.add("Conda")
using Conda
Conda.runconda(`update -y conda`)
Conda.add("pandas")
Conda.add("prophet")

and

julia> using Conda

julia> using PyCall

julia> pd = pyimport("pandas")
PyObject <module 'pandas' from '/home/ftournier/.julia/conda/3/x86_64/lib/python3.12/site-packages/pandas/__init__.py'>

julia> pro = pyimport("prophet")
Importing matplotlib failed. Plotting will not work.
Importing plotly failed. Interactive plots will not work.
PyObject <module 'prophet' from '/home/ftournier/.julia/conda/3/x86_64/lib/python3.12/site-packages/prophet/__init__.py'>

julia> m = pro.Prophet()
PyObject <prophet.forecaster.Prophet object at 0x7fd6beece6f0>

julia> df = pd.read_csv("https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_peyton_manning.csv")
PyObject               ds          y
0     2007-12-10   9.590761
1     2007-12-11   8.519590
2     2007-12-12   8.183677
3     2007-12-13   8.072467
4     2007-12-14   7.893572
...          ...        ...
2900  2016-01-16   7.817223
2901  2016-01-17   9.273878
2902  2016-01-18  10.333775
2903  2016-01-19   9.125871
2904  2016-01-20   8.891374

[2905 rows x 2 columns]

Next step failed:

julia> m.fit(df)
14:55:24 - cmdstanpy - INFO - Chain [1] start processing
14:55:24 - cmdstanpy - INFO - Chain [1] done processing
14:55:24 - cmdstanpy - ERROR - Chain [1] error: error during processing Operation not permitted
Optimization terminated abnormally. Falling back to Newton.
14:55:24 - cmdstanpy - INFO - Chain [1] start processing
14:55:24 - cmdstanpy - INFO - Chain [1] done processing
14:55:24 - cmdstanpy - ERROR - Chain [1] error: error during processing Operation not permitted
ERROR: PyError ($(Expr(:escape, :(ccall(#= /home/jska/.julia/packages/PyCall/1gn3u/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) 
[15267] signal 11 (1): Segmentation fault
in expression starting at none:0
PyErr_CheckSignals at /usr/local/src/conda/python-3.12.11/Modules/signalmodule.c:1771 [inlined]
PyObject_Repr at /usr/local/src/conda/python-3.12.11/Objects/object.c:544
pystring at /home/jska/.julia/packages/PyCall/1gn3u/src/PyCall.jl:243
show at /home/jska/.julia/packages/PyCall/1gn3u/src/exception.jl:39
showerror at ./errorshow.jl:30 [inlined]
#showerror#1026 at ./errorshow.jl:97
showerror at ./errorshow.jl:95
unknown function (ip: 0x7f6b381018a2)
show_exception_stack at ./errorshow.jl:996
display_error at ./client.jl:117
jfptr_display_error_11782.1 at /opt/jska-tmp/julia-1.11.6/share/julia/compiled/v1.11/REPL/u0gqU_QBeOa.so (unknown line)
jl_apply at /cache/build/tester-amdci4-12/julialang/julia-release-1-dot-11/src/julia.h:2157 [inlined]
jl_f__call_latest at /cache/build/tester-amdci4-12/julialang/julia-release-1-dot-11/src/builtins.c:875
#invokelatest#2 at ./essentials.jl:1055 [inlined]
invokelatest at ./essentials.jl:1052 [inlined]
repl_display_error at /cache/build/tester-amdci4-12/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:414
print_response at /cache/build/tester-amdci4-12/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:431
#70 at /cache/build/tester-amdci4-12/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:405
jfptr_YY.70_10215.1 at /opt/jska-tmp/julia-1.11.6/share/julia/compiled/v1.11/REPL/u0gqU_QBeOa.so (unknown line)
with_repl_linfo at /cache/build/tester-amdci4-12/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:678
jfptr_with_repl_linfo_10303.1 at /opt/jska-tmp/julia-1.11.6/share/julia/compiled/v1.11/REPL/u0gqU_QBeOa.so (unknown line)
print_response at /cache/build/tester-amdci4-12/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:403
do_respond at /cache/build/tester-amdci4-12/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:1037
jfptr_do_respond_10366.1 at /opt/jska-tmp/julia-1.11.6/share/julia/compiled/v1.11/REPL/u0gqU_QBeOa.so (unknown line)
jl_apply at /cache/build/tester-amdci4-12/julialang/julia-release-1-dot-11/src/julia.h:2157 [inlined]
jl_f__call_latest at /cache/build/tester-amdci4-12/julialang/julia-release-1-dot-11/src/builtins.c:875
#invokelatest#2 at ./essentials.jl:1055 [inlined]
invokelatest at ./essentials.jl:1052 [inlined]
#126 at /cache/build/tester-amdci4-12/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:1444
jl_apply at /cache/build/tester-amdci4-12/julialang/julia-release-1-dot-11/src/julia.h:2157 [inlined]
jl_f__call_latest at /cache/build/tester-amdci4-12/julialang/julia-release-1-dot-11/src/builtins.c:875
#invokelatest#2 at ./essentials.jl:1055 [inlined]
invokelatest at ./essentials.jl:1052 [inlined]
#30 at /cache/build/tester-amdci4-12/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:1711
jfptr_YY.30_8323.1 at /opt/jska-tmp/julia-1.11.6/share/julia/compiled/v1.11/REPL/u0gqU_QBeOa.so (unknown line)
macro expansion at /cache/build/tester-amdci4-12/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:2861 [inlined]
macro expansion at ./lock.jl:273 [inlined]
#282 at /cache/build/tester-amdci4-12/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:2851
jfptr_YY.282_8870.1 at /opt/jska-tmp/julia-1.11.6/share/julia/compiled/v1.11/REPL/u0gqU_QBeOa.so (unknown line)
jl_apply at /cache/build/tester-amdci4-12/julialang/julia-release-1-dot-11/src/julia.h:2157 [inlined]
start_task at /cache/build/tester-amdci4-12/julialang/julia-release-1-dot-11/src/task.c:1202
Allocations: 1056136 (Pool: 1055206; Big: 930); GC: 2
Segmentation fault

I’m not familiar with using Python under Julia so I may have done something wrong.

Can you try PythonCall.jl instead? It is the more mature way to call Python from Julia, PyCall.jl was an earlier package with less robust design.

In this specific case, I think you might be running into threading issues like thread safety · Issue #882 · JuliaPy/PyCall.jl · GitHub

I managed to install PythonCall, but I still have an error:

julia> using CondaPkg

julia> using PythonCall

julia> CondaPkg.add("Pandas")
    CondaPkg Found dependencies: /home/jska/.julia/environments/v1.11/CondaPkg.toml
    CondaPkg Found dependencies: /home/jska/.julia/packages/PythonCall/avYrV/CondaPkg.toml
    CondaPkg Initialising pixi
             │ /home/jska/.julia/artifacts/cefba4912c2b400756d043a2563ef77a0088866b/bin/pixi
             │ init
             │ --format pixi
             └ /home/jska/.julia/environments/v1.11/.CondaPkg
Created /home/jska/.julia/environments/v1.11/.CondaPkg/pixi.toml
    CondaPkg Wrote /home/jska/.julia/environments/v1.11/.CondaPkg/pixi.toml
             │ [dependencies]
             │ openssl = ">=3, <3.6"
             │ prophet = "*"
             │ libstdcxx-ng = ">=3.4,<14.0"
             │ pandas = "*"
             │ 
             │     [dependencies.python]
             │     channel = "conda-forge"
             │     build = "*cp*"
             │     version = ">=3.8,<4"
             │ 
             │ [project]
             │ name = ".CondaPkg"
             │ platforms = ["linux-64"]
             │ channels = ["conda-forge"]
             │ channel-priority = "strict"
             └ description = "automatically generated by CondaPkg.jl"
    CondaPkg Installing packages
             │ /home/jska/.julia/artifacts/cefba4912c2b400756d043a2563ef77a0088866b/bin/pixi
             │ install
             └ --manifest-path /home/jska/.julia/environments/v1.11/.CondaPkg/pixi.toml
The default environment has been installed.

julia> CondaPkg.add("prophet")

julia> pd = pyimport("pandas")
Python: <module 'pandas' from '/home/jska/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.13/site-packages/pandas/__init__.py'>

julia> pro = pyimport("prophet")
Importing matplotlib failed. Plotting will not work.
Importing plotly failed. Interactive plots will not work.
Python: <module 'prophet' from '/home/jska/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.13/site-packages/prophet/__init__.py'>

julia> df = pd.read_csv("https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_peyton_manning.csv")
Python:
              ds          y
0     2007-12-10   9.590761
1     2007-12-11   8.519590
2     2007-12-12   8.183677
3     2007-12-13   8.072467
4     2007-12-14   7.893572
...          ...        ...
2900  2016-01-16   7.817223
2901  2016-01-17   9.273878
2902  2016-01-18  10.333775
2903  2016-01-19   9.125871
2904  2016-01-20   8.891374

[2905 rows x 2 columns]

julia> m = pro.Prophet()
Python: <prophet.forecaster.Prophet object at 0x7f02760b2a50>

julia> m.fit(df)
17:55:06 - cmdstanpy - INFO - Chain [1] start processing
17:55:06 - cmdstanpy - INFO - Chain [1] done processing
17:55:06 - cmdstanpy - ERROR - Chain [1] error: error during processing Operation not permitted
Optimization terminated abnormally. Falling back to Newton.
17:55:06 - cmdstanpy - INFO - Chain [1] start processing
17:55:06 - cmdstanpy - INFO - Chain [1] done processing
17:55:06 - cmdstanpy - ERROR - Chain [1] error: error during processing Operation not permitted
ERROR: Python: RuntimeError: Error during optimization! Command '/home/jska/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.13/site-packages/prophet/stan_model/prophet_model.bin random seed=15412 data file=/tmp/tmp5863norm/6uej5bsv.json init=/tmp/tmp5863norm/1dp0uqpj.json output file=/tmp/tmp5863norm/prophet_model1pgmslsi/prophet_model-20250901175506.csv method=optimize algorithm=newton iter=10000' failed: console log output:

/home/jska/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.13/site-packages/prophet/stan_model/prophet_model.bin: /home/jska/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.13/site-packages/prophet/stan_model/../../../../libstdc++.so.6: version `CXXABI_1.3.15' not found (required by /home/jska/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.13/site-packages/prophet/stan_model/../../../../libtbb.so.12)

Python stacktrace:
 [1] optimize
   @ cmdstanpy.model ~/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.13/site-packages/cmdstanpy/model.py:659
 [2] fit
   @ prophet.models ~/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.13/site-packages/prophet/models.py:128
 [3] fit
   @ prophet.forecaster ~/.julia/environments/v1.11/.CondaPkg/.pixi/envs/default/lib/python3.13/site-packages/prophet/forecaster.py:1232
Stacktrace:
 [1] pythrow()
   @ PythonCall.Core ~/.julia/packages/PythonCall/avYrV/src/Core/err.jl:89
 [2] errcheck
   @ ~/.julia/packages/PythonCall/avYrV/src/Core/err.jl:10 [inlined]
 [3] pycallargs(f::Py, args::Py)
   @ PythonCall.Core ~/.julia/packages/PythonCall/avYrV/src/Core/builtins.jl:220
 [4] pycall(::Py, ::Py, ::Vararg{Py}; kwargs::@Kwargs{})
   @ PythonCall.Core ~/.julia/packages/PythonCall/avYrV/src/Core/builtins.jl:243
 [5] pycall(::Py, ::Py, ::Vararg{Py})
   @ PythonCall.Core ~/.julia/packages/PythonCall/avYrV/src/Core/builtins.jl:233
 [6] (::Py)(::Py, ::Vararg{Py}; kwargs::@Kwargs{})
   @ PythonCall.Core ~/.julia/packages/PythonCall/avYrV/src/Core/Py.jl:362
 [7] top-level scope
   @ REPL[9]:1

It looks like you are on a slightly outdated version of PythonCall, please update to the latest version (0.9.27) and try again, which should fix that CXX ABI error you’re getting.