I am trying to run GLM function of rstanarm library. I am using rpy2 library to connect python with R packages. Following is the code:
glm_post = rstanarm.stan_glm(formula, data=r_dataframe, prior=my_prior,iter=niter, chains=nchains, cores=cores)
But I am getting this error in GCP AI Notebook:
/opt/conda/lib/python3.7/site-packages/rpy2/robjects/functions.py in __call__(self, *args, **kwargs)
197 kwargs[r_k] = v
198 return (super(SignatureTranslatedFunction, self)
--> 199 .__call__(*args, **kwargs))
200
201
/opt/conda/lib/python3.7/site-packages/rpy2/robjects/functions.py in __call__(self, *args, **kwargs)
123 else:
124 new_kwargs[k] = conversion.py2rpy(v)
--> 125 res = super(Function, self).__call__(*new_args, **new_kwargs)
126 res = conversion.rpy2py(res)
127 return res
/opt/conda/lib/python3.7/site-packages/rpy2/rinterface_lib/conversion.py in _(*args, **kwargs)
43 def _cdata_res_to_rinterface(function):
44 def _(*args, **kwargs):
---> 45 cdata = function(*args, **kwargs)
46 # TODO: test cdata is of the expected CType
47 return _cdata_to_rinterface(cdata)
/opt/conda/lib/python3.7/site-packages/rpy2/rinterface.py in __call__(self, *args, **kwargs)
675 )
676 if error_occured[0]:
--> 677 raise embedded.RRuntimeError(_rinterface._geterrmessage())
678 return res
679
RRuntimeError: Error in utils::browseURL(paste0("file://", sinkfile_html)) :
'browser' must be a non-empty character string
By adding this line in the env.sh file I was able to bypass the browseURL error.
export R_BROWSER="false"