facebookexperimental / Robyn

Robyn is an experimental, AI/ML-powered and open sourced Marketing Mix Modeling (MMM) package from Meta Marketing Science. Our mission is to democratise modeling knowledge, inspire the industry through innovation, reduce human bias in the modeling process & build a strong open source marketing science community.
https://facebookexperimental.github.io/Robyn/
MIT License
1.08k stars 322 forks source link

Error after robyn_run() "Error in py_get_attr_impl(x, name, silent)" #881

Closed alexlabuda closed 6 months ago

alexlabuda commented 6 months ago

Project Robyn

Issue

Error when running robyn_run() after updating to latest dev version (‘3.10.5.9008’).

Example

OutputModels <- robyn_run(
  InputCollect = InputCollect,
  cores      = NULL,
  iterations = 5000,
  trials     = 5,
  ts_validation      = TRUE,
  add_penalty_factor = FALSE # Experimental feature. Use with caution.
)

print(OutputModels)

Error:

Input data has 619 days in total: 2022-01-01 to 2023-09-11
Initial model is built on rolling window of 619 day: 2022-01-01 to 2023-09-11
Time-series validation with train_size range of 50%-80% of the data...
Using geometric adstocking with 20 hyperparameters (20 to iterate + 0 fixed) on 11 cores
>>> Starting 5 trials with 5000 iterations each using TwoPointsDE nevergrad algorithm...
  Running trial 1 of 5
Error in py_get_attr_impl(x, name, silent) : 
  AttributeError: '_DE' object has no attribute 'set_objective_weights'
Run `reticulate::py_last_error()` for details.

── Python Exception Message ──────────────────────────────────────── AttributeError: '_DE' object has no attribute 'set_objective_weights'

── R Traceback ─────────────────────────────────────────────── ▆

  1. └─Robyn::robyn_run(...)
  2. └─Robyn::robyn_train(...)
  3. └─Robyn::robyn_mmm(...)
  4. ├─optimizer$set_objective_weights
  5. └─reticulate:::$.python.builtin.object(optimizer, "set_objective_weights")
  6. └─reticulate:::py_get_attr_or_item(x, name, TRUE)
  7. └─reticulate::py_get_attr(x, name)
  8. └─reticulate:::py_get_attr_impl(x, name, silent)

Environment & Robyn version

Make sure you're using the latest Robyn version before you post an issue.

alexlabuda commented 6 months ago

FIXED: running "py_install("nevergrad", pip = TRUE)" resolved this issue