在 Sagemaker Jupyter NoteBook 实例上安装 RODBC 或 ODBC 时出错 [英] Error installing RODBC or ODBC on a Sagemaker Jupyter NoteBook Instance
问题描述
我一直在尝试从 Sagemaker Jupyter Notebook 实例建立到 Teradata 的连接.我试图按照我通过 R Studio 的方式来做.但是当我尝试在实例中安装软件包时,我会收到非零退出状态错误.
I have been trying to establish a connection to Teradata from a Sagemaker Jupyter Notebook instance. I was trying to do it the way I would through R Studio. But when ever I try to install the package in the instance I get an non-zero exit status error.
我尝试过以下安装方式:
I have tried installing the following ways:
remotes::install_github()
或
devtools::install_github()
还有:
install.packages('odbc', repo="https://cran.rstudio.com/")
我对 RODBC 进行了相同的尝试,但收到相同的警告或错误.
I tryed the same with RODBC, and I get the same warnings or errors.
关于如何解决这个问题的任何想法?
Any ideas on how I can get around this problem?
提前致谢.
更新:如果我运行这行代码:
UPDATE: If I run this line of code:
devtools::install_github("r-dbi/odbc")`
我收到以下错误(这只是摘录):
I get the following error (This is just an extract):
Error: Failed to install 'odbc' from GitHub:
System command error, exit status: 1, stdout + stderr (last 10 lines):
E> ** testing if installed package can be loaded from temporary location
E> Error: package or namespace load failed for ‘odbc’ in dyn.load(file, DLLpath = DLLpath, ...):
E> unable to load shared object '/tmp/RtmpBuMhbW/Rinst32846cdd20a9/00LOCK-odbc/00new/odbc/libs/odbc.so':
E> libodbc.so.2: cannot open shared object file: No such file or directory
E> Error: loading failed
E> Execution halted
E> ERROR: loading failed
E> * removing ‘/tmp/RtmpBuMhbW/Rinst32846cdd20a9/odbc’
E> -----------------------------------
E> ERROR: package installation failed
Traceback:
推荐答案
好吧,在阅读 AWS/Sagemaker/Conda/R 文档数小时后,我得出的结论是,我不知道如何解释这些现象.
Alright, after hours of reading AWS/Sagemaker/Conda/R documentation I arrived at the conclusion that, I don't know how to explain the phenomena.
尽管如此,我已经找到了解决方法!
Nonetheless, I have found a workaround!
所以我们知道如何通过 Jupyter 终端或直接从 .ipynb
文件中的单元安装软件包.尽管如此,如果您尝试在 R 内核中运行这些命令,就像在终端或 Python 内核中一样,您会遇到错误.
So we know how we can install packages through the Jupyter terminal or directly from a cell in the .ipynb
file. Nonetheless, if you try to run those commands inside the R kernel just like you would on the terminal or in a Python kernel you would run into an error.
此外,对于某些在终端中安装它的人,甚至在 Python 内核上安装它可能只是让 conda
在不同的环境中安装包.是的,事实证明您的 Jupyter 实例上有几个环境.
Also, for some people installing it in the terminal, or even on a Python kernel might just make conda
install the package on a different environment. Yes, turns out there are a couple of environments on your Jupyter instance.
所以,正如我所说,你将使用 conda install
命令,而不是 pip
、sudo
或 yum
命令.
So, to get to the point, just like I said, you would use a conda install
command, not a pip
, sudo
or yum
command.
让您的生活更轻松.这是您需要在 R 内核单元上运行的代码,如果 install.packages()
和 install_github()
没有用:
Make your life easier. Here is the code that you would need to run on your R Kernel cell, to install a package directly to the correct environment if, install.packages()
and install_github()
didn't work:
system(command = 'conda install -c r packageName --yes')
示例:
system(command = 'conda install -c r tidyverse --yes')
就是这样.之后,您可以调用 library()
并继续您的 R 工作流程.
And that's it. After that you can call library()
and resume your R workflow as you do.
希望这对大家有帮助!
这篇关于在 Sagemaker Jupyter NoteBook 实例上安装 RODBC 或 ODBC 时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!