dplyr installation issues

I'm getting an issue installing dplyr, RmySQL, and readr. I have uninstalled r-studio and it's library and then reinstalled to no avail. I've also reinstalled Rccp from a mac specific repo. Currently running mojave 10.14

install.packages("dplyr", repo = 'https://mac.R-project.org')
Installing package into ‘/usr/local/lib/R/3.6/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://mac.R-project.org/src/contrib/dplyr_0.8.5.tar.gz'
Content type 'application/x-gzip' length 1378766 bytes (1.3 MB)
==================================================
downloaded 1.3 MB

* installing *source* package ‘dplyr’ ...
** package ‘dplyr’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang++ -I"/usr/local/Cellar/r/3.6.3_1/lib/R/include" -DNDEBUG -I../inst/include -DRCPP_DEFAULT_INCLUDE_CALL=false -DCOMPILING_DPLYR -DRCPP_USING_UTF8_ERROR_STRING -DRCPP_USE_UNWIND_PROTECT -DBOOST_NO_AUTO_PTR  -I"/usr/local/lib/R/3.6/site-library/BH/include" -I"/usr/local/lib/R/3.6/site-library/plogr/include" -I"/usr/local/lib/R/3.6/site-library/Rcpp/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include  -fPIC  -g -O2  -c RcppExports.cpp -o RcppExports.o
In file included from RcppExports.cpp:4:
In file included from ./../inst/include/dplyr.h:4:
In file included from ../inst/include/dplyr/main.h:6:
In file included from ../inst/include/dplyr/workarounds/static_assert.h:17:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config.hpp:57:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/platform/macos.hpp:28:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/detail/posix_features.hpp:18:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/unistd.h:658:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/gethostuuid.h:39:17: error: C++ requires a type specifier for all declarations
int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);
                ^
In file included from RcppExports.cpp:4:
In file included from ./../inst/include/dplyr.h:4:
In file included from ../inst/include/dplyr/main.h:6:
In file included from ../inst/include/dplyr/workarounds/static_assert.h:17:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config.hpp:57:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/platform/macos.hpp:28:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/detail/posix_features.hpp:18:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/unistd.h:665:27: error: unknown type name 'uuid_t'; did you mean 'uid_t'?
int      getsgroups_np(int *, uuid_t);
                              ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here
typedef __darwin_uid_t        uid_t;
                              ^
In file included from RcppExports.cpp:4:
In file included from ./../inst/include/dplyr.h:4:
In file included from ../inst/include/dplyr/main.h:6:
In file included from ../inst/include/dplyr/workarounds/static_assert.h:17:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config.hpp:57:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/platform/macos.hpp:28:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/detail/posix_features.hpp:18:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/unistd.h:667:27: error: unknown type name 'uuid_t'; did you mean 'uid_t'?
int      getwgroups_np(int *, uuid_t);
                              ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here
typedef __darwin_uid_t        uid_t;
                              ^
In file included from RcppExports.cpp:4:
In file included from ./../inst/include/dplyr.h:4:
In file included from ../inst/include/dplyr/main.h:6:
In file included from ../inst/include/dplyr/workarounds/static_assert.h:17:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config.hpp:57:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/platform/macos.hpp:28:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/detail/posix_features.hpp:18:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/unistd.h:730:31: error: unknown type name 'uuid_t'; did you mean 'uid_t'?
int      setsgroups_np(int, const uuid_t);
                                  ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here
typedef __darwin_uid_t        uid_t;
                              ^
In file included from RcppExports.cpp:4:
In file included from ./../inst/include/dplyr.h:4:
In file included from ../inst/include/dplyr/main.h:6:
In file included from ../inst/include/dplyr/workarounds/static_assert.h:17:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config.hpp:57:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/platform/macos.hpp:28:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/detail/posix_features.hpp:18:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/unistd.h:732:31: error: unknown type name 'uuid_t'; did you mean 'uid_t'?
int      setwgroups_np(int, const uuid_t);
                                  ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here
