Importing mgcv fails because Rlapack.dll cannot be found

限于喜欢 提交于 2019-12-05 14:02:00

I inspected the dependencies of the mgcv package; they include the base package Matrix. As it turns out, Matrix has been compiled to a dll (found at ${R_HOME}/library/Matrix/libs/i386/Matrix.dll) by the R development team. That dll needs to link to Rlapack.dll, which for some reason it cannot find when R is called from R.NET in IronPython.

The solution was to drop a copy of Rlapack.dll (which you can find in ${R_HOME}/bin/i386/) into the same directory as Matrix.dll. Now every day is Sunday.

I had the same problem with compositions.dll.

So instead of copying the Rlapack.dll to the directory where compositions.dll exists, I added the bin directory to the PATH.

string rhome = System.Environment.GetEnvironmentVariable("R_HOME");
if (string.IsNullOrEmpty(rhome))
    rhome = @"C:\Program Files\R\R-2.14.0";

System.Environment.SetEnvironmentVariable("R_HOME", rhome);
System.Environment.SetEnvironmentVariable("PATH", System.Environment.GetEnvironmentVariable("PATH") + ";" + rhome + @"\bin\i386");
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!