Error installing RODBC or ODBC on a Sagemaker Jupyter NoteBook Instance

帅比萌擦擦* 提交于 2020-04-12 04:54:52

问题


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:

回答1:


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!



来源:https://stackoverflow.com/questions/59940350/error-installing-rodbc-or-odbc-on-a-sagemaker-jupyter-notebook-instance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!