简体   繁体   English

在conda环境中安装rpy2时出现DLL错误

[英]Getting DLL error when installing rpy2 in conda environment

I am trying to install an environment.yml file that I have previously exported from a conda environment. 我正在尝试安装先前从conda环境中导出的environment.yml文件。 The yml file specifies a dependency to rpy2=2.8.6 and r-base=3.5.1 . yml文件指定对rpy2=2.8.6r-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: 可以从yml文件安装和创建新环境,但是尝试从脚本导入rpy2接口时出现以下错误:

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). 与用于导出yml文件的计算机不同的计算机上也会出现此错误(对于后者,在重新安装conda环境时我没有出现任何错误)。 Windows 10-64 bit ; Windows 10-64位; Python 27 64 bits Python 27 64位

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). 看来问题出在我尝试安装的计算机上定义的环境变量中:一个R_HOME变量已定义,并且引用了以前安装在计算机中的另一个R版本(我不想要)。 It seems that the r_interface pkg is first looking at this env variable in order to find the R.dll. 似乎r_interface pkg首先查看此env变量以查找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. 如果在env变量中找不到R_HOME,则r_interface将在调用子进程中寻找R_HOME ...这是我想要的,因为R与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 最后,如果在计算机的env变量中定义了R_HOME变量,似乎在conda env中安装R和rpy2可能会导致冲突。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM