I am trying to install an environment.yml
file that I have previously exported from a conda environment. The yml file specifies a dependency to rpy2=2.8.6
and r-base=3.5.1
.
The installation and creation of a new environment from the yml file are OK but I get the following error when I try to import rpy2 interface from a script:
File "C:\Users\~\AppData\Local\conda\conda\envs\~\packages\rpy2\robjects\__init__.py", line 16, in <module>
import rpy2.rinterface as rinterface
File "C:\Users\~\AppData\Local\conda\conda\envs\~\packages\rpy2\rinterface\__init__.py", line 92, in <module>
from rpy2.rinterface._rinterface import (baseenv,
ImportError: DLL load failed: La procédure spécifiée est introuvable.
This error arises on a different computer than the one used to export the yml file (for the latter one, I did not get any error when reinstalling the conda environment). Windows 10-64 bit ; Python 27 64 bits
It seems that the problem was coming from the environment variables defined on the computer on which I tried the installation: a R_HOME variable was defined and was refering to another R version previously installed in the machine (which I don't want). It seems that the r_interface pkg is first looking at this env variable in order to find the R.dll. If no R_HOME is find in the env variables, then r_interface will look for a R_HOME in the calling subprocess...which is what I want in my case because R was installed along with the conda env. Finally, it seems that the installation of R and rpy2 in a conda env could result in conflicts if a R_HOME variable is defined in the env variables of the computer