Installation of RODBC on OS X Yosemite
Asked Answered
B

4

11

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?

Beutler answered 22/1, 2015 at 5:10 Comment(12)
Have you tried following the advice from here?Badenpowell
Absolutely tried that. The header files required are present and in the PATH. Just that when RStudio builds RODBC it can't find them.Beutler
Did you try moving the files themselves rather than simply setting the path?Badenpowell
Yep, they're in /usr/include. There is no libiodbc.a file in the iODBC source, but I'm thinking one step at a time here. :) Have tried with both iODBC and unixODBC with the same error.Beutler
Hmm. libiodbc.a was in the source I used, and it worked when I moved all three files. If it still doesn't work after that I don't know what to tell you...Badenpowell
Ok, have found a previous version of that file, but still the same issue. There is a dynamic library /usr/lib/libiodbc.dylib present already though. Do you know of any way to get more verbose debugging from R when it's building a package like this?Beutler
Nope, sorry. We've reached the limit of what I can help with. You now know exactly what I did to get it to work for me.Badenpowell
Thanks anyway. I do appreciate it.Beutler
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 from the terminal worked on all our Yosemite systems (R3.1.2, latest Yosemite, latest Xcode/Xcode cmd line tools). I realize that requires Homebrew, but it required no tweaking.Kraken
@Kraken well it seemed that worked. I was installing unixODBC using MacPorts and the files were definitely there, but for some reason a homebrew install worked. Thanks heaps!Beutler
@hrbrmstr, you should post this as an answer so Carl can approve it and I can upvote it. This worked for me too. Muchas gracias.Asperse
Apple chose iODBC over UnixODBC for good reasons. (1) iODBC (albeit outdated) remains part of macOS High Sierra 10.13.3, as it has been since Panther 10.3.0. (2) Current iODBC, including dylibs, headers, and Frameworks is a fast & free download & install from iodbc.org.Illume
K
22

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.

Kraken answered 23/3, 2015 at 15:47 Comment(6)
I believe that you are a confirmed user of brew and even compile R with it. Do you have any idea whether this works for those of use who are using the CRAN R binaries and hte tools from the r.att.research.com site?Sponger
it now version 1.3-13Scilicet
And for some of, we need to brew install wget before using this.Psychosomatics
Your answer was really helpful. Do you know if it's possible to include RODBC in a package via packrat or another method such that all recipients of the package won't need to do these steps?Threap
By "in a package", do you mean actually having the RODBC package actually be in source tree of another package? It's technically possible and will require some fiddling with the library location paths, but it won't be CRAN-able and leaves you in the position to ensure all RODBC updates & fixes get put into your source pkg.Kraken
I'm new to packages, but yes that sounds like what I need. I'd like to be able to give the package to my colleagues with all dependencies included such that they can start from a system with only R and R Studio installed and have a minimal amount of setup to do. My work colleagues are not R developers. Can you give me some tips on how to get started with this?Threap
E
3

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

Eno answered 16/6, 2015 at 7:7 Comment(1)
and now it's version 1.3-14Bawd
P
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')
Purcell answered 23/6, 2016 at 13:55 Comment(0)
D
1

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.

Drumfish answered 9/11, 2016 at 14:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.