Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installation of RODBC on OS X Yosemite

Tags:

r

rodbc

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?

like image 918
Carl Avatar asked Jan 22 '15 05:01

Carl


Video Answer


4 Answers

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.

like image 106
hrbrmstr Avatar answered Oct 16 '22 17:10

hrbrmstr


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

like image 26
itdnext Avatar answered Oct 16 '22 17:10

itdnext


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')
like image 41
ryan.lan1 Avatar answered Oct 16 '22 15:10

ryan.lan1


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.

like image 1
Gabi Avatar answered Oct 16 '22 15:10

Gabi