Skip to content

Fail to install nevergrad following demo #189

@kennychen83

Description

@kennychen83

Describe issue

I tried to copy-paste demo locally to my Rstudio. However, I haven't been able to get pass the stage of installing nevergrad. Any help is appreciated.

  1. USE pip
remotes::install_github("facebookexperimental/Robyn/R")
library(Robyn)
library(reticulate)
set.seed(123)

Sys.setenv(R_FUTURE_FORK_ENABLE="true")
options(future.fork.enable = TRUE)

## Option 1: nevergrad installation via PIP
virtualenv_create("r-reticulate")
use_virtualenv("r-reticulate", required = TRUE)
py_install("nevergrad", pip = TRUE)

Using virtual environment '/Users/kennychen/.virtualenvs/r-reticulate' ...
Requirement already satisfied: nevergrad in ./.virtualenvs/r-reticulate/lib/python3.8/site-packages (0.4.3.post8)
Requirement already satisfied: cma>=2.6.0 in ./.virtualenvs/r-reticulate/lib/python3.8/site-packages (from nevergrad) (3.1.0)
Requirement already satisfied: numpy>=1.15.0 in ./.virtualenvs/r-reticulate/lib/python3.8/site-packages (from nevergrad) (1.21.2)
Requirement already satisfied: typing-extensions>=3.6.6 in ./.virtualenvs/r-reticulate/lib/python3.8/site-packages (from nevergrad) (3.10.0.2)
Requirement already satisfied: bayesian-optimization>=1.2.0 in ./.virtualenvs/r-reticulate/lib/python3.8/site-packages (from nevergrad) (1.2.0)
Requirement already satisfied: scikit-learn>=0.18.0 in ./.virtualenvs/r-reticulate/lib/python3.8/site-packages (from bayesian-optimization>=1.2.0->nevergrad) (1.0)
Requirement already satisfied: scipy>=0.14.0 in ./.virtualenvs/r-reticulate/lib/python3.8/site-packages (from bayesian-optimization>=1.2.0->nevergrad) (1.7.1)
Requirement already satisfied: joblib>=0.11 in ./.virtualenvs/r-reticulate/lib/python3.8/site-packages (from scikit-learn>=0.18.0->bayesian-optimization>=1.2.0->nevergrad) (1.1.0)
Requirement already satisfied: threadpoolctl>=2.0.0 in ./.virtualenvs/r-reticulate/lib/python3.8/site-packages (from scikit-learn>=0.18.0->bayesian-optimization>=1.2.0->nevergrad) (3.0.0)

But it fails during Step 3 (run robyn_run):

Using robyn object location: /Users/kennychen/Desktop
Input data has 208 weeks in total: 2015-11-23 to 2019-11-11
Initial model is built on rolling window of 92 weeks: 2016-11-21 to 2018-08-20
Using geometric adstocking with 18 hyperparameters & 10-fold ridge x-validation on 6 cores
>>> Start running 5 trials with 2000 iterations per trial each with TwoPointsDE nevergrad algorithm...
 Running trial nr. 1 

Error in robyn_mmm(hyper_collect = InputCollect$hyperparameters, InputCollect = InputCollect,  : 
  You must have nevergrad python library installed.
  1. USE conda
remotes::install_github("facebookexperimental/Robyn/R")
library(Robyn)
library(reticulate)
set.seed(123)

Sys.setenv(R_FUTURE_FORK_ENABLE="true")
options(future.fork.enable = TRUE)

## Option 2: nevergrad installation via conda
conda_create("r-reticulate") # must run this line once
use_condaenv("r-reticulate")
conda_install("r-reticulate", "nevergrad", pip=TRUE)

and this takes forever with some following messages:

ERROR: Command errored out with exit status 1: /Users/kennychen/Library/r-miniconda/envs/r-reticulate/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/cl/dh6ng9n54497kq338mr97xv40000gp/T/pip-install-2cnal0_e/scipy_89b10482d6b64757a968ef573987162c/setup.py'"'"'; __file__='"'"'/private/var/folders/cl/dh6ng9n54497kq338mr97xv40000gp/T/pip-install-2cnal0_e/scipy_89b10482d6b64757a968ef573987162c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/cl/dh6ng9n54497kq338mr97xv40000gp/T/pip-record-5w5zk2sn/install-record.txt --single-version-externally-managed --prefix /private/var/folders/cl/dh6ng9n54497kq338mr97xv40000gp/T/pip-build-env-i6uajlu6/overlay --compile --install-headers /private/var/folders/cl/dh6ng9n54497kq338mr97xv40000gp/T/pip-build-env-i6uajlu6/overlay/include/python3.10/scipy Check the logs for full command output.
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/e1/4d/15c3542a17eebf61e48bd71dc55b5f3b5031f1cd0dc4aad1ff9ac9651e49/scikit-learn-1.0.tar.gz#sha256=776800194e757cd212b47cd05907e0eb67a554ad333fe76776060dbb729e3427 (from https://pypi.org/simple/scikit-learn/) (requires-python:>=3.7). Command errored out with exit status 1: /Users/kennychen/Library/r-miniconda/envs/r-reticulate/bin/python /private/var/folders/cl/dh6ng9n54497kq338mr97xv40000gp/T/pip-standalone-pip-5z4uruie/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /private/var/folders/cl/dh6ng9n54497kq338mr97xv40000gp/T/pip-build-env-i6uajlu6/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.28.5' 'oldest-supported-numpy; python_version!='"'"'3.7'"'"' or platform_machine=='"'"'aarch64'"'"' or platform_system=='"'"'AIX'"'"' or platform_python_implementation == '"'"'PyPy'"'"'' 'numpy==1.14.6; python_version=='"'"'3.7'"'"' and platform_machine!='"'"'aarch64'"'"' and platform_system!='"'"'AIX'"'"' and platform_python_implementation != '"'"'PyPy'"'"'' 'scipy>=1.1.0' Check the logs for full command output.

 Using cached scikit-learn-0.24.2.tar.gz (7.5 MB)
  Installing build dependencies: started
  Installing build dependencies: still running...
  Installing build dependencies: still running...
  1. USE use_python with pip
## In case nevergrad still can't be imported after installation,
## please locate your python file and run this line with your path:
use_python("~/Library/Frameworks/Python.framework/Versions/3.10/bin/python3")
virtualenv_create("r-reticulate")
use_virtualenv("r-reticulate", required = TRUE)
py_install("nevergrad", pip = TRUE)

still can't run robyn_run:

Using robyn object location: /Users/kennychen/Desktop
Input data has 208 weeks in total: 2015-11-23 to 2019-11-11
Initial model is built on rolling window of 92 weeks: 2016-11-21 to 2018-08-20
Using geometric adstocking with 18 hyperparameters & 10-fold ridge x-validation on 6 cores
>>> Start running 5 trials with 2000 iterations per trial each with TwoPointsDE nevergrad algorithm...
 Running trial nr. 1 

Error in robyn_mmm(hyper_collect = InputCollect$hyperparameters, InputCollect = InputCollect,  : 
  You must have nevergrad python library installed.
  1. USE use_python with conda
    Same message with 2.

  2. Force Python path for reticulate:
    Not working either.

Environment & Robyn version

R version 4.1.1
Please make sure you're using the latest Robyn version -- YES

Metadata

Metadata

Assignees

Labels

dependenciesPull requests that update a dependency file

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions