"Unable to determine the source location for some packages" for specific packages

I'm trying to deploy a shiny app on shinyapps.io with RStudio.
It includes the package flipDimensionReduction, installed from github.
I always get the same warning as follows:

Unable to determine the source location for some packages. Packages
should be installed from a package repository like CRAN or a version
control system. Check that options('repos') refers to a package
repository containing the needed package versions.

and the same error as follows:

...[omitted]...
[2023-01-22... ] Building R package: rhtmlMoonPlot (1.0.1)
/mnt/packages/build /mnt
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called ‘htmlwidgets’
Calls: ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
Warning in untar2(tarfile, files, list, exdir, restore_times) :
skipping pax global extended headers
installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *source* package ‘rhtmlMoonPlot’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
ERROR: lazy loading failed for package ‘rhtmlMoonPlot’
* removing ‘/opt/R/4.2.2/lib/R/library/rhtmlMoonPlot’

The package rhtmlMoonPlotis used in a function in flipDimensionReduction.

This error is reproduced by adding library(flipDimensionReduction) (or library(rhtmlMoonPlot)) to any app.R and deploying it to shinyapps.

Any suggestions to avoid this error
Thanks in advance!

This error is likely caused by the fact that the package rhtmlMoonPlot is not available on the CRAN repository, which is the default package repository used by shinyapps.io. To fix this, you will need to make the package available to the shinyapps.io server by including it in the dependencies field of the app.R file.

You can do this by adding the following code snippet to the top of your app.R file:

Copy code

if (!require("devtools")) install.packages("devtools")
devtools::install_github("username/repo", dependencies = TRUE)

Make sure you replace username and repo with the appropriate values for the package you want to install.

Additionally, you will need to include the package in your library() calls in your app.R file.

Alternatively, you can include the package in a install.R file that runs before your app.R file. This file should contain the following code snippet:

Copy code

if (!require("devtools")) install.packages("devtools")
devtools::install_github("username/repo", dependencies = TRUE)

This will install the package and its dependencies before the app runs and will make the package available to the shinyapps.io server.

You should also check the version of packages used in your R environment with the one used in shinyapps.io, it may cause conflict between versions.

Just to clarify, shinyapps.io uses the Posit Package Manager as it's package repository.

When you deploy a shiny app rsconnect tries to replicate the app environment by identifying the package installation source and its version so they should be the same or the process would simply fail.

Thank you, @joanmils !
I'm sorry but the snippet didn't work for my app.
I tried what you wrote, but I got the same warning and error as before...

By the way, I forgot to attach some lines of the error. Sorry.

################################# End Task Log #################################
error : Unhandled Exception: Child Task 1266803705 failed: Error building image: Error building rhtmlMoonPlot (1.0.1). Build exited with non-zero status: 1
Execution halted

I think this implies rsconnect is accurately detecting the package source (GitHub) so there should be no need to force the install but for some reason the installation process is skipping the htmlwidges dependency.

Try adding an explicit library call to htmlwidges before the call for rhtmlMoonPlot that way you will trigger the install of the dependency.

Thank you, @andresrcs!
Indeed, the app.R contains explicit calls to the packages, shiny, htmlwidgets, flipDimensionReduction and rhtmlMoonPlot like...

library(shiny)
library(htmlwidgets)
library(flipDimensionReduction)
library(rhtmlMoonPlot)

The latter 2 packages were downloaded from GitHub.
I tried deploying after re-installing htmlwidgets both from CRAN and GitHub,
but neither worked.

Did you get any different error messages? Can you show a complete deployment log?

Thanks again! And Sorry, the posts weren't detailed enough.
The error massage doesn't change.

The entire log is as follows:

Preparing to deploThis text will be hiddeny application...DONE
Uploading bundle for application: 8094211... arning:
* May be unable to deploy package dependency 'RGoogleAnalytics'; could
not determine a repository URL for the source 'CRAN'.

