Gurobi 库不再加载 [Windows]

Gurobi library does not load anymore [Windows]

因为没有用,所以我重新安装了。但没有成功。 我想念什么?

install.packages('C:/gurobi800/win64/R/gurobi_8.0-0.zip', repos=NULL)
# package ‘gurobi’ successfully unpacked and MD5 sums checked
Sys.getenv()
# ...
# GRB_LICENSE_FILE                  C:\gurobi800\gurobi.lic
# GUROBI_HOME                       C:\gurobi800\win64
# ...
library("gurobi")

Error: package or namespace load failed for ‘gurobi’: package ‘gurobi’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version

来自 Gurobi 的 R 文件夹中的DESCRIPTION

Depends: slam (>= 0.1-9)
URL: http://www.gurobi.com
Built: R 3.4.0; x86_64-w64-mingw32; 2018-04-21 00:42:28 UTC; windows

会话信息:

R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=German_Switzerland.1252  LC_CTYPE=German_Switzerland.1252    LC_MONETARY=German_Switzerland.1252
[4] LC_NUMERIC=C                        LC_TIME=German_Switzerland.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] slam_0.1-44

loaded via a namespace (and not attached):
[1] compiler_3.5.1  imsbasics_1.9.7 tools_3.5.1     yaml_2.1.19    

看来您要么需要返回 R 3.4.4,要么获取 Gurobi >= 8.0.1;因为 R 从 3.4.4 到 3.5.0 的幕后发生了很多变化,为 R 版本 < 3.5.0 编译的二进制文件将不适用于 R >= 3.5.0,因此您的 Gurobi 8.0.0 将不适用于您当前安装的 R.

其他Gurobi用户遇到过这个问题;见 here, and more informatively, here:

The current Gurobi release 8.0.1 ships a R package for R 3.5.X

如果您更愿意使用旧版本的 R 而不是新版本的 Gurobi,您可以获得 Windows here.

的 R 3.4.4