typedef __darwin_uid_t        uid_t;
                              ^
In file included from RcppExports.cpp:5:
In file included from ./../inst/include/dplyr_types.h:4:
In file included from ../inst/include/dplyr/data/GroupedDataFrame.h:8:
In file included from ../inst/include/tools/SymbolMap.h:4:
In file included from ../inst/include/tools/hash.h:10:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/unordered_map.hpp:17:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/unordered/unordered_map.hpp:19:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/move/move.hpp:30:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/move/iterator.hpp:27:
/usr/local/lib/R/3.6/site-library/BH/include/boost/move/detail/iterator_traits.hpp:29:1: warning: inline namespaces are a C++11 feature [-Wc++11-inline-namespace]
BOOST_MOVE_STD_NS_BEG
^
/usr/local/lib/R/3.6/site-library/BH/include/boost/move/detail/std_ns_begin.hpp:18:34: note: expanded from macro 'BOOST_MOVE_STD_NS_BEG'
   #define BOOST_MOVE_STD_NS_BEG _LIBCPP_BEGIN_NAMESPACE_STD
                                 ^
/Library/Developer/CommandLineTools/usr/include/c++/v1/__config:506:52: note: expanded from macro '_LIBCPP_BEGIN_NAMESPACE_STD'
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
                                                   ^
1 warning and 5 errors generated.
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package ‘dplyr’
* removing ‘/usr/local/lib/R/3.6/site-library/dplyr’
Warning in install.packages :
  installation of package ‘dplyr’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/jd/7g7779md60n6sx447tymjbr80000gn/T/Rtmpb1kNeO/downloaded_packages’

This is a classic MAC OS problem.

R packages come in two flavors, binary and source. The binaries are no-muss, no-fuss. The sources are dodgy.

The reason is that compilation is required, and Apple's toolbox is non-standard, so compilation often, but not always, fails.

Usually, you can get around this by running install again, and when given the option to install the later version from source, choose "no." The new version will show up as a binary within 7-10 days, usually. Thank to Saint Simon Urbanek of the R Core Team who is the world's leading expert on this process.

Glad I'm not the only one. Any other solutions? Running install again doesn't help.

2 Likes

Hi, and welcome!

Did you take the option to "install from source?" If so, failure is the inevitable result.

When you have coding questions, please see the FAQ: What's a reproducible example (`reprex`) and how do I do one? Using a reprex, complete with representative data will attract quicker and more answers.

I still get the error even when I use the option type='no'. type='binary' throws an error.

I've tried downloading the binary files, but that's also not working.

I think there's a similar issue with readr.

Do you have any clarifications to your suggestion?

1 Like

Sorry that I was unclear. Source may work but it often fails; binary almost never fails unless, for example, it has a version dependency issue on other package.

Here's an explainer:

On macOS, packages sometimes fail to install, often with a non-zero exit status message. This is due to Apple's idiosyncratic compiler. The same packages will install on most Linux systems without trouble. Saint Simon Urbanek of the R Core Development Team takes on the brain damage required to recode the source to get around macOS's peculiar worldview for those in CRAN, but he can't bestow the same mercy on those still in development.

Some packages will successfully install through compilation from source, but many won't.

When installing if you are offered the option to install from source, it makes sense to try it once. But, if at first it doesn't succeed, in all likelihood it never will. It's usually only 7-10 days until a macOS binary is available

The first answer to do you want to install from source is always yes, but only on the first attempt. If it works, great; if it fails go for the less recent version in binary source is available by selection n

Ok, so having tried to install from source, and been unable to install from binary, is there any other thing that I should try?

I saw a post about potentially changing a header file which might be what's throwing the uuid error.

That error

/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/unistd.h:667:27: error: unknown type name 'uuid_t'; did you mean 'uid_t'?
int      getwgroups_np(int *, uuid_t)

is almost certainly due to the problem with osMAC's compiler and environment.

