First time using Shiny, I am able to install shiny but cannot import. I get the following error: Error in library(shiny) : there is no package called ‘shiny’

Hi,

i'm fairly new to R and totally new to Shiny, I can't get started with shiny because when I run

library(shiny) 

I get the error: Error in library(shiny) : there is no package called ‘shiny’

I have already installed shiny

there must be something very basic I am getting wrong but I cannot work it out! How do I get Shiny to import?

I have also noticed that I am getting this type of error in the console after I install shiny:
Warning in install.packages : installation of package ‘shiny’ had non-zero exit status

So one of the dependicies is failing to install ... usually at the top of install.packages("shiny")'s output it will say something like:

"also installing the dependencies ‘BH’, ‘base64enc’, ‘magrittr’, ‘httpuv’, ‘mime’, ‘xtable’, ‘digest’, ‘htmltools’, ‘sourcetools’, ‘later’, ‘promises’, ‘crayon’, ‘rlang’, ‘fastmap’, ‘withr’, ‘commonmark’, ‘glue’"

One of those is the problem ... install them one-by-one until you get a failure with a helpful error message.

Usually after getting a failure, its the first one in the list as the dependencies before it have installed correctly.

base64enc was the first to return an error. This is what came up in the console:

install.packages('base64enc')
trying URL 'https://cran.rstudio.com/src/contrib/base64enc_0.1-3.tar.gz'
Content type 'application/x-gzip' length 7833 bytes
==================================================
downloaded 7833 bytes

  • installing source package ‘base64enc’ ...
    ** package ‘base64enc’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** libs
    x86_64-apple-darwin13.4.0-clang -I"/opt/anaconda3/envs/R/lib/R/include" -DNDEBUG -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -I/opt/anaconda3/envs/R/include -fPIC -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/opt/anaconda3/envs/R/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1 -fdebug-prefix-map=/opt/anaconda3/envs/R=/usr/local/src/conda-prefix -c base64.c -o base64.o
    x86_64-apple-darwin13.4.0-clang -I"/opt/anaconda3/envs/R/lib/R/include" -DNDEBUG -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -I/opt/anaconda3/envs/R/include -fPIC -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/opt/anaconda3/envs/R/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1 -fdebug-prefix-map=/opt/anaconda3/envs/R=/usr/local/src/conda-prefix -c uriencode.c -o uriencode.o
    x86_64-apple-darwin13.4.0-clang -I"/opt/anaconda3/envs/R/lib/R/include" -DNDEBUG -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -I/opt/anaconda3/envs/R/include -fPIC -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/opt/anaconda3/envs/R/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1 -fdebug-prefix-map=/opt/anaconda3/envs/R=/usr/local/src/conda-prefix -c utf8.c -o utf8.o
    x86_64-apple-darwin13.4.0-clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/opt/anaconda3/envs/R/lib/R/lib -Wl,-dead_strip_dylibs -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/opt/anaconda3/envs/R/lib -L/opt/anaconda3/envs/R/lib -o base64enc.dylib base64.o uriencode.o utf8.o -L/opt/anaconda3/envs/R/lib/R/lib -lR -Wl,-framework -Wl,CoreFoundation
    ld: warning: -pie being ignored. It is only used when linking a main executable
    ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd' for architecture x86_64
    clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [/opt/anaconda3/envs/R/lib/R/share/make/shlib.mk:6: base64enc.dylib] Error 1
    ERROR: compilation failed for package ‘base64enc’
  • removing ‘/opt/anaconda3/envs/R/lib/R/library/base64enc’
  • restoring previous ‘/opt/anaconda3/envs/R/lib/R/library/base64enc’
    Warning in install.packages :
    installation of package ‘base64enc’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/fz/zfqth6vj5pg53tvvx6yvxclc0000gq/T/RtmpOVW0yE/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done

Ive noticed that base64enc is in my package library, shiny is not, base64enc was the first of the packages on the list that returned the 'non-zero exit status error though

Shiny is requiring an updated version of base64enc ... that's why its installing it as a dependency.

