I'm trying to connect to a remoter server and getting the following error:
Error in sodium::auth_decrypt(encrypted, getkey(private), getkey(theirs)) :
is.raw(nonce) is not TRUE
In addition: Warning message:
In unserialize(rmsg) :
cannot unserialize ALTVEC object of class 'wrap_raw' from package 'base'; returning length zero vector
If I run the server with secure = FALSE everything works as expected. This is the dockerfile that i'm using to run the server:
FROM rocker/r-ubuntu:18.04
# Install dependencies
RUN apt-get update -qq && apt-get install -y \
libsodium-dev \
libxml2-dev \
libssl-dev \
libcurl4-openssl-dev \
r-cran-tidyverse \
r-cran-remotes \
r-cran-rstan \
r-cran-rstanarm \
r-cran-rstan \
&& install.r \
remoter \
sodium \
drat \
RcppArmadillo \
RcppEigen \
StanHeaders \
aws.signature \
aws.s3
COPY R/Makevars /root/.R/Makevars
RUN mkdir -p /root/.ssh
VOLUME [ "/root/.ssh" ]
CMD ["R", "-e", "remoter::server(port = 49152, secure = T, password=Sys.getenv('api_key'))"]
Is this a bug in the remoter package or am I doing something wrong?
Related
I'm trying to publish some panels on Shiny Server with Kubernetes, but I'm struggling with R packets that are not installed on the server.The panels are working on my test environment on AWS (without K8s). The error is below detailed.
> su: ignoring --preserve-environment, it’s mutually exclusive with --login
> Error in library(“shinyWidgets”) :
> there is no package called ‘shinyWidgets’
> Calls: runApp ... sourceUTF8 -> eval -> eval -> ..stacktraceon.. -> library
> Execution halted
As commented in the code, many alternative options to install the R packets were tried without success.
FROM rocker/shiny-verse:latest
USER root
# Finding required libraries. Libraries should be installed in /usr/share/doc
# pak::pkg_system_requirements(“dplyr”, “ubuntu”, “20.04")
# Packects should be installed in /usr/local/lib/R/site-library
# Install system requirements for index.R as needed
RUN apt-get update -qq \
&& apt-get -y --no-install-recommends install \
gdal-bin \
gsfonts \
imagemagick \
libavfilter-dev \
libcurl4-openssl-dev \
libgdal-dev \
libgeos-dev \
libicu-dev \
libjq-dev \
libmagick++-dev \
libnode-dev \
libpng-dev \
libproj-dev \
libprotobuf-dev \
libsqlite3-dev \
libssl-dev \
libudunits2-dev \
make \
protobuf-compiler \
zlib1g-dev \
lbzip2 \
libgeos-c1v5 \
libxml2-dev \
sudo \
pandoc \
pandoc-citeproc \
libcairo2-dev \
libxt-dev \
libssh2-1-dev \
littler \
proj-bin
# Install Tree
RUN apt-get install -y tree
RUN install2.r --error --deps TRUE \
data.table \
dplyr \
geobr \
rgeos \
geojsonio \
ggplot2 \
ggrepel \
ggthemes \
grid \
magick \
magrittr \
pak \
plotly \
png \
readr \
rmapshaper \
shinyBS \
shinycssloaders \
shinyWidgets \
sp \
&& rm -rf /tmp/downloaded_packages
# I also tried to install using these packages with either no success.
# install R packages required
# RUN R -e “install.packages(‘shinyWidgets’, repos=‘http://cran.rstudio.com/’)”
# RUN R -q -e ‘pak::local_install(“shinyWidgets”)’
## assume shiny app is in build folder /shiny
COPY ./cenarios/* /srv/shiny-server/
COPY ./log/shiny-server/ /var/log/shiny-server/
# USER shiny
# allow permission
# RUN sudo chown -R shiny:shiny /srv/shiny-server
# run app
CMD [“/usr/bin/shiny-server”]
I have created the following dockerfile to deploy an application
# get shiny serves plus tidyverse packages image
FROM rocker/r-ver:latest
RUN apt-get update && apt-get install -y \
sudo \
pandoc \
pandoc-citeproc \
libcurl4-gnutls-dev \
libcairo2-dev \
libxt-dev \
libssl-dev \
libxml2-dev \
libssh2-1-dev
RUN R -e "install.packages('devtools')"
RUN R -e "require(devtools)"
RUN R -e 'install_version("WeibullR", version = "1.1.10", repos="http://cran.us.r-
project.org")'
The build fails. I request someone to guide me. I am unable to get it to work
I have found a solution that works. Am posting the same so that someone could consider it a solution
get shiny server plus tidyverse packages image
FROM rocker/r-ver:latest
FROM rocker/shiny-verse:latest
RUN apt-get update && apt-get install -y \
sudo \
pandoc \
pandoc-citeproc \
libcurl4-gnutls-dev \
libcairo2-dev \
libxt-dev \
libssl-dev \
libxml2-dev \
libssh2-1-dev
RUN R -e "install.packages('devtools')"
RUN R -e "require(devtools)"
RUN R -e 'install_version("WeibullR", version = "1.1.10",
repos="http://cran.us.r-
project.org")'
This works neatly.
I've seen a few other posts about the same issue, but no clear solution from any of them.
When running docker build -t test-shiny ., I get the following error when running the docker image locally:
Error in library(leaflet) : there is no package called ‘leaflet’
Calls: <Anonymous> ... sourceUTF8 -> eval -> eval -> ..stacktraceon.. -> library
Execution halted
Here is my Dockerfile:
# Base image https://hub.docker.com/u/rocker/
FROM rocker/r-base:latest
RUN apt-get update && apt-get -y --no-install-recommends install \
curl \
wget \
sudo \
alien \
redis-server \
gnupg \
unixodbc-dev && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean
RUN apt-get update && apt-get -y --no-install-recommends install \
libpng-dev \
libudunits2-dev \
libgeos-dev \
libproj-dev \
libssl-dev \
libcurl4-openssl-dev \
libhiredis-dev \
libmagick++-dev && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean \
libgdal-dev \
netcdf-bin
# Athena ODBC Drivers
RUN wget https://s3.amazonaws.com/athena-downloads/drivers/ODBC/SimbaAthenaODBC_1.1.9.1001/Linux/simbaathena-1.1.9.1001-1.el7.x86_64.rpm && \
sudo alien -i simbaathena-1.1.9.1001-1.el7.x86_64.rpm && \
rm simbaathena-1.1.9.1001-1.el7.x86_64.rpm
# Dependencies
RUN Rscript -e 'install.packages(c("shiny", "shinydashboard", "ggplot2", "patchwork","dbplyr", "dbplot", "scales", "shinycssloaders", "rJava", "RJDBC", "shinyjs", "shinyBS", "highcharter", "leaflet", "DT", "glue", "DBI", "odbc", "data.table"), dependencies = TRUE, repos="http://cran.rstudio.com/", Ncpus=5)' && rm -rf /tmp/downloaded_packages
# Copy App
RUN mkdir shiny-app
COPY evaluation-app/ /shiny-app
# RShiny Port
EXPOSE 3838
# Run App
CMD ["R", "-e", "shiny::runApp('/shiny-app', host = '0.0.0.0', port = 3838)"]
I know I am installing a lot of r packages, but my app runs fine in RStudio. After reading this post, I already tried adding the solution from the accepted answer, but unsuccessful. Any suggestions or solutions would be much appreciated.
For a daily report Rmarkdown script that I would like to encapsulate in a docker container I face a problem with a plotly plot that is created from ggplot facet_grid and then transformed using ggplotly.
When I run the script locally on R studio my plot is working as intended:
When I run the script through my docker container, it is completely greyed out:
The data is actually there, it is just not showing:
There is no differences between the scripts except for where I run it and I actually do not know where to look for solving that bug.
Here is the ggplot+plotly part inside the rmarkdown chunk:
p <- ggplot(table_plot_month, aes(x = action_date, y = n, fill = action_type)) +
geom_bar(stat='identity') +
facet_grid(orga_initiales ~ .) + theme_bw() +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1), legend.position = "none") +
labs(y = "Nombre Actions", x = "Date", fill = "Type action")
gp <- ggplotly(p)
gp <- ggplotly(p)
gp[['x']][['layout']][['annotations']][[1]][['y']] <- -0.25
gp[['x']][['layout']][['annotations']][[2]][['x']] <- -0.07
gp %>% layout(margin = list(l = 120, b=70))
Here are the docker commands I'm using to create the image and running the container and binding the container output directory with the host output directory:
docker build -t daily_report_image C:/my_path
docker run -d --name daily_report -v ~/my_path:/home/output daily_report_image
Here is the Dockerfile I am using to create my image:
FROM rocker/r-base
RUN apt-get update \
&& apt-get install --yes --no-install-recommends \
apt-transport-https \
curl \
gnupg \
unixodbc-dev \
libfontconfig1-dev \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install --yes --no-install-recommends msodbcsql17 \
&& install2.r odbc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/*
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ghostscript \
lmodern \
pandoc-citeproc \
qpdf \
r-cran-formatr \
r-cran-ggplot2 \
r-cran-knitr \
r-cran-rmarkdown \
r-cran-runit \
r-cran-testthat \
r-cran-tidyverse \
r-cran-stringr \
r-cran-lubridate \
r-cran-plotly \
r-cran-formattable \
r-cran-here \
&& install.r binb linl pinp tint \
&& mkdir ~/.R \
&& echo _R_CHECK_FORCE_SUGGESTS_=FALSE > ~/.R/check.Renviron \
&& cd /usr/local/bin \
&& ln -s /usr/lib/R/site-library/littler/examples/render.r .
RUN R -e "install.packages('fontawesome')"
RUN R -e "install.packages('kableExtra')"
RUN R -e "install.packages('flexdashboard')"
WORKDIR /home
COPY src/suivi_activite_html.Rmd suivi_activite_html.Rmd
COPY src/run_all_daily_reports.R run_all_daily_reports.R
COPY .env .env
CMD R -e "source('run_all_daily_reports.R')"
Any idea where I should look? Is it a docker problem, a plotly/ggplot compatibility problem?
I solved it by changing my image and installing plotly with the install.packages function, not with the binaries:
FROM rocker/r-base
RUN apt-get update \
&& apt-get install --yes --no-install-recommends \
apt-transport-https \
curl \
gnupg \
unixodbc-dev \
libfontconfig1-dev \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install --yes --no-install-recommends msodbcsql17 \
&& install2.r odbc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/*
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ghostscript \
lmodern \
pandoc-citeproc \
qpdf \
r-cran-formatr \
r-cran-ggplot2 \
r-cran-knitr \
r-cran-rmarkdown \
r-cran-runit \
r-cran-testthat \
r-cran-tidyverse \
r-cran-stringr \
r-cran-lubridate \
#r-cran-plotly \
r-cran-formattable \
r-cran-here \
&& install.r binb linl pinp tint \
&& mkdir ~/.R \
&& echo _R_CHECK_FORCE_SUGGESTS_=FALSE > ~/.R/check.Renviron \
&& cd /usr/local/bin \
&& ln -s /usr/lib/R/site-library/littler/examples/render.r .
RUN R -e "install.packages('fontawesome')"
RUN R -e "install.packages('kableExtra')"
RUN R -e "install.packages('flexdashboard')"
RUN R -e "install.packages('plotly')"
WORKDIR /home
COPY src/suivi_activite_html.Rmd suivi_activite_html.Rmd
COPY src/run_all_daily_reports.R run_all_daily_reports.R
COPY .env .env
CMD R -e "source('run_all_daily_reports.R')"
I'm trying to install an old version of RODBC into my dockerfile (I'm using R 3.6.3 and the newest version of RODBC needs R v4) by downloading the package using curl and then installing using install.packages but I'm getting the below error. Any ideas of how to achieve this?
Error: unexpected symbol in "install.packages(RODBC_1.2-6.tar.gz"
In the dockerfile I try to do the above with the following RUN statements:
RUN curl https://cran.r-project.org/src/contrib/Archive/RODBC --output RODBC_1.2-6.tar.gz
RUN R -e "install.packages(RODBC_1.2-6.tar.gz)"
The full dockerfile is:
FROM ubuntu:bionic
RUN useradd docker \
&& mkdir /home/docker \
&& chown docker:docker /home/docker \
&& addgroup docker staff
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
software-properties-common \
ed \
less \
locales \
vim-tiny \
wget \
ca-certificates \
&& add-apt-repository --enable-source --yes "ppa:marutter/rrutter3.5" \
&& add-apt-repository --enable-source --yes "ppa:marutter/c2d4u3.5"
## Configure default locale, see https://github.com/rocker-org/rocker/issues/19
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
&& locale-gen en_US.utf8 \
&& /usr/sbin/update-locale LANG=en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
littler \
r-base \
r-base-dev \
r-recommended \
&& ln -s /usr/lib/R/site-library/littler/examples/install.r /usr/local/bin/install.r \
&& ln -s /usr/lib/R/site-library/littler/examples/install2.r /usr/local/bin/install2.r \
&& ln -s /usr/lib/R/site-library/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
&& ln -s /usr/lib/R/site-library/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
&& install.r docopt \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update
#These are all required, the exact version, for SQL Server to work
RUN apt-get install -y gnupg2 libssl1.0 libssl1.0-dev apt-transport-https
RUN apt-get install -y libcurl4-openssl-dev curl
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN apt-get update
RUN ACCEPT_EULA=Y apt-get install -y msodbcsql17 unixodbc unixodbc-dev
RUN apt-get install -y libssl-dev
RUN install.r tidyr bigrquery dplyr sqldf readr httr uuid
RUN curl https://cran.r-project.org/src/contrib/Archive/RODBC --output RODBC_1.2-6.tar.gz
RUN R -e "install.packages(RODBC_1.2-6.tar.gz)"
COPY src/upload_v2.r /usr/local/src/scripts/upload_v2.r
WORKDIR /usr/local/src/scripts
It looks like quote is missing in RUN R line:
RUN curl https://cran.r-project.org/src/contrib/Archive/RODBC --output RODBC_1.2-6.tar.gz
RUN R -e "install.packages('RODBC_1.2-6.tar.gz')"