gpt4 book ai didi

java - 无法在 docker 镜像中安装 RWeka 包

转载 作者:太空宇宙 更新时间:2023-11-04 11:53:08 25 4
gpt4 key购买 nike

我正在使用 java 镜像,并根据需要安装了 R,但是当我安装 RWeka 包时出现错误

下面是我的 Dockerfile:

FROM buildpack-deps:jessie-scm

# A few problems with compiling Java from source:
# 1. Oracle. Licensing prevents us from redistributing the official JDK.
# 2. Compiling OpenJDK also requires the JDK to be installed, and it gets
# really hairy.

RUN apt-get update && apt-get install -y --no-install-recommends \
bzip2 \
unzip \
xz-utils \
&& rm -rf /var/lib/apt/lists/*

# Default to UTF-8 file.encoding
ENV LANG C.UTF-8

# add a simple script that can auto-detect the appropriate JAVA_HOME value
# based on whether the JDK or only the JRE is installed
RUN { \
echo '#!/bin/sh'; \
echo 'set -e'; \
echo; \
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
} > /usr/local/bin/docker-java-home \
&& chmod +x /usr/local/bin/docker-java-home

ENV JAVA_HOME /usr/lib/jvm/java-7-openjdk-amd64

ENV JAVA_VERSION 7u111
ENV JAVA_DEBIAN_VERSION 7u111-2.6.7-2~deb8u1

RUN set -x \
&& apt-get update \
&& apt-get install -y \
openjdk-7-jdk="$JAVA_DEBIAN_VERSION" \
&& rm -rf /var/lib/apt/lists/* \
&& [ "$JAVA_HOME" = "$(docker-java-home)" ]

# If you're reading this and have any feedback on how this image could be
# improved, please open an issue or a pull request so we can discuss it!

# system libraries of general use
RUN apt-get update && apt-get install -y \
sudo \
pandoc \
pandoc-citeproc \
libcurl4-gnutls-dev \
libcairo2-dev \
libxt-dev \
libssl-dev \
libssh2-1-dev \
libssl1.0.0

# system library dependency for the euler app
RUN apt-get update && apt-get install -y \
libmpfr-dev

RUN sudo apt-get install -y \
r-base r-base-dev

# basic shiny functionality
RUN R -e "install.packages(c('shiny', 'rmarkdown'), repos='https://cloud.r-project.org/')"

# install dependencies
RUN R -e "install.packages('Rmpfr', repos='https://cloud.r-project.org/')"

# Special Package
RUN R -e "install.packages('shiny')"
RUN R -e "install.packages('shinydashboard')"
RUN R -e "install.packages('plyr')"
RUN R -e "install.packages('dplyr')"
RUN R -e "install.packages('ggplot2')"
RUN R -e "install.packages('tm')"
RUN R -e "install.packages('SnowballC')"
RUN R -e "install.packages('wordcloud')"
RUN R -e "install.packages('RWeka')"
RUN R -e "install.packages('reshape2')"
RUN R -e "install.packages('igraph')"



# copy the app to the image
RUN mkdir /root/testapp1
COPY testapp1 /root/testapp1

COPY Rprofile.site /usr/lib/R/etc/

EXPOSE 3838

CMD ["R", "-e shiny::runApp('/root/testapp1')"]

当我尝试安装下面的任何 RWeka 软件包时,出现错误:

./configure: line 3736: /usr/lib/jvm/default-java/jre/bin/java: No such file or directory
no
configure: error: Java interpreter '/usr/lib/jvm/default-java/jre/bin/java' does not work
ERROR: configuration failed for package ‘rJava’
* removing ‘/usr/local/lib/R/site-library/rJava’
ERROR: dependency ‘rJava’ is not available for package ‘RWekajars’
* removing ‘/usr/local/lib/R/site-library/RWekajars’
ERROR: dependencies ‘RWekajars’, ‘rJava’ are not available for package ‘RWeka’
* removing ‘/usr/local/lib/R/site-library/RWeka’

The downloaded source packages are in
‘/tmp/RtmpOdXNMp/downloaded_packages’
Warning messages:
1: In install.packages("RWeka") :
installation of package ‘rJava’ had non-zero exit status
2: In install.packages("RWeka") :
installation of package ‘RWekajars’ had non-zero exit status
3: In install.packages("RWeka") :
installation of package ‘RWeka’ had non-zero exit status

如何解决这个问题?

谢谢。

最佳答案

我找到了解决方案。如果在RUN R -e "install.packages('RWeka')"

之前执行命令行: sudo R CMD javareconf,安装将成功完成

关于java - 无法在 docker 镜像中安装 RWeka 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41604074/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com