I was hoping for a more helpful error (they're common in linux), but instead all you're getting is clang-10: error: linker command failed with exit code 1.

Googling it has gotten me nowhere ... you need a macOS expert at this point.

As an apple/macosx user, if you are installing packages and are prompted to choose between a binary or compiling from source, my advice to you is avoid souce and go binary thereby avoiding compilation issues...
if you must compile for source then you need to add utilitise to your macosx, in particular I think xcode is required.

I have installed Xcode in the terminal and I have already tried installing shiny with something like the following:

install.packages('shiny' ,  ... = binary)

this was suggested on another thread, I can't remember what was in the ellipsis, but it didn't work.

I will send a question to the iMac support community, as I am not savvy, how would either of you

the syntax for binary would be

install.packages("shiny", type="binary")

worth a try

im afraid that's the one that I have already used, I'll give it another go.

This is what returns:

Error in install.packages : type 'binary' is not supported on this platform

based on the information at
CRAN - Shiny
can you try ?

install.packages("https://cran.r-project.org/bin/macosx/contrib/4.0/shiny_1.5.0.tgz",repos=NULL)

thankyou so much this worked!

please could you explain why this works!?

oh wait, now I get this error when I try to import:

Error: package or namespace load failed for ‘shiny’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘htmltools’ 0.3.6 is being loaded, but >= 0.4.0.9003 is required
In addition: Warning message:
package ‘shiny’ was built under R version 4.0.2

I tried to update htmltools along with all of the rest of the packages but its now deleted loads of packages that I had before, here is just some of the return:

RROR: dependencies ‘diffobj’, ‘rematch2’, ‘tibble’ are not available for package ‘waldo’
* removing ‘/opt/anaconda3/envs/R/lib/R/library/waldo’
Warning in install.packages :
  installation of package ‘waldo’ had non-zero exit status
ERROR: dependencies ‘dplyr’, ‘lifecycle’, ‘tibble’, ‘tidyselect’, ‘blob’ are not available for package ‘dbplyr’
* removing ‘/opt/anaconda3/envs/R/lib/R/library/dbplyr’
Warning in install.packages :
  installation of package ‘dbplyr’ had non-zero exit status
ERROR: dependencies ‘forcats’, ‘hms’, ‘readr’, ‘tibble’, ‘tidyselect’, ‘vctrs’ are not available for package ‘haven’
* removing ‘/opt/anaconda3/envs/R/lib/R/library/haven’
Warning in install.packages :
  installation of package ‘haven’ had non-zero exit status
ERROR: dependencies ‘dplyr’, ‘tibble’, ‘tidyselect’, ‘vctrs’, ‘lifecycle’ are not available for package ‘tidyr’
* removing ‘/opt/anaconda3/envs/R/lib/R/library/tidyr’
Warning in install.packages :
  installation of package ‘tidyr’ had non-zero exit status
ERROR: dependencies ‘brio’, ‘lifecycle’, ‘pkgload’, ‘waldo’ are not available for package ‘testthat’
* removing ‘/opt/anaconda3/envs/R/lib/R/library/testthat’
Warning in install.packages :
  installation of package ‘testthat’ had non-zero exit status
ERROR: dependencies ‘dplyr’, ‘tibble’, ‘tidyr’ are not available for package ‘broom’
* removing ‘/opt/anaconda3/envs/R/lib/R/library/broom’
Warning in install.packages :
  installation of package ‘broom’ had non-zero exit status
ERROR: dependencies ‘dplyr’, ‘lifecycle’, ‘tibble’, ‘tidyr’, ‘tidyselect’ are not available for package ‘recipes’
* removing ‘/opt/anaconda3/envs/R/lib/R/library/recipes’
Warning in install.packages :
  installation of package ‘recipes’ had non-zero exit status
ERROR: dependencies ‘dplyr’, ‘dbplyr’, ‘lifecycle’, ‘tibble’, ‘tidyr’, ‘tidyselect’, ‘vctrs’ are not available for package ‘sparklyr’
* removing ‘/opt/anaconda3/envs/R/lib/R/library/sparklyr’
Warning in install.packages :
  installation of package ‘sparklyr’ had non-zero exit status
ERROR: dependency ‘testthat’ is not available for package ‘isoband’
* removing ‘/opt/anaconda3/envs/R/lib/R/library/isoband’
Warning in install.packages :
  installation of package ‘isoband’ had non-zero exit status
ERROR: dependencies ‘broom’, ‘tibble’, ‘tidyr’, ‘tidyselect’, ‘vctrs’ are not available for package ‘modelr’
* removing ‘/opt/anaconda3/envs/R/lib/R/library/modelr’
Warning in install.packages :
  installation of package ‘modelr’ had non-zero exit status
ERROR: dependencies ‘isoband’, ‘scales’, ‘tibble’ are not available for package ‘ggplot2’
* removing ‘/opt/anaconda3/envs/R/lib/R/library/ggplot2’
Warning in install.packages :
  installation of package ‘ggplot2’ had non-zero exit status
ERROR: dependencies ‘ggplot2’, ‘recipes’, ‘pROC’ are not available for package ‘caret’
* removing ‘/opt/anaconda3/envs/R/lib/R/library/caret’
Warning in install.packages :
  installation of package ‘caret’ had non-zero exit status
ERROR: dependencies ‘broom’, ‘dbplyr’, ‘dplyr’, ‘forcats’, ‘ggplot2’, ‘haven’, ‘hms’, ‘modelr’, ‘pillar’, ‘readr’, ‘tibble’, ‘tidyr’ are not available for package ‘tidyverse’
* removing ‘/opt/anaconda3/envs/R/lib/R/library/tidyverse’
Warning in install.packages :
  installation of package ‘tidyverse’ had non-zero exit status

to top it all off, shiny still doesn't install and htmltools is still not updated .... :persevere:

Im not a mac user nor an anaconda user myself, so perhaps I should go away...
but I have heard it said that the combination of R/anaconda on macosx, might have some complications.
Perhaps consider using r on your mac without anaconda?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.