cog
cog copied to clipboard
Trying to install Java 8 - Unable to locate package openjdk-8-jdk
I am trying to install javasdk8 in my cog file for using spark nlp from within the docker. it fails with the following error ` => ERROR [stage-0 4/13] RUN --mount=type=cache,target=/var/cache/apt apt-get update -qq && apt-get install -qqy zip unzip openjdk-8-jdk && rm -rf /var/lib/apt/lists/* 3.5s
[stage-0 4/13] RUN --mount=type=cache,target=/var/cache/apt apt-get update -qq && apt-get install -qqy zip unzip openjdk-8-jdk && rm -rf /var/lib/apt/lists/*: #10 3.517 E: Unable to locate package openjdk-8-jdk
executor failed running [/bin/sh -c apt-get update -qq && apt-get install -qqy zip unzip openjdk-8-jdk && rm -rf /var/lib/apt/lists/*]: exit code: 100 ⅹ Failed to build Docker image: exit status 1 `
I tried putting apt-get install -y openjdk-8-jdk in the cog.yaml file too.
Is it possible to RUN commands directly like we do in docker?
I tried putting apt-get install -y openjdk-8-jdk in the cog.yaml file too.
Hmm, odd. It's possible that it's not available in the version of Ubuntu that is being used. We should perhaps document how to find packages for the version you're using.
Would you mind posting your full cog.yaml and output from the command you're running?
Is it possible to RUN commands directly like we do in docker?
It is! With the run: option in cog.yaml: https://github.com/replicate/cog/blob/main/docs/yaml.md#run
Here is my cog.yaml
gpu: false
python_version: "3.7.13"
system_packages:
- "zip"
- "unzip"
# - "openjdk-8-jdk"
# - "ffmpeg"
# - "libavcodec-dev"
python_packages:
- tensorflow==2.8.0
- typing-extensions==4.2.0
- sacremoses==0.0.53
- pandas==1.3.5
- mock==4.0.3
- sacrebleu==2.0.0
- pyarrow==6.0.1
- mosestokenizer==1.2.1
- subword-nmt==0.3.8
- pyspark==3.1.2
- spark-nlp==3.4.4
- spark-nlp-display==1.9.1
- transformers==4.19.0
- sentencepiece==0.1.96
- torch==1.11.0
- torchvision==0.12.0
- hydra-core==1.0.7
- omegaconf==2.0.6
- regex==2019.12.20
- requests==2.23.0
- debugpy==1.6.0
run:
- apt-get update;apt-get install -y software-properties-common;add-apt-repository ppa:openjdk-r/ppa;apt-get update;apt-get install -y openjdk-8-jdk
- echo "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/" >> ~/.bashrc
- cd /src/;git clone https://github.com/pytorch/fairseq.git;cd fairseq;pip install --use-feature=in-tree-build ./;cd ..
predict: "predict.py:Predictor"
It is picking ubuntu20 and running. I have added the openjdk ppa too, because maybe it does not come with the ubuntu20 docker image that cog builds from but that too doesnt work. (I have tried running on my ubuntu it does not need the ppa) I also tried running with sudo - (sudo cog build ...) I am running other commands and building fairseq using the run: commands, but i had to set a common work directory and install everything to that directory and add it to the sys.path in my predict file. so that it is able to find the reference files. Could this be an issue with the path?
Thanks for your help in advance.
Here is the complete log - for the command, everything runs fine till the software-properties installation, there is socket and connection issues showing during ppa and package installation
#12 9.630 Setting up python3-apt (2.2.1) ...
#12 9.801 Setting up libappstream4:amd64 (0.14.4-1) ...
#12 9.807 Setting up unattended-upgrades (2.8) ...
#12 9.912
#12 9.912 Creating config file /etc/apt/apt.conf.d/20auto-upgrades with new version
#12 9.982
#12 9.982 Creating config file /etc/apt/apt.conf.d/50unattended-upgrades with new version
#12 10.14 Created symlink /etc/systemd/system/multi-user.target.wants/unattended-upgrades.service → /lib/systemd/system/unattended-upgrades.service.
#12 10.19 Setting up python3-software-properties (0.96.20.2-2.1) ...
#12 10.35 Setting up libpolkit-agent-1-0:amd64 (0.105-31+deb11u1) ...
#12 10.35 Setting up policykit-1 (0.105-31+deb11u1) ...
#12 10.39 Setting up software-properties-common (0.96.20.2-2.1) ...
#12 10.53 Setting up packagekit (1.2.2-2) ...
#12 10.55 invoke-rc.d: could not determine current runlevel
#12 10.55 invoke-rc.d: policy-rc.d denied execution of force-reload.
#12 10.55 Failed to open connection to "system" message bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
#12 10.72 Created symlink /etc/systemd/user/sockets.target.wants/pk-debconf-helper.socket → /usr/lib/systemd/user/pk-debconf-helper.socket.
#12 10.73 Setting up packagekit-tools (1.2.2-2) ...
#12 10.74 Processing triggers for libc-bin (2.31-13+deb11u3) ...
#12 10.82 Processing triggers for dbus (1.12.20-2) ...
#12 11.80
#12 11.80 More info: https://launchpad.net/~openjdk-r/+archive/ubuntu/ppa
#12 13.55 gpg: keybox '/tmp/tmpoul2q56e/pubring.gpg' created
#12 14.13 gpg: /tmp/tmpoul2q56e/trustdb.gpg: trustdb created
#12 14.13 gpg: key EB9B1D8886F44E2A: public key "Launchpad OpenJDK builds (all archs)" imported
#12 14.14 gpg: Total number processed: 1
#12 14.14 gpg: imported: 1
#12 14.24 Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
#12 14.26 gpg: no valid OpenPGP data found.
#12 14.40 Hit:1 http://deb.debian.org/debian bullseye InRelease
#12 14.40 Hit:2 http://security.debian.org/debian-security bullseye-security InRelease
#12 14.40 Hit:3 http://deb.debian.org/debian bullseye-updates InRelease
#12 14.78 Ign:4 http://ppa.launchpad.net/openjdk-r/ppa/ubuntu kinetic InRelease
#12 15.05 Err:5 http://ppa.launchpad.net/openjdk-r/ppa/ubuntu kinetic Release
#12 15.05 404 Not Found [IP: 185.125.190.52 80]
#12 15.06 Reading package lists...
#12 15.59 E: The repository 'http://ppa.launchpad.net/openjdk-r/ppa/ubuntu kinetic Release' does not have a Release file.
#12 15.60 Reading package lists...
#12 16.05 Building dependency tree...
#12 16.18 Reading state information...
#12 16.30 E: Unable to locate package openjdk-8-jdk
------
executor failed running [/bin/sh -c apt-get update;apt-get install -y software-properties-common;add-apt-repository ppa:openjdk-r/ppa;apt-get update;apt-get install -y openjdk-8-jdk]: exit code: 100
ⅹ Failed to build Docker image: exit status 1
Can anyone help here ?
You need to add a repository that has openjdk8 before installing it.
Try running apt-add-repository 'deb http://security.debian.org/debian-security stretch/updates main' then apt-get -y update && apt-get -y upgrade before apt-get install -y openjdk-8-jdk
NB: There are other repositories that also provide OpenJDK8