在Windows上安装rcplex

问题描述

我尝试解决R中非常大的优化问题,因此我想安装rcplex。我对R没有太多经验,所以请问我愚蠢的事情吧。

首先,我安装了cplex studio和rtools40。我尝试遵循手册https://cran.r-project.org/web/packages/Rcplex/INSTALL。然后,我将makevars.win文件更改为

ifeq "$(WIN)" "64"
               PKG_LIBS = -L"C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/bin/x64_win64" -lcplex12100 -lm
               PKG_CPPFLAGS = -D_LP64 -I"C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include"
          else
               PKG_LIBS = -L"C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/bin/x86_win32" -lcplex12100 -lm
               PKG_CPPFLAGS = -I"C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include"
           endif

然后我使用了命令

"C:\Program Files\R\R-4.0.2\bin\x64\Rgui.exe"  CMD build --no-build-vignettes --no-manual --md5 Rcplex_0.3-3

获取错误

warning unkNown option --no-build-vignettes,warning unkNown option --no-manual and warning unkNown option --md5 .

如果我尝试直接在R中安装它,则会收到错误消息

Warning in install.packages(files[tarballs],.libPaths()[1L],repos = NULL,'lib = "C:/Program Files/R/R-4.0.2/library" is not writable
ERROR: dependency 'slam' is not available for package 'Rcplex'

所以我不知道如何解决它。 编辑 我将命令更改为

"C:\Program Files\R\R-4.0.2\bin\x64\R.exe" CMD  build --no-build-vignettes --no-manual --md5 C:/Users/Jonas/Desktop/Rcplex_0.3-3.tar.gz

并得到错误

 ERROR
cannot change to directory 'C:/Users/Jonas/Desktop/Rcplex_0.3-3.tar.gz'

和命令

"C:\Program Files\R\R-4.0.2\bin\x64\R.exe" CMD  check  C:/Users/Jonas/Desktop/Rcplex_0.3-3.tar.gz

我明白了

* using log directory 'C:/Users/Jonas/Rcplex.Rcheck'
* using R version 4.0.2 (2020-06-22)
* using platform: x86_64-w64-mingw32 (64-bit)
* using session charset: ISO8859-1
* checking for file 'Rcplex/DESCRIPTION' ... OK
* this is package 'Rcplex' version '0.3-3'
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for .dll and .exe files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking whether package 'Rcplex' can be installed ... ERROR
Installation Failed.
See 'C:/Users/Jonas/Rcplex.Rcheck/00install.out' for details.
* DONE

Status: 1 ERROR
See
  'C:/Users/Jonas/Rcplex.Rcheck/00check.log'
for details.

我不知道如何进行。
2.编辑 我改变了并得到

"C:\Program Files\R\R-4.0.2\bin\x64\R.exe" CMD  build --no-build-vignettes --no-manual --md5 C:/Users/Jonas/Desktop/Rcplex
* checking for file 'C:/Users/Jonas/Desktop/Rcplex/DESCRIPTION' ... OK
* preparing 'Rcplex':
* checking DESCRIPTION Meta-information ... OK
* cleaning src
Warning in cleanup_pkg(pkgdir,Log)
  unable to run 'make clean' in 'src'
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* adding MD5 file
* building 'Rcplex_0.3-3.tar.gz'
Warning: file 'Rcplex/cleanup' did not have execute permissions: corrected
Warning: file 'Rcplex/configure' did not have execute permissions: corrected

我认为现在的问题是,没有C:/ Program Files / IBM / ILOG / CPLEX_Studio_Community1210 / cplex / bin / x86_win32文件
3.编辑 我也尝试安装cplexAPI,在这里我不需要这些文件,并且得到了相同的错误
4.编辑我得到的

"C:\Program Files\R\R-4.0.2\bin\x64\R.exe" CMD INSTALL --build --no-multiarch .\Rcplex_0.3-3.tar.gz
* installing to library 'C:/Users/Jonas/Documents/R/win-library/4.0'
* installing *source* package 'Rcplex' ...
** package 'Rcplex' successfully unpacked and MD5 sum checked
** using staged installation
Warning in system("sh ./configure.win") 'sh' not found
ERROR: configuration Failed for package 'Rcplex'
* removing 'C:/Users/Jonas/Documents/R/win-library/4.0/Rcplex'

5,编辑 现在我明白了
"C:\Program Files\R\R-4.0.2\bin\x64\R.exe" CMD  build --no-build-vignettes --no-manual --md5 C:/Users/Jonas/Desktop/cplexAPI
* checking for file 'C:/Users/Jonas/Desktop/cplexAPI/DESCRIPTION' ... OK
* preparing 'cplexAPI':
* checking DESCRIPTION Meta-information ... OK
* cleaning src
* checking vignette Meta-information ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* adding MD5 file
* building 'cplexAPI_1.4.0.tar.gz'
Warning: file 'cplexAPI/cleanup' did not have execute permissions: corrected
Warning: file 'cplexAPI/configure' did not have execute permissions: corrected

C:\Users\Jonas>"C:\Program Files\R\R-4.0.2\bin\x64\R.exe" CMD INSTALL --build --no-multiarch .\Rcplex_0.3-3.tar.gz
* installing to library 'C:/Users/Jonas/Documents/R/win-library/4.0'
* installing *source* package 'Rcplex' ...
** package 'Rcplex' successfully unpacked and MD5 sums checked
** using staged installation
** libs
"C:/rtools/mingw64/bin/"gcc  -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -D_LP64 -I"C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include"         -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c Rcplex.c -o Rcplex.o
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cpxconst.h:251:62: error: expected ')' before 'deprecated'
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                                              ^~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cplex.h:1214:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cpxconst.h:251:41: error: expected identifier or '(' before ')' token
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                         ^~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cplex.h:1214:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cpxconst.h:251:62: error: expected ')' before 'deprecated'
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                                              ^~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cplex.h:1220:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cpxconst.h:251:41: error: expected identifier or '(' before ')' token
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                         ^~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cplex.h:1220:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cpxconst.h:251:62: error: expected ')' before 'deprecated'
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                                              ^~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cplex.h:1251:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cpxconst.h:251:41: error: expected identifier or '(' before ')' token
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                         ^~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cplex.h:1251:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cpxconst.h:251:62: error: expected ')' before 'deprecated'
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                                              ^~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cplex.h:1257:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cpxconst.h:251:41: error: expected identifier or '(' before ')' token
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                         ^~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cplex.h:1257:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cpxconst.h:251:62: error: expected ')' before 'deprecated'
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                                              ^~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cplex.h:1262:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cpxconst.h:251:41: error: expected identifier or '(' before ')' token
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                         ^~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cplex.h:1262:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cpxconst.h:251:62: error: expected ')' before 'deprecated'
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                                              ^~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cplex.h:1617:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cpxconst.h:251:41: error: expected identifier or '(' before ')' token
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                         ^~~~~~~~~~
C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1210/cplex/include/ilcplex/cplex.h:1617:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
make: *** [C:/PROGRA~1/R/R-40~1.2/etc/x64/Makeconf:222: Rcplex.o] Error 1
ERROR: compilation Failed for package 'Rcplex'
* removing 'C:/Users/Jonas/Documents/R/win-library/4.0/Rcplex'

如果我尝试安装cplexAPI,也会收到相同的错误
6,编辑 对于cplexAPi,我有makevars.win文件

PKG_CPPFLAGS=-g -D_R_=1 -DUSE_R=1 -I"C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include"
PKG_LIBS=-L"C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\bin\x64_win64" -lm -lcplex12100

并获得

"C:\Program Files\R\R-4.0.2\bin\x64\R.exe" CMD  build --no-build-vignettes --no-manual --md5 C:/Users/Jonas/Desktop/cplexAPI
* checking for file 'C:/Users/Jonas/Desktop/cplexAPI/DESCRIPTION' ... OK
* preparing 'cplexAPI':
* checking DESCRIPTION Meta-information ... OK
* cleaning src
* checking vignette Meta-information ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* adding MD5 file
* building 'cplexAPI_1.4.0.tar.gz'
Warning: file 'cplexAPI/cleanup' did not have execute permissions: corrected
Warning: file 'cplexAPI/configure' did not have execute permissions: corrected

"C:\Program Files\R\R-4.0.2\bin\x64\R.exe" CMD INSTALL --build --no-multiarch .\cplexAPI_1.4.0.tar.gz
* installing to library 'C:/Users/Jonas/Documents/R/win-library/4.0'
* installing *source* package 'cplexAPI' ...
** package 'Rcplex' successfully unpacked and MD5 sums checked
** using staged installation
** libs
"C:/rtools/mingw64/bin/"gcc  -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -g -D_R_=1 -DUSE_R=1 -I"C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include"         -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c cplexAPI.c -o cplexAPI.o
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:62: error: expected ')' before 'deprecated'
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                                              ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1214:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:41: error: expected identifier or '(' before ')' token
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                         ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1214:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:62: error: expected ')' before 'deprecated'
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                                              ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1220:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:41: error: expected identifier or '(' before ')' token
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                         ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1220:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:62: error: expected ')' before 'deprecated'
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                                              ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1251:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:41: error: expected identifier or '(' before ')' token
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                         ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1251:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:62: error: expected ')' before 'deprecated'
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                                              ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1257:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:41: error: expected identifier or '(' before ')' token
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                         ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1257:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:62: error: expected ')' before 'deprecated'
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                                              ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1262:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:41: error: expected identifier or '(' before ')' token
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                         ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1262:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:62: error: expected ')' before 'deprecated'
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                                              ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1617:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cpxconst.h:251:41: error: expected identifier or '(' before ')' token
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                         ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio_Community1210\cplex\include/ilcplex/cplex.h:1617:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
make: *** [C:/PROGRA~1/R/R-40~1.2/etc/x64/Makeconf:222: cplexAPI.o] Error 1
ERROR: compilation Failed for package 'cplexAPI'
* removing 'C:/Users/Jonas/Documents/R/win-library/4.0/cplexAPI'

所以有同样的问题。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)