* Unable to determine the source location for some packages. Packages
should be installed from a package repository like CRAN or a version
control system. Check that options('repos') refers to a package
repository containing the needed package versions.
DONE
Deploying bundle: 6768418 for application: 8094211 ...
Waiting for task: 1267099683
building: Parsing manifest
building: Building image: 7980464
building: Installing system dependencies
building: Fetching packages
building: Building package: rhtmlMoonPlot
################################ Begin Task Log ################################
[2023-01-24T13:32:08.789112651+0000] Execute script: packages/build/gmp.sh
+ set -e
\ ++ lsb_release -cs
+ OS_CODENAME=focal
\ + apt-get update -qq
\ + '[' focal == xenial ']'
+ apt-get install -y libgmp-dev
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
libgmpxx4ldbl
Suggested packages:
gmp-doc libgmp10-doc libmpfr-dev
The following NEW packages will be installed:
libgmp-dev libgmpxx4ldbl
0 upgraded, 2 newly installed, 0 to remove and 60 not upgraded.
Need to get 330 kB of archives.
After this operation, 1786 kB of additional disk space will be used.
Get:1 ttp://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 libgmpxx4ldbl amd64 2:6.2.0+dfsg-4ubuntu0.1 [9144 B]
Get:2 ttp://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 libgmp-dev amd64 2:6.2.0+dfsg-4ubuntu0.1 [320 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 330 kB in 0s (11.0 MB/s)
Selecting previously unselected package libgmpxx4ldbl:amd64.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 237921 files and directories currently installed.)
Preparing to unpack .../libgmpxx4ldbl_2%3a6.2.0+dfsg-4ubuntu0.1_amd64.deb ...
Unpacking libgmpxx4ldbl:amd64 (2:6.2.0+dfsg-4ubuntu0.1) ...
Selecting previously unselected package libgmp-dev:amd64.
Preparing to unpack .../libgmp-dev_2%3a6.2.0+dfsg-4ubuntu0.1_amd64.deb ...
Unpacking libgmp-dev:amd64 (2:6.2.0+dfsg-4ubuntu0.1) ...
Setting up libgmpxx4ldbl:amd64 (2:6.2.0+dfsg-4ubuntu0.1) ...
Setting up libgmp-dev:amd64 (2:6.2.0+dfsg-4ubuntu0.1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...
[2023-01-24T13:32:12.698051405+0000] Execute script: packages/build/Rmpfr.sh
+ set -e
+ apt-get update -qq
+ apt-get install -y libmpfr-dev
Reading package lists...
Building dependency tree...
Reading state information...
Suggested packages:
libmpfr-doc
The following NEW packages will be installed:
libmpfr-dev
0 upgraded, 1 newly installed, 0 to remove and 60 not upgraded.
Need to get 240 kB of archives.
After this operation, 1221 kB of additional disk space will be used.
Get:1 ttp://us-east-1.ec2.archive.ubuntu.com/ubuntu focal/main amd64 libmpfr-dev amd64 4.0.2-1 [240 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 240 kB in 0s (13.9 MB/s)
Selecting previously unselected package libmpfr-dev:amd64.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 237941 files and directories currently installed.)
Preparing to unpack .../libmpfr-dev_4.0.2-1_amd64.deb ...
Unpacking libmpfr-dev:amd64 (4.0.2-1) ...
Setting up libmpfr-dev:amd64 (4.0.2-1) ...
[2023-01-24T13:32:23.526420473+0000] Installing R package: DBI (1.1.3)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘DBI’ ...
* DONE (DBI)
[2023-01-24T13:32:23.901708465+0000] Installing R package: ECOSolveR (0.5.4)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘ECOSolveR’ ...
* DONE (ECOSolveR)
[2023-01-24T13:32:24.286789941+0000] Installing R package: Formula (1.2-4)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘Formula’ ...
* DONE (Formula)
[2023-01-24T13:32:24.618877972+0000] Installing R package: GPArotation (2022.10-2)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘GPArotation’ ...
* DONE (GPArotation)
[2023-01-24T13:32:24.966314595+0000] Installing R package: MASS (7.3-58.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘MASS’ ...
* DONE (MASS)
[2023-01-24T13:32:25.416572831+0000] Installing R package: R6 (2.5.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘R6’ ...
* DONE (R6)
[2023-01-24T13:32:25.758124173+0000] Installing R package: RColorBrewer (1.1-3)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘RColorBrewer’ ...
* DONE (RColorBrewer)
[2023-01-24T13:32:26.107521532+0000] Installing R package: Rcpp (1.0.10)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘Rcpp’ ...
* DONE (Rcpp)
[2023-01-24T13:32:27.278604621+0000] Installing R package: abind (1.4-5)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘abind’ ...
* DONE (abind)
[2023-01-24T13:32:27.622430736+0000] Installing R package: backports (1.4.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘backports’ ...
* DONE (backports)
[2023-01-24T13:32:27.948525749+0000] Installing R package: base64enc (0.1-3)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘base64enc’ ...
* DONE (base64enc)
[2023-01-24T13:32:28.288657728+0000] Installing R package: bit (4.0.5)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘bit’ ...
* DONE (bit)
[2023-01-24T13:32:28.680207999+0000] Installing R package: boot (1.3-28)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘boot’ ...
* DONE (boot)
[2023-01-24T13:32:29.046706367+0000] Installing R package: brio (1.1.3)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘brio’ ...
* DONE (brio)
[2023-01-24T13:32:29.371770310+0000] Installing R package: ca (0.71.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘ca’ ...
* DONE (ca)
[2023-01-24T13:32:29.723714170+0000] Installing R package: cli (3.6.0)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘cli’ ...
* DONE (cli)
[2023-01-24T13:32:30.149887655+0000] Installing R package: clipr (0.8.0)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘clipr’ ...
* DONE (clipr)
[2023-01-24T13:32:30.504045643+0000] Installing R package: cluster (2.1.4)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘cluster’ ...
* DONE (cluster)
[2023-01-24T13:32:30.886926909+0000] Installing R package: codetools (0.2-18)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘codetools’ ...
* DONE (codetools)
[2023-01-24T13:32:31.226668671+0000] Installing R package: colorRamps (2.3.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘colorRamps’ ...
* DONE (colorRamps)
[2023-01-24T13:32:31.551031953+0000] Installing R package: colorspace (2.1-0)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘colorspace’ ...
* DONE (colorspace)
[2023-01-24T13:32:32.072190159+0000] Installing R package: commonmark (1.8.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘commonmark’ ...
* DONE (commonmark)
[2023-01-24T13:32:32.445844895+0000] Installing R package: cpp11 (0.4.3)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘cpp11’ ...
* DONE (cpp11)
[2023-01-24T13:32:32.822466177+0000] Installing R package: crayon (1.5.2)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘crayon’ ...
* DONE (crayon)
[2023-01-24T13:32:33.146575369+0000] Installing R package: curl (5.0.0)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘curl’ ...
* DONE (curl)
[2023-01-24T13:32:33.539011198+0000] Installing R package: data.table (1.14.6)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘data.table’ ...
* DONE (data.table)
[2023-01-24T13:32:34.102143558+0000] Installing R package: deldir (1.0-6)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘deldir’ ...
* DONE (deldir)
[2023-01-24T13:32:34.489328280+0000] Installing R package: digest (0.6.31)
* installing to library ‘/opt/R/4.2.2/lib/R/library���
* installing binary package ‘digest’ ...
* DONE (digest)
[2023-01-24T13:32:34.876451712+0000] Installing R package: evaluate (0.20)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘evaluate’ ...
* DONE (evaluate)
[2023-01-24T13:32:35.194322537+0000] Installing R package: fansi (1.0.4)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘fansi’ ...
* DONE (fansi)
[2023-01-24T13:32:35.541668742+0000] Installing R package: farver (2.1.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘farver’ ...
* DONE (farver)
[2023-01-24T13:32:36.080192581+0000] Installing R package: fastmap (1.1.0)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘fastmap’ ...
* DONE (fastmap)
[2023-01-24T13:32:36.424622112+0000] Installing R package: flipU (1.5.5)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘flipU’ ...
* DONE (flipU)
[2023-01-24T13:32:36.763767536+0000] Installing R package: foreign (0.8-83)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘foreign’ ...
* DONE (foreign)
[2023-01-24T13:32:37.129879894+0000] Installing R package: fs (1.6.0)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘fs’ ...
* DONE (fs)
[2023-01-24T13:32:37.509855459+0000] Installing R package: generics (0.1.3)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘generics’ ...
* DONE (generics)
[2023-01-24T13:32:37.826984931+0000] Installing R package: git2r (0.30.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘git2r’ ...
* DONE (git2r)
[2023-01-24T13:32:38.376863323+0000] Installing R package: glue (1.6.2)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘glue’ ...
* DONE (glue)
[2023-01-24T13:32:38.713479813+0000] Installing R package: gmp (0.6-10)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘gmp’ ...
* DONE (gmp)
[2023-01-24T13:32:39.120467241+0000] Installing R package: gtable (0.3.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘gtable’ ...
* DONE (gtable)
[2023-01-24T13:32:39.450057288+0000] Installing R package: gtools (3.9.4)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘gtools’ ...
* DONE (gtools)
[2023-01-24T13:32:39.850458879+0000] Installing R package: hash (2.2.6.2)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘hash’ ...
* DONE (hash)
[2023-01-24T13:32:40.186254204+0000] Installing R package: icarus (0.3.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘icarus’ ...
* DONE (icarus)
[2023-01-24T13:32:40.625601303+0000] Installing R package: isoband (0.2.7)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘isoband’ ...
* DONE (isoband)
[2023-01-24T13:32:41.048543536+0000] Installing R package: jpeg (0.1-10)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘jpeg’ ...
* DONE (jpeg)
[2023-01-24T13:32:41.372405013+0000] Installing R package: jsonlite (1.8.4)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘jsonlite’ ...
* DONE (jsonlite)
[2023-01-24T13:32:41.779015547+0000] Installing R package: labeling (0.4.2)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘labeling’ ...
* DONE (labeling)
[2023-01-24T13:32:42.097604812+0000] Installing R package: lattice (0.20-45)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘lattice’ ...
* DONE (lattice)
[2023-01-24T13:32:42.485463179+0000] Installing R package: lazyeval (0.2.2)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘lazyeval’ ...
* DONE (lazyeval)
[2023-01-24T13:32:42.827807042+0000] Installing R package: leaflet.providers (1.9.0)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘leaflet.providers’ ...
* DONE (leaflet.providers)
[2023-01-24T13:32:43.147441295+0000] Installing R package: magrittr (2.0.3)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘magrittr’ ...
* DONE (magrittr)
[2023-01-24T13:32:43.491156639+0000] Installing R package: mime (0.12)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘mime’ ...
* DONE (mime)
[2023-01-24T13:32:43.811593535+0000] Installing R package: mnormt (2.1.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘mnormt’ ...
* DONE (mnormt)
[2023-01-24T13:32:44.148369697+0000] Installing R package: nnet (7.3-18)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘nnet’ ...
* DONE (nnet)
[2023-01-24T13:32:44.493698489+0000] Installing R package: numDeriv (2016.8-1.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘numDeriv’ ...
* DONE (numDeriv)
[2023-01-24T13:32:44.823663810+0000] Installing R package: pkgconfig (2.0.3)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘pkgconfig’ ...
* DONE (pkgconfig)
[2023-01-24T13:32:45.149396289+0000] Installing R package: png (0.1-8)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘png’ ...
* DONE (png)
[2023-01-24T13:32:45.476641649+0000] Installing R package: praise (1.0.0)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘praise’ ...
* DONE (praise)
[2023-01-24T13:32:45.796421241+0000] Installing R package: prettyunits (1.1.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘prettyunits’ ...
* DONE (prettyunits)
[2023-01-24T13:32:46.113523691+0000] Installing R package: ps (1.7.2)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘ps’ ...
* DONE (ps)
[2023-01-24T13:32:46.454038120+0000] Installing R package: rappdirs (0.3.3)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘rappdirs’ ...
* DONE (rappdirs)
[2023-01-24T13:32:46.776229354+0000] Installing R package: rematch (1.0.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing binary package ‘rematch’ ...
* DONE (rematch)
[2023-01-24T13:32:47.126699653+0000] Building R package: rhtmlMoonPlot (1.0.1)
/mnt/packages/build /mnt
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called ‘htmlwidgets’
Calls: ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
Warning in untar2(tarfile, files, list, exdir, restore_times) :
skipping pax global extended headers
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing source package ‘rhtmlMoonPlot’ ...
* using staged installation
* R
* inst
* byte-compile and prepare package for lazy loading
ERROR: lazy loading failed for package ‘rhtmlMoonPlot’
* removing ‘/opt/R/4.2.2/lib/R/library/rhtmlMoonPlot’
################################# End Task Log #################################
Error: Unhandled Exception: Child Task 1267099685 failed: Error building image: Error building rhtmlMoonPlot (1.0.1). Build exited with non-zero status: 1
Execution halted

Is this log with htmlwidgets installed from Github? Because the idea is to have htmlwidgets installed from the Posit Package Manager before the GitHub packages start to be compiled and it is not getting installed at all.

Can you make sure you have htmlwidgets installed from CRAN in your system (delete and reinstall if you can just to be dead sure), try to deploy again and post the deployment log again? BTW please post the console output as formatted code it makes things far easier to read. Here is how to do it:

Thanks for your advice!
I don't think the package was installed from GitHub, but I re-installed htmlwidgets from CRAN to be sure.
The error massage after the re-installation looks almost the same as before:

Preparing to deploy application...DONE
Uploading bundle for application: 8112685... 警告:  
* May be unable to deploy package dependency 'RGoogleAnalytics'; could
  not determine a repository URL for the source 'CRAN'.

* Unable to determine the source location for some packages. Packages
  should be installed from a package repository like CRAN or a version
  control system. Check that options('repos') refers to a package
  repository containing the needed package versions.
DONE
Deploying bundle: 6770725 for application: 8112685 ...
Waiting for task: 1267294816
  building: Parsing manifest
  building: Building image: 7984920
  building: Installing system dependencies
  building: Fetching packages
  building: Building package: rhtmlMoonPlot
################################ Begin Task Log ################################ 
[2023-01-25T01:39:24.461473426+0000] Execute script: packages/build/gmp.sh
+ set -e
++ lsb_release -cs
+ OS_CODENAME=focal
+ apt-get update -qq
+ '[' focal == xenial ']'
+ apt-get install -y libgmp-dev
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libgmpxx4ldbl
Suggested packages:
  gmp-doc libgmp10-doc libmpfr-dev
The following NEW packages will be installed:
  libgmp-dev libgmpxx4ldbl
0 upgraded, 2 newly installed, 0 to remove and 66 not upgraded.
Need to get 330 kB of archives.
After this operation, 1786 kB of additional disk space will be used.
Get:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 libgmpxx4ldbl amd64 2:6.2.0+dfsg-4ubuntu0.1 [9144 B]
Get:2 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 libgmp-dev amd64 2:6.2.0+dfsg-4ubuntu0.1 [320 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 330 kB in 0s (12.3 MB/s)
Selecting previously unselected package libgmpxx4ldbl:amd64.
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 237921 files and directories currently installed.)
Preparing to unpack .../libgmpxx4ldbl_2%3a6.2.0+dfsg-4ubuntu0.1_amd64.deb ...
Unpacking libgmpxx4ldbl:amd64 (2:6.2.0+dfsg-4ubuntu0.1) ...
Selecting previously unselected package libgmp-dev:amd64.
Preparing to unpack .../libgmp-dev_2%3a6.2.0+dfsg-4ubuntu0.1_amd64.deb ...
Unpacking libgmp-dev:amd64 (2:6.2.0+dfsg-4ubuntu0.1) ...
Setting up libgmpxx4ldbl:amd64 (2:6.2.0+dfsg-4ubuntu0.1) ...
Setting up libgmp-dev:amd64 (2:6.2.0+dfsg-4ubuntu0.1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...
[2023-01-25T01:39:51.058801082+0000] Execute script: packages/build/Rmpfr.sh
+ set -e
+ apt-get update -qq
+ apt-get install -y libmpfr-dev
Reading package lists...
Building dependency tree...
Reading state information...
Suggested packages:
  libmpfr-doc
The following NEW packages will be installed:
  libmpfr-dev
0 upgraded, 1 newly installed, 0 to remove and 66 not upgraded.
Need to get 240 kB of archives.
After this operation, 1221 kB of additional disk space will be used.
Get:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal/main amd64 libmpfr-dev amd64 4.0.2-1 [240 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 240 kB in 0s (12.0 MB/s)
Selecting previously unselected package libmpfr-dev:amd64.
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 237941 files and directories currently installed.)
Preparing to unpack .../libmpfr-dev_4.0.2-1_amd64.deb ...
Unpacking libmpfr-dev:amd64 (4.0.2-1) ...
Setting up libmpfr-dev:amd64 (4.0.2-1) ...
[2023-01-25T01:39:59.585336626+0000] Installing R package: DBI (1.1.3)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘DBI’ ...
* DONE (DBI)
[2023-01-25T01:39:59.961645422+0000] Installing R package: ECOSolveR (0.5.4)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘ECOSolveR’ ...
* DONE (ECOSolveR)
[2023-01-25T01:40:00.342601092+0000] Installing R package: Formula (1.2-4)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘Formula’ ...
* DONE (Formula)
[2023-01-25T01:40:00.679207526+0000] Installing R package: GPArotation (2022.10-2)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘GPArotation’ ...
* DONE (GPArotation)
[2023-01-25T01:40:01.020056354+0000] Installing R package: MASS (7.3-58.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘MASS’ ...
* DONE (MASS)
[2023-01-25T01:40:01.416511264+0000] Installing R package: R6 (2.5.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘R6’ ...
* DONE (R6)
[2023-01-25T01:40:01.746341968+0000] Installing R package: RColorBrewer (1.1-3)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘RColorBrewer’ ...
* DONE (RColorBrewer)
[2023-01-25T01:40:02.068544710+0000] Installing R package: Rcpp (1.0.10)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘Rcpp’ ...
* DONE (Rcpp)
[2023-01-25T01:40:03.242229449+0000] Installing R package: abind (1.4-5)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘abind’ ...
* DONE (abind)
[2023-01-25T01:40:03.562037405+0000] Installing R package: backports (1.4.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘backports’ ...
* DONE (backports)
[2023-01-25T01:40:03.890729644+0000] Installing R package: base64enc (0.1-3)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘base64enc’ ...
* DONE (base64enc)
[2023-01-25T01:40:04.211079952+0000] Installing R package: bit (4.0.5)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘bit’ ...
* DONE (bit)
[2023-01-25T01:40:04.595606999+0000] Installing R package: boot (1.3-28)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘boot’ ...
* DONE (boot)
[2023-01-25T01:40:04.960927290+0000] Installing R package: brio (1.1.3)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘brio’ ...
* DONE (brio)
[2023-01-25T01:40:05.287632881+0000] Installing R package: ca (0.71.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘ca’ ...
* DONE (ca)
[2023-01-25T01:40:05.619562751+0000] Installing R package: cli (3.6.0)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘cli’ ...
* DONE (cli)
[2023-01-25T01:40:06.035411152+0000] Installing R package: clipr (0.8.0)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘clipr’ ...
* DONE (clipr)
[2023-01-25T01:40:06.363414149+0000] Installing R package: cluster (2.1.4)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘cluster’ ...
* DONE (cluster)
[2023-01-25T01:40:06.739957890+0000] Installing R package: codetools (0.2-18)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘codetools’ ...
* DONE (codetools)
[2023-01-25T01:40:07.064271493+0000] Installing R package: colorRamps (2.3.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘colorRamps’ ...
* DONE (colorRamps)
[2023-01-25T01:40:07.383005943+0000] Installing R package: colorspace (2.1-0)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘colorspace’ ...
* DONE (colorspace)
[2023-01-25T01:40:07.908889088+0000] Installing R package: commonmark (1.8.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘commonmark’ ...
* DONE (commonmark)
[2023-01-25T01:40:08.285225324+0000] Installing R package: cpp11 (0.4.3)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘cpp11’ ...
* DONE (cpp11)
[2023-01-25T01:40:08.662112694+0000] Installing R package: crayon (1.5.2)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘crayon’ ...
* DONE (crayon)
[2023-01-25T01:40:08.996081567+0000] Installing R package: curl (5.0.0)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘curl’ ...
* DONE (curl)
[2023-01-25T01:40:09.392540424+0000] Installing R package: data.table (1.14.6)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘data.table’ ...
* DONE (data.table)
[2023-01-25T01:40:09.931726968+0000] Installing R package: deldir (1.0-6)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘deldir’ ...
* DONE (deldir)
[2023-01-25T01:40:10.311477385+0000] Installing R package: digest (0.6.31)
* installing to library ‘/opt/R/4.2.2/lib/R/library���
* installing *binary* package ‘digest’ ...
* DONE (digest)
[2023-01-25T01:40:10.676472288+0000] Installing R package: evaluate (0.20)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘evaluate’ ...
* DONE (evaluate)
[2023-01-25T01:40:11.001257975+0000] Installing R package: fansi (1.0.4)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘fansi’ ...
* DONE (fansi)
[2023-01-25T01:40:11.351978852+0000] Installing R package: farver (2.1.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘farver’ ...
* DONE (farver)
[2023-01-25T01:40:11.891598712+0000] Installing R package: fastmap (1.1.0)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘fastmap’ ...
* DONE (fastmap)
[2023-01-25T01:40:12.238214016+0000] Installing R package: flipU (1.5.5)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘flipU’ ...
* DONE (flipU)
[2023-01-25T01:40:12.558348537+0000] Installing R package: foreign (0.8-83)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘foreign’ ...
* DONE (foreign)
[2023-01-25T01:40:12.928664388+0000] Installing R package: fs (1.6.0)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘fs’ ...
* DONE (fs)
[2023-01-25T01:40:13.316681394+0000] Installing R package: generics (0.1.3)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘generics’ ...
* DONE (generics)
[2023-01-25T01:40:13.637599771+0000] Installing R package: git2r (0.30.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘git2r’ ...
* DONE (git2r)
[2023-01-25T01:40:14.196622627+0000] Installing R package: glue (1.6.2)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘glue’ ...
* DONE (glue)
[2023-01-25T01:40:14.535057179+0000] Installing R package: gmp (0.6-10)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘gmp’ ...
* DONE (gmp)
[2023-01-25T01:40:14.951948575+0000] Installing R package: gtable (0.3.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘gtable’ ...
* DONE (gtable)
[2023-01-25T01:40:15.286682104+0000] Installing R package: gtools (3.9.4)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘gtools’ ...
* DONE (gtools)
[2023-01-25T01:40:15.628544341+0000] Installing R package: hash (2.2.6.2)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘hash’ ...
* DONE (hash)
[2023-01-25T01:40:15.958921386+0000] Installing R package: icarus (0.3.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘icarus’ ...
* DONE (icarus)
[2023-01-25T01:40:16.388924132+0000] Installing R package: isoband (0.2.7)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘isoband’ ...
* DONE (isoband)
[2023-01-25T01:40:16.807042825+0000] Installing R package: jpeg (0.1-10)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘jpeg’ ...
* DONE (jpeg)
[2023-01-25T01:40:17.137197723+0000] Installing R package: jsonlite (1.8.4)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘jsonlite’ ...
* DONE (jsonlite)
[2023-01-25T01:40:17.575077993+0000] Installing R package: labeling (0.4.2)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘labeling’ ...
* DONE (labeling)
[2023-01-25T01:40:17.896409478+0000] Installing R package: lattice (0.20-45)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘lattice’ ...
* DONE (lattice)
[2023-01-25T01:40:18.283675872+0000] Installing R package: lazyeval (0.2.2)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘lazyeval’ ...
* DONE (lazyeval)
[2023-01-25T01:40:18.621090756+0000] Installing R package: leaflet.providers (1.9.0)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘leaflet.providers’ ...
* DONE (leaflet.providers)
[2023-01-25T01:40:18.942112704+0000] Installing R package: magrittr (2.0.3)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘magrittr’ ...
* DONE (magrittr)
[2023-01-25T01:40:19.288025454+0000] Installing R package: mime (0.12)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘mime’ ...
* DONE (mime)
[2023-01-25T01:40:19.607082514+0000] Installing R package: mnormt (2.1.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘mnormt’ ...
* DONE (mnormt)
[2023-01-25T01:40:19.942704486+0000] Installing R package: nnet (7.3-18)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘nnet’ ...
* DONE (nnet)
[2023-01-25T01:40:20.290085230+0000] Installing R package: numDeriv (2016.8-1.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘numDeriv’ ...
* DONE (numDeriv)
[2023-01-25T01:40:20.619406130+0000] Installing R package: pkgconfig (2.0.3)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘pkgconfig’ ...
* DONE (pkgconfig)
[2023-01-25T01:40:20.941466291+0000] Installing R package: png (0.1-8)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘png’ ...
* DONE (png)
[2023-01-25T01:40:21.270201010+0000] Installing R package: praise (1.0.0)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘praise’ ...
* DONE (praise)
[2023-01-25T01:40:21.590036638+0000] Installing R package: prettyunits (1.1.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘prettyunits’ ...
* DONE (prettyunits)
[2023-01-25T01:40:21.908291490+0000] Installing R package: ps (1.7.2)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘ps’ ...
* DONE (ps)
[2023-01-25T01:40:22.253028670+0000] Installing R package: rappdirs (0.3.3)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘rappdirs’ ...
* DONE (rappdirs)
[2023-01-25T01:40:22.575082079+0000] Installing R package: rematch (1.0.1)
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *binary* package ‘rematch’ ...
* DONE (rematch)
[2023-01-25T01:40:22.894608486+0000] Building R package: rhtmlMoonPlot (1.0.1)
/mnt/packages/build /mnt
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
  there is no package called ‘htmlwidgets’
Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
Warning in untar2(tarfile, files, list, exdir, restore_times) :
  skipping pax global extended headers
* installing to library ‘/opt/R/4.2.2/lib/R/library’
* installing *source* package ‘rhtmlMoonPlot’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
ERROR: lazy loading failed for package ‘rhtmlMoonPlot’
* removing ‘/opt/R/4.2.2/lib/R/library/rhtmlMoonPlot’
################################# End Task Log ################################# 
 エラー: Unhandled Exception: Child Task 1267294817 failed: Error building image: Error building rhtmlMoonPlot (1.0.1). Build exited with non-zero status: 1
 実行が停止されました Preformatted text

That is weird, I think the package repository for htmlwidgets is not being correctly detected by rsconnect for some reason, maybe related to these warnings:

Have you checked htmlwidgets is not installed in more than one library location? What is the output of running getOption("repos") in your system?

Yes, but to be sure, I re-run getOption("repos") and here is the result:

> getOption("repos")
                       CRAN 
"https://cran.rstudio.com/" 
attr(,"RStudio")
[1] TRUE

I found htmlwidgets is mentioned in rhtmlMoonPlot repository AND htmlwidgets repository by Displayr · GitHub.

From this and your reply , I thought rsconnect might detect two (or more?) sources, and one of them might be found within rhtmlMoonPlot. (I'm not sure this is possible)
To test the hypothesis, I removed both htmlwidgets and rhtmlMoonPlot from R, and re-installed rhtmlMoonPlot ONLY, and got the following error:

> devtools::install_github("Displayr/rhtmlMoonPlot",
+                          auth_token = "...",
+                          force = TRUE, dependencies = NA)
Downloading GitHub repo Displayr/rhtmlMoonPlot@HEAD
── R CMD build ──────────────────────────────────────────────────────────────────────────────────────────────────
✔  checking for file 'C:\Users\Keisuke\AppData\Local\Temp\Rtmpe8jKeO\remotes5905b5d57b0\Displayr-rhtmlMoonPlot-f2432ec/DESCRIPTION' ...
─  preparing 'rhtmlMoonPlot': (856ms)
✔  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
   Omitted 'LazyData' from DESCRIPTION
─  building 'rhtmlMoonPlot_1.0.1.tar.gz'
   
Installing package into ‘C:/Users/Keisuke/AppData/Local/R/win-library/4.2’ 
 (as ‘lib’ is not specified) 
* installing *source* package 'rhtmlMoonPlot' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
  there is no package called 'htmlwidgets'
Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
ERROR: lazy loading failed for package 'rhtmlMoonPlot'
* removing 'C:/Users/.../R/win-library/4.2/rhtmlMoonPlot'
Warning message:
In i.p(...) :
   installation of package ‘C:/Users/.../rhtmlMoonPlot_1.0.1.tar.gz’ had non-zero exit status

This looks very similar to the one we saw before.
But I'm not sure what this means. (My hypothesis seems to be wrong!)

I'm sorry but, as you see, I'm not quite sure what shiny and some related packages do to deploy an app.
If you need some more information, please let me know!

That is not what I meant, sorry for not being clear enough, I meant if it is installed in more than one of your .libPaths(), these are folders in your system where R packages get installed with different scopes. My suspicion was that in some of your lib paths, you have an htmlwidgets version that has been installed from GitHub or some other non-CRAN source and that is causing rsconnect to misidentify the package source.

By setting this you are skipping installing dependencies including htmlwidgets but it seems rhtmlMoonPlot doesn't even have all its dependencies properly declared, otherwise an installation would be triggered by rsconnect. You need to manually install it in all cases.

I'm getting out of ideas to try, it is hard to debug this sort of thing in your mind without access to the system. If I think of something else I'll get back to you.

1 Like

Thank you so much for your advice!

I would be really grateful if you could share a good idea to solve this problem.