'Cannot run a r package in python
I want to use the R package 'grpreg'. However, I do not want to run it in R. Instead, I want to run the package under python. I have searched that I need to install the package rpy2, which allows me to run an R package under python. After installing rpy2, I enter
> `from rpy2.robjects.packages import importr`
> `base=importr('grpreg')`
Unfortunately, I obtain the error messages:
R[write to console]: Error: package or namespace load failed for 'grpreg' in inDL(x, as.logical(local), as.logical(now), ...):
unable to load shared object 'C:/Program Files/R/R-4.1.3/library/stats/libs/x64/stats.dll':
LoadLibrary failure: The specified module could not be found.
R[write to console]: Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/Program Files/R/R-4.1.3/library/stats/libs/x64/stats.dll':
LoadLibrary failure: The specified module could not be found.
Traceback (most recent call last):
File "C:\Users\willi\AppData\Local\Temp\ipykernel_27800\977170058.py", line 1, in <module>
base=importr('grpreg')
File "C:\Users\willi\anaconda3\envs\fun_regression_3.7\lib\site-packages\rpy2\robjects\packages.py", line 485, in importr
return package.__rdata__
File "C:\Users\willi\anaconda3\envs\fun_regression_3.7\lib\site-packages\rpy2\rinterface_lib\conversion.py", line 45, in _
File "C:\Users\willi\anaconda3\envs\fun_regression_3.7\lib\site-packages\rpy2\rinterface.py", line 810, in __call__
RRuntimeError: Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/Program Files/R/R-4.1.3/library/stats/libs/x64/stats.dll':
LoadLibrary failure: The specified module could not be found.
I would like to know how to fix the problem.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
