22

我正在尝试在我的 Windows 7 客户端上安装 ROracle 包。我安装了 Oracle Instant 客户端和 Rtools,安装了 DBI 包,设置了 OCI32_LIB 环境变量。但是当我尝试从命令行安装时:

C:\Temp>R CMD INSTALL --build ROracle_1.1-10.tar.gz
* installing to library 'C:/Users/myaccount/Documents/R/win-library/3.0'
* installing *source* package 'ROracle' ...
** package 'ROracle' successfully unpacked and MD5 sums checked
ERROR: configuration failed for package 'ROracle'
* removing 'C:/Users/myaccount/Documents/R/win-library/3.0/ROracle'

C:\Temp>

当我尝试从源代码安装时:

> install.packages("ROracle",type = "source")
Warning in install.packages :
  package ‘ROracle’ is not available (for R version 3.0.0)
Installing package into ‘C:/Users/myaccount/Documents/R/win-library/3.0’
(as ‘lib’ is unspecified)
trying URL 'http://cran.at.r-project.org/src/contrib/ROracle_1.1-10.tar.gz'
Content type 'application/x-gzip' length 168193 bytes (164 Kb)
opened URL
downloaded 164 Kb

* installing *source* package 'ROracle' ...
** package 'ROracle' successfully unpacked and MD5 sums checked
ERROR: configuration failed for package 'ROracle'
* removing 'C:/Users/myaccount/Documents/R/win-library/3.0/ROracle'
Warning in install.packages :
  running command '"C:/PROGRA~1/R/R-30~1.0/bin/i386/R" CMD INSTALL -l "C:\Users\myaccount\Documents\R\win-library\3.0" C:\Users\myaccount\AppData\Local\Temp\RtmpGggbyp/downloaded_packages/ROracle_1.1-10.tar.gz' had status 1
Warning in install.packages :
  installation of package ‘ROracle’ had non-zero exit status

The downloaded source packages are in
    ‘C:\Users\myaccount\AppData\Local\Temp\RtmpGggbyp\downloaded_packages’

我该怎么办,如何进行?

4

8 回答 8

20

来自http://jgilfillan.github.io/2016/05/28/how-to-install-roracle-in-windows-7/

从 oracle 下载二进制文件: http ://www.oracle.com/technetwork/database/database-technologies/r/roracle/downloads/index.html

在 r 中运行以下命令,替换文件路径:

setwd('xxxxx')   # set to path of download
install.packages('ROracle_1.2-1.zip', repos = NULL)

然后加载库并使用包 - 您可能必须将 XXXX 更改为 TNS 名称中的任何内容:

library('ROracle')
drv <- dbDriver("Oracle")
con <- dbConnect(drv, "USER GOES HERE", "PASSWORD GOES HERE", dbname='XXX')

测试连接:

dbReadTable(con, 'DUAL')

请注意,这也已被确认适用于 Windows 10。

于 2015-08-19T04:19:42.440 回答
11

我也遇到了这个确切的问题,包括 OCI_INC 错误。他们实际上在 .tar.gz 包的 INSTALL 文件中讨论了它,你可以在那里阅读更多内容。

您必须像这样将OCI_INC变量设置为include目录:

set OCI_INC=C:\oracle\product\11.2.0\client_2\oci\include

或者你的文件在哪里。这是我从管理员特权命令行安装东西的完整设置。

set OCI_LIB64=C:\oracle\product\11.2.0\client_2\BIN
set OCI_INC=C:\oracle\product\11.2.0\client_2\oci\include
set PATH=C:\oracle\product\11.2.0\client_2\BIN;C:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;%PATH%
"C:/PROGRA~1/R/R-30~1.1/bin/x64/R" CMD INSTALL --build "C:/Your/Path/To/ROracle_1.1-10.tar.gz"

此外,如果您尝试进行 32 位安装,请确保更改client_2client_1 和。OCI_LIB64OCI_LIB32

于 2013-09-09T20:00:27.237 回答
4

执行步骤后(以红色框突出显示)。我还在 R 上运行了下面的命令。 因此,在 Windows 7 64 位、R 3.4 64 位环境中一切正常。 在此处输入图像描述 在此处输入图像描述在此处输入图像描述 在此处输入图像描述

Sys.setenv(OCI_LIB64="C:/Oracle/instantclient_12_2/")
Sys.setenv(OCI_INC="C:/Oracle/product/11.2.0/client_1/oci/include")
install.packages("ROracle", dep=T)
于 2017-09-30T00:09:26.827 回答
3

我正是这个问题。这是因为在安装 RTools 时我没有选中“编辑路径”复选框。我卸载了 RTools 并重新安装了它,这次确保选中了复选框,并且它第一次工作!希望这可以帮助。

于 2013-09-02T08:51:36.700 回答
2

我在尝试从源代码安装 ROracle 时遇到了类似的错误。1

在搜索了一下之后,我不得不承担其他人提到的内容以及重新下载 tar.gz。当我仔细检查下载大小时,它是 10KB 而不是 234KB。

  1. 重新下载源:http ://cran.r-project.org/web/packages/ROracle/index.html
  2. 在 windows 中更新了以下环境变量

    SET PATH=C:\Rtools\bin;C:\Rtools\gcc-4.6.3;%PATH% SET OCI_INC=C:\Oracle_11G_ClientR2\product\11.2.0\client_1\oci\include SET OCI_LIB32=C:\Oracle_11G_ClientR2 \product\11.2.0\client_1\BIN SET OCI_LIB64=C:\Oracle_11G_ClientR2\product\11.2.0\client_1\BIN R CMD INSTALL --build "C:\temp\ROracle_1.1-12.tar.gz"

  3. 输出应如下所示: 示例cmd输出

1这是以前的错误的样子:

C:\Temp>R CMD INSTALL --build "C:\\temp\\ROracle_1.1-12.tar.gz" 
Error in getOctD(x, offset, len) : invalid octal digit
于 2015-06-08T17:53:04.840 回答
0

连同“基本包”和“ ODBC 包”,在Oracle 11g中,您应该将解压后的文件从“ SDK 包”复制到子目录instantclient_11_2中。在这种情况下,您不需要定义环境变量Sys.setenv (OCI_INC = "...")

于 2018-10-11T05:32:33.043 回答
-1

这对我有用:

Sys.setenv(OCI_LIB32="C:/oracle/product/12.1.0/client_1/BIN/")
Sys.setenv(OCI_INC="C:/oracle/product/12.1.0/client_1/oci/include/")
install.packages("ROracle")
于 2019-03-29T18:15:11.993 回答
-2
install.packages("P:/Strategic-Primary/documentation/R/Packages/DBI_1.0.0.zip", repos = NULL, type = "win.binary")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/xxx/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
package ‘DBI’ successfully unpacked and MD5 sums checked
> setwd('E:\R\packages')
Error: '\R' is an unrecognized escape in character string starting "'E:\R"
> setwd('E:\\R\\packages')
> install.packages('ROracle-1.3.2.zip')
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/xxx/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘ROracle-1.3.2.zip’ is not available (for R version 3.6.0)
> install.packages('ROracle-1.3.1.zip')
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/xxx/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘ROracle-1.3.1.zip’ is not available (for R version 3.6.0)
> Sys.setenv(OCI_LIB32="C:/oracle/product/12.1.0/client_1/BIN/")
> Sys.setenv(OCI_INC="C:/oracle/product/12.1.0/client_1/oci/include/")
> install.packages("ROracle")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/xxx/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘ROracle’
  These will not be installed
> install.packages('ROracle-1.3.1.zip')
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/xxx/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘ROracle-1.3.1.zip’ is not available (for R version 3.6.0)
> install.packages('ROracle-1.3.2.zip')
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/xxx/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘ROracle-1.3.2.zip’ is not available (for R version 3.6.0)

我安装了 SDK、ODBC 和基本安装客户端(还设置了 Env 变量路径),但它仍然不适合我。有什么建议吗?

于 2019-12-18T15:54:51.717 回答