Build error : Failed to retrieve package sources
Raymond-KT opened this issue · 5 comments
Hi, I appreciate your awesome bookdown package.
I have a deployment issue.
I tried to fix this error while 1 week, but I can't find a way to solve this problem.
2 weeks ago, I can deploy my book to the website below.
https://bookdown.org/yuaye_kt/io_methology/
when I deploy my bookdown, there was an error message below.
I didn't use foreign library, but there was a Build error (failed to retrieve package sources).
[Connect] 2021/04/18 08:51:49.500098452 curl: (22) The requested URL returned error: 404
[Connect] 2021/04/18 08:51:50.568753166 curl: HTTP 404 https://cran.rstudio.com//src/contrib/Archive/foreign/foreign_0.8-81.tar.gz
[Connect] 2021/04/18 08:51:50.568765704 curl: (22) The requested URL returned error: 404
[Connect] 2021/04/18 08:51:51.576547818 FAILED
[Connect] 2021/04/18 08:51:51.576451572 Error in getSourceForPkgRecord(pkgRecord, srcDir(project), availablePackagesSource(repos = repos), : Failed to retrieve package sources for foreign 0.8-81 from CRAN (internet connectivity issue?)
[Connect] 2021/04/18 08:51:51.576471446
[Connect] 2021/04/18 08:51:51.576523200 Unable to fully restore the R packages associated with this deployment.
[Connect] 2021/04/18 08:51:51.576524686 Please review the preceding messages to determine which package
[Connect] 2021/04/18 08:51:51.576536379 encountered installation difficulty and the cause of the failure.
[Connect] 2021/04/18 08:51:51.584796975 Warning message:
[Connect] 2021/04/18 08:51:51.584974807 In packrat::restore(overwrite.dirty = TRUE, prompt = FALSE, restart = FALSE) :
[Connect] 2021/04/18 08:51:51.584980515 The most recent snapshot was generated using R version 4.0.5
[Connect] 2021/04/18 08:51:51.577409218 Error code: r-package-not-available
[Connect] An R package required by the content cannot be found in the package repository.
[Connect] Possible causes:
[Connect] * The R package being installed is not available for the version of R configured at Connect.
[Connect] * The R package being installed is not available for linux.
[Connect] * The client computer that published the content is using a different package repository from the Connect server, and the R package being installed is not available in the repository configured at the Connect server.
[Connect] * The package repository moved to a new URL after the content was published, and Connect is now attempting to rebuild the environment using the old package repository URL.
[Connect]
[Connect] Possible solutions:
[Connect] * Install a version of R on the Connect server that matches the one being used by the client computer. You can identify the required R version from the deployment logs, which will contain an entry similar to this:
> Bundle requested R version 3.5.0; using /usr/lib/R/bin/R which has version 3.4.4
In this example, the client computer has R 3.5.0 and the Connect server has R version 3.4.4. The recommended solution would be to install R version 3.5.0 on the Connect server alonside the existing 3.4.4 installation.
[Connect] * Replace usage of Windows-specific R packages with ones available for linux.
[Connect] * Configure the client with a package repository that is accessible via http(s) from the Connect server, such as CRAN or RStudio Package Manager. Reinstall the affected packages from the new repository and publish the content again.
[Connect]
[Connect] References:
[Connect] * https://docs.rstudio.com/connect/admin/getting-started/#installation
[Connect] * https://support.rstudio.com/hc/en-us/articles/360004067074-Managing-Packages-with-RStudio
[Connect]
[Connect] 2021/04/18 08:51:51.577409218 Additional data:
[Connect] Repository: 'CRAN'
[Connect] Package: 'foreign'
[Connect] PackageVersion: '0.8-81'
[Connect] Found in the following log entry:
[Connect] 2021/04/18 08:51:51.576451572 Error in getSourceForPkgRecord(pkgRecord, srcDir(project), availablePackagesSource(repos = repos), : Failed to retrieve package sources for foreign 0.8-81 from CRAN (internet connectivity issue?)
[Connect] Build error: An R package required by the content cannot be found in the package repository. (r-package-not-available)
Site deployment failed with error: An R package required by the content cannot be found in the package repository. (r-package-not-available)
This error means that the package foreign has not been found during the deployment. 0.8-81 is the last CRAN version, so I am not sure why it goes look into Archive.
You may try again to republish after doing a install.packages("foreign")
locally. We will see if that was a timing issue on the server.
I didn't use foreign library, but there was a Build error (failed to retrieve package sources).
you may not use it directly but it could be a dependency of you package.
Just curious: are you aiming to publish the rendered book to bookdown.org ? Or publishing the source and build the book there ?
This error means that the package foreign has not been found during the deployment. 0.8-81 is the last CRAN version, so I am not sure why it goes look into Archive.
You may try again to republish after doing a
install.packages("foreign")
locally. We will see if that was a timing issue on the server.I didn't use foreign library, but there was a Build error (failed to retrieve package sources).
you may not use it directly but it could be a dependency of you package.
Just curious: are you aiming to publish the rendered book to bookdown.org ? Or publishing the source and build the book there ?
Thank you for your kind reply.
I'd already uninstalled/installed a foreign package, but the same error occurs again.
actually, I just want to share my source code with my colleagues.
I can't understand why the error occurs...T-T
actually, I just want to share my source code with my colleagues.
Sharing the source code happens usually in a source repo like Github or Gitlab. Bookdown.org will allow you to publish the book result. bookdown::publish_book()
should be enough to publish your rendered book.
I can't understand why the error occurs...T-T
This is a deployment error when your code try to be restore on the server. Currently you are publishing your all source code project, this means this include R and Rmd files that contains R code. When deploying rsconnect 📦 will be used and all your R package dependencies will be looked for. Direct and indirect dependencies. If you are not using directly foreign, it just means that this packages is used somewhere by one your are using.
One this search for dependencies is done, everything is sent to the server where the project tries to be restored in order to be executed. That is why it tries to install foreign there.
But I don't know why, it tries to restore by downloading the foreign package from the Archive and 0.8-81 is not in the Archive it is the last CRAN published version.
Which version of R are you using ?
Unfortunatly, this is not an issue with bookdown but rsconnect or packrat - or even something wrong with the CRAN mirror used.
Do you really need to publish the source code into bookdown.org for your need ? bookdown::publish_book()
should allow your to publish the rendered book only (_book
folder for example) to bookdown.org
This does not require any restoration of any R package.
Which version of R are you using ?
Oh I think I know now ! bookdown.org
does not have R 4.0+ installed yet. This means that some package that depends on R > 4.0.0 won't be able to be installed. This is the case of the foreign package.
https://cran.r-project.org/web/packages/foreign/index.html
So you won't be able to publish source code to bookdown.org that uses packages only available for R 4.0.0 and above.
You need to publish the output book only for now.
I'll move this to bookdown.org as this is an issue with our hosting service.
Thanks !