在Sagemaker Jupyter笔记本实例上安装RODBC或ODBC时出错 [英] Error installing RODBC or ODBC on a Sagemaker Jupyter NoteBook Instance
问题描述
我一直在尝试从Sagemaker Jupyter Notebook实例建立与Teradata的连接.我正在尝试像通过R Studio那样进行操作.但是,当我尝试在实例中安装该软件包时,都会收到非零的退出状态错误.
我尝试安装以下方法:
remotes::install_github()
或
devtools::install_github()
,还有:
install.packages('odbc', repo="https://cran.rstudio.com/")
我在RODBC上尝试了相同的操作,并且得到了相同的警告或错误.
关于如何解决这个问题的任何想法吗?
谢谢.
更新: 如果我运行以下代码:
devtools::install_github("r-dbi/odbc")`
我收到以下错误(这只是摘录):
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文档,我得出的结论是,我不知道如何解释这种现象./p>
尽管如此,我还是找到了解决方法!
因此,我们知道如何通过Jupyter终端或直接从.ipynb
文件中的单元格安装软件包.但是,如果您尝试像在终端机或Python内核中那样在R内核中运行这些命令,则会遇到错误.
此外,对于某些在终端中甚至在Python内核上安装它的人来说,只需将conda
安装在其他环境中即可即可.是的,事实证明您的Jupyter实例上有几个环境.
因此,就像我说的那样,您要使用conda install
命令,而不要使用pip
,sudo
或yum
命令.
让您的生活更轻松.如果install.packages()
和install_github()
不起作用,则下面是在R内核单元上运行以将软件包直接安装到正确环境中所需的代码:
system(command = 'conda install -c r packageName --yes')
示例:
system(command = 'conda install -c r tidyverse --yes')
就是这样.之后,您可以调用library()
并照常继续执行R工作流程.
希望对大家有帮助!
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()
or
devtools::install_github()
and also:
install.packages('odbc', repo="https://cran.rstudio.com/")
I tryed the same with RODBC, and I get the same warnings or errors.
Any ideas on how I can get around this problem?
Thanks in advance.
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:
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!
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.
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.
So, to get to the point, just like I said, you would use a conda install
command, not a pip
, sudo
or yum
command.
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')
Example:
system(command = 'conda install -c r tidyverse --yes')
And that's it. After that you can call library()
and resume your R workflow as you do.
Hope this helps guys!
这篇关于在Sagemaker Jupyter笔记本实例上安装RODBC或ODBC时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!