当尝试使用ROracle时,我得到以下错误消息
> library("ROracle")
Error: package or namespace load failed for ‘ROracle’:
package ‘ROracle’ was installed before R 4.0.0: please re-install it
我已经安装/下载了DBI, RTools, oracle isnant客户端(基本+ sdk),并尝试按照这些说明,但它没有工作:ROracle安装
我能够很好地下载ROracle(见下文),所以我对缺少什么感到困惑。我需要降级一个版本吗?
> Roracle_path <- "filepath.../ROracle_1.3-2.zip"
> install.packages(Roracle_path, repos = NULL)
Installing package into ‘C:/Users/<my username>/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
package ‘ROracle’ successfully unpacked and MD5 sums checked
ROracle_1.3-2.tar.gz是为r3.6构建的。x也适用于r4。如果从SOURCES安装包,则使用。.
在Linux系统上,首先你必须安装Oracle即时客户端基础和SDK:
/home/jovyan/R
unzip instantclient-basic-linux.x64-21.4.0.0.0dbru.zip -d /opt/oracle/
unzip instantclient-sdk-linux.x64-21.4.0.0.0dbru.zip -d /opt/oracle
必须在系统上安装linux包libaio1:
apt install -y libaio1
接下来,必须设置环境变量:
export PATH="$PATH:/opt/oracle/instantclient_21_4"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/oracle/instantclient_21_4"
最后,包可以从源代码安装(使用ROracle_1.3-2.tar.gz(源代码),而不是ROracle_1.3-2_R_x86_64-linux-gnu.tar.gz(二进制)):
R CMD INSTALL --configure-args='--with-oci-lib=/opt/oracle/instantclient_21_4/ --with-oci-inc=/opt/oracle/instantclient_21_4/sdk/include' ROracle_1.3-2.tar.gz
在安装过程中,您将看到软件包将从SOURCES安装:
* installing to library ‘/opt/conda/lib/R/library’
* installing *source* package ‘ROracle’ ...
** using staged installation
configure: creating ./config.status
config.status: creating src/Makevars
** libs
x86_64-conda-linux-gnu-cc -I"/opt/conda/lib/R/include" -DNDEBUG -I/opt/oracle/instantclient_21_4/sdk/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /opt/conda/include -I/opt/conda/include -Wl,-rpath-link,/opt/conda/lib -fpic -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /opt/conda/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1639563404388/work=/usr/local/src/conda/r-base-4.1.2 -fdebug-prefix-map=/opt/conda=/usr/local/src/conda-prefix -c rodbi.c -o rodbi.o
x86_64-conda-linux-gnu-cc -I"/opt/conda/lib/R/include" -DNDEBUG -I/opt/oracle/instantclient_21_4/sdk/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /opt/conda/include -I/opt/conda/include -Wl,-rpath-link,/opt/conda/lib -fpic -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /opt/conda/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1639563404388/work=/usr/local/src/conda/r-base-4.1.2 -fdebug-prefix-map=/opt/conda=/usr/local/src/conda-prefix -c rooci.c -o rooci.o
x86_64-conda-linux-gnu-cc -shared -L/opt/conda/lib/R/lib -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/opt/conda/lib -Wl,-rpath-link,/opt/conda/lib -L/opt/conda/lib -o ROracle.so rodbi.o rooci.o -L/opt/oracle/instantclient_21_4/ -lclntsh -Wl,-rpath,/opt/oracle/instantclient_21_4/ -L/opt/conda/lib/R/lib -lR
installing to /opt/conda/lib/R/library/00LOCK-ROracle/00new/ROracle/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (ROracle)
#
检查输出中的行,看看它将从源代码安装:
* installing *source* package ‘ROracle’ ...
我降级到R 3.6.3并使用RTools 35,现在它可以工作了。