无法在Linux中安装R tseries,quadprog,xts软件包
我正在使用R版本3.4.0
I am using R version 3.4.0
我正在尝试在Linux机器上安装tseries软件包:
I'm trying to install tseries package on linux machine:
install.packages('https://cran.cnr.berkeley.edu/src/contrib/tseries_0.10-42.tar.gz',dependencies = TRUE,repos = NULL,type ="source")
It gives error:
ERROR: compilation failed for package 'xts'
* removing '/usr/lib64/R/library/xts'
ERROR: dependency 'xts' is not available for package 'TTR'
* removing '/usr/lib64/R/library/TTR'
ERROR: dependencies 'xts', 'TTR' are not available for package 'quantmod'
* removing '/usr/lib64/R/library/quantmod'
ERROR: dependencies 'quadprog', 'quantmod' are not available for package 'tseries'
* removing '/usr/lib64/R/library/tseries'
1: In install.packages("tseries", dependencies = TRUE) :
installation of package 'quadprog' had non-zero exit status
2: In install.packages("tseries", dependencies = TRUE) :
installation of package 'xts' had non-zero exit status
3: In install.packages("tseries", dependencies = TRUE) :
installation of package 'TTR' had non-zero exit status
4: In install.packages("tseries", dependencies = TRUE) :
installation of package 'quantmod' had non-zero exit status
5: In install.packages("tseries", dependencies = TRUE) :
installation of package 'tseries' had non-zero exit status
然后我尝试使用以下命令安装Quadprog:
Then I tried installing quadprog using:
install.packages('https://cran.cnr.berkeley.edu/src/contrib/quadprog_1.5-5.tar.gz',dependencies = TRUE,repos = NULL,type ="source")
出现错误:
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make: *** [quadprog.so] Error 1
ERROR: compilation failed for package 'quadprog'
* removing '/usr/lib64/R/library/quadprog'
请帮助我该怎么办.我在安装这些软件包时遇到了困难.
Please help what should i do. I'm facing hard time in installing these packages.
我已经使用以下命令安装了R:
I have installed R using :
sudo yum -y安装R-core R-devel
sudo yum -y install R-core R-devel
我尝试使用以下命令安装gfortran: yum install gcc-gfortran
I tried installing gfortran using : yum install gcc-gfortran
它说:已安装软件包gcc-gfortran-4.4.7-18.el6.x86_64和最新版本没事
It says :Package gcc-gfortran-4.4.7-18.el6.x86_64 already installed and latest version Nothing to do
此处的问题是Fortran编译器( gfortran
)和GCC编译器驱动程序( gcc
)不同步: gfortran
是4.4.7版, gcc
是4.7.2版.这意味着它们使用不同的目录来存储文件,并且 gcc
无法找到 gcc-gfortran
安装的 libgfortran.so
符号链接.>包装.
The problem here is that the Fortran compiler (gfortran
) and the GCC compiler driver (gcc
) are out of sync: gfortran
is version 4.4.7, gcc
is version 4.7.2. This means that they use different directories to store there files, and gcc
is unable to locate the libgfortran.so
symbolic link installed by the gcc-gfortran
package.
解决方案是将这两个编译器引入相同的版本.这可以通过调整 PATH
变量来实现(基于其他讨论, gcc
在这里未引用/usr/bin/gcc
),卸载提供此 gcc
命令的软件集合(使用 yum remove devtoolset-1.1-gcc
),或使用 yum安装用于同一软件集合的Fortran组件安装devtoolset-1.1-gcc-gfortran
.
The solution is to bring these two compilers to the same version. This can be achieved by adjusting the PATH
variable (based on other discussions, gcc
is not referring to /usr/bin/gcc
here), deinstalling the software collection that provides this gcc
command (using yum remove devtoolset-1.1-gcc
), or installing the Fortran component for the same software collection, using yum install devtoolset-1.1-gcc-gfortran
.
我最好的猜测是您的 devtoolset-1.1-gcc
软件包来自此存储库:
My best guess is that your devtoolset-1.1-gcc
package comes from this repository:
因此,您也可以从那里使用 gfortran
包(也可以选择 c ++
包,以避免类似的问题).
So you could use the gfortran
package from there, too (and pick the c++
package as well, to avoid a similar problem).