Here's what it looks like on sf, which I can't install from source, but can from binary.

  There is a binary version available but the source version is later:
   binary source needs_compilation
sf  0.8-1  0.9-1              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel)

When I respond yes, I get a long list of compilation steps ending in

ERROR: configuration failed for package ‘sf’

But when I choose no

  There is a binary version available but the source version is later:
   binary source needs_compilation
sf  0.8-1  0.9-1              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) no
trying URL 'https://ftp.osuosl.org/pub/cran/bin/macosx/el-capitan/contrib/3.6/sf_0.8-1.tgz'
Content type 'application/x-gzip' length 64283240 bytes (61.3 MB)
==================================================
downloaded 61.3 MB


The downloaded binary packages are in
	/var/folders/vw/p54wdfm95lq9wf8jkwxg_qpw0000gp/T//RtmpS0cOMY/downloaded_packages
> library(sf)
Linking to GEOS 3.7.2, GDAL 2.4.2, PROJ 5.2.0
> 

bliss ensues.

Are you certain you can't install from binary?

Well, I'm not certain that I can't. Just that type = 'binary' throws an error, and type = 'no' only works occasionally, and it hasn't successfully installed.

I was able to download the OsX binary, but don't know how to install it. Rstudio seems to be looking for a tar.gz file.

What is the binary error?

After downloading a binary, there's nothing more needed except to

library(the_binary_version_of_the_package)

in an R console session, either in the pane on RStudio or using the special macOS GUI from CRAN, you can see success if the following line is simply

>

Where would I put the package I downloaded then?

> install.packages("dplyr", type='binary')
Error in install.packages : type 'binary' is not supported on this platform
> install.packages("dplyr", repo = 'https://mac.R-project.org', type= 'binary')
Error in install.packages : type 'binary' is not supported on this platform
> install.packages("~/Downloads/dplyr_0.8.5.tar.gz", repos = NULL, type = "no")
Installing package into ‘/usr/local/lib/R/3.6/site-library’
(as ‘lib’ is unspecified)
* installing *source* package ‘dplyr’ ...
** package ‘dplyr’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang++ -I"/usr/local/Cellar/r/3.6.3_1```

and on to the same error as before.

Ah! There it is!

brew is wonderful and I love it to pieces; no program can do it all, however, and brew is not as wonderful as a package manager for R as it is with almost everything else it can be used for.

Here's the fix.

brew uninstall R

go to the CRAN site and click through to MacOS and download the pkg file and install normally. The regular package will work, and the notarized package may work on Mojave; when you upgrade to Catalina only the notarized package will work.

Come on back if you continue to have problems on these issues. Start a new post on other questions.

Good luck!

I am pretty sure that I already did that, (I know I uninstalled R and installed it from online). But I will try it again.

Let everyone know when you get it working. I admit that I don't always check that I've uninstalled something with brew uninstall and it seems always to cause $PATH problems when I don't.

The uninstall/reinstall does not appear to have changed anything.

Let's keep working the problem, then.

Just in case I was being unclear by uninstall you mean

brew uninstall R

and by reinstall you mean from the CRAN site installer and not

brew install R

Right?

Yup, I uninstalled through brew, and then reinstalled through the installer.

After that, I used Rstudio to try to install dplyr.

Sorry I blew past this

install.packages("dplyr", type='binary)

just try

library(dplyr)

install.packages("dplyr", type='binary')
Error in install.packages : type 'binary' is not supported on this platform
Warning message:
In .rs.normalizePath(libPaths) :
path[2]="/usr/local/Cellar/r/3.6.3_1/lib/R/library": No such file or directory

I could put the binary file I have downloaded into that file?

You could, but that will mean that you will have to do it every time if we don't fix the

path[2]="/usr/local/Cellar/r/3.6.3_1/lib/R/library": No such file or directory

error. Could you try

install.packages("dplyr")  # WITHOUT the type = 'binary')

and from the terminal cut and paste the result of

$ echo $PATH

please?