Installation of RODBC on OS X Yosemite

天大地大妈咪最大 提交于 2019-11-26 23:05:10

问题


When installing the R package RODBC in RStudio on OS X Yosemite, I get the following error:

configure: error: "ODBC headers sql.h and sqlext.h not found"

This is a common error and indicates that ODBC drivers haven't been installed (iODBC headers aren't included in OS 10.9 hence the separate install required). So, I install unixODBC and confirm that the header files are present in the PATH.

Sys.getenv("PATH") gives me the correct path including where the two files are found.

However, when I try install.packages("RODBC",type = "source") again, the same error persists. Have tested this with iODBC as well as unixODBC.

Are there any other tests I can perform to help diagnose the issue?


回答1:


We have a bunch of Yosemite systems with R 3.1.2 that are all up-to-date with Xcode & Xcode command-line tools. The following consistently works with each major R update or new system install (at the Terminal):

brew update && brew install unixODBC && \
  wget "http://cran.r-project.org/src/contrib/RODBC_1.3-10.tar.gz" && \
  R CMD INSTALL RODBC_1.3-10.tar.gz 

It (obviously) requires Homebrew, but that's what we've standardized on in our shop.

As RODBC is updated, the version number (1.3-10, 1.3-11, ...) will change. To find out the current version, look at https://cran.r-project.org/web/packages/RODBC/index.html.




回答2:


I got a 404 when calling RODBC_1.3-10.tar.gz so I made a tiny change to the script above and it worked perfectly: brew update && brew install unixODBC && wget "http://cran.r-project.org/src/contrib/RODBC_1.3-11.tar.gz" && R CMD INSTALL RODBC_1.3-11.tar.gz




回答3:


I'm using OS X Yosemite 10.10.5, R version 3.2.2. By following below steps, I'm able to make it work.

  1. brew install unixodbc
  2. brew link unixodbc (if missing this step, R still can not find those header files)
  3. install.packages('RODBC', type='source')



回答4:


On my OS X Yosemite system with unixODBC installed from MacPorts and R 3.3.2, install.packages() failed (whether from repo or from a tarball I had saved locally) but R CMD INSTALL RODBC_1.3-14.tar.gz did the job.



来源:https://stackoverflow.com/questions/28081640/installation-of-rodbc-on-os-x-yosemite

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