skip to Main Content

I have a Dockerfile which is getting the packages from a source called jonathonf but it’s failing to download some packages from this repository. Could any one please help me with the solution? I have tried very hard to resolve this issue but I am unable to resolve it.

Dockerfile

FROM ubuntu:16.04
LABEL maintainer="Praveen"

# Install Python 3.6, Node & Yarn
RUN apt-get update -y 
  && apt-get install -y software-properties-common curl git 
  && add-apt-repository ppa:jonathonf/python-3.6 
  #These three lines are added to resolve jonathonf issue
  #&& add-apt-repository ppa:deadsnakes/ppa 
  #&& apt-get update -y 
  #&& apt-get install python3.6 -y 
  #&& apt-get npm 
  #These three lines are added to resolve jonathonf issue
  #&& add-apt-repository ppa:deadsnakes/ppa 
  && curl --silent --location https://deb.nodesource.com/setup_10.x | bash - 
  && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - 
  && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list 
  && apt-get update -y 
  && apt-get install -y build-essential python3.6 python3.6-dev python3-pip python3.6-venv nodejs --no-install-recommends yarn 
  && apt-get clean 
  && python3.6 -m pip install pip --upgrade 
  && python3.6 -m pip install wheel

# Install BigARTM
WORKDIR /tmp
RUN apt-get update -y 
  && apt-get install -y libboost-all-dev python3-setuptools cmake 
  && pip install numpy scipy pandas protobuf==3.0.0 tqdm 
  && git clone --branch=v0.9.0 https://github.com/bigartm/bigartm.git 
  && cd bigartm && mkdir build && cd build 
  && cmake -DPYTHON=python3.6 -DCMAKE_INSTALL_PREFIX=/usr/local .. 
  && make && make install
ENV ARTM_SHARED_LIBRARY=/usr/local/lib/libartm.so

# Install Model
WORKDIR /www
COPY application/python_model/requirements.txt ./python_model/requirements.txt
RUN pip install --no-cache-dir -r ./python_model/requirements.txt 
  && python3.6 -m spacy download en 
  && python3.6 -m nltk.downloader punkt stopwords averaged_perceptron_tagger

# Install NodeJS App
ADD application/package.json application/yarn.lock ./
RUN npm install -g yarn 
  && yarn install 
  && yarn cache clean

ADD application ./

CMD ["yarn", "start"]

Error:

apt-get update
Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Ign:2 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial InRelease
Hit:3 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:4 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Ign:5 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial Release
Hit:6 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Ign:7 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main amd64 Packages
Ign:8 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main all Packages
Ign:7 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main amd64 Packages
Ign:8 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main all Packages
Ign:7 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main amd64 Packages
Ign:8 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main all Packages
Ign:7 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main amd64 Packages
Ign:8 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main all Packages
Ign:7 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main amd64 Packages
Ign:8 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main all Packages
Err:7 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main amd64 Packages
  403  Forbidden
Ign:8 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main all Packages
Reading package lists...
W: The repository 'http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial Release' does not have a Release file.
E: **Failed to fetch http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu/dists/xenial/main/binary-amd64/Packages  403  Forbidden**
E: Some index files failed to download. They have been ignored, or old ones used instead.
Error executing command, exiting
The command '/bin/sh -c apt-get update -y   && apt-get install -y software-properties-common curl git   && add-apt-repository ppa:jonathonf/python-3.6   && curl --silent --location https://deb.nodesource.com/setup_10.x | bash -   && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -   && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list   && apt-get update -y   && apt-get install -y build-essential python3.6 python3.6-dev python3-pip python3.6-venv nodejs --no-install-recommends yarn   && apt-get clean   && python3.6 -m pip install pip --upgrade   && python3.6 -m pip install wheel' returned a non-zero code: 1

Error after trying ubuntu:18.04:

Step 10/22 : ADD application/package.json application/yarn.lock ./
 ---> ba08da3d1daa
Step 11/22 : RUN npm install -g yarn   && yarn install   && yarn cache clean
 ---> Running in 72517b8173b6
npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/yarn/bin/yarn.js
npm ERR! dest /usr/bin/yarn
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/yarn/bin/yarn.js' -> '/usr/bin/yarn'
npm ERR! File exists: /usr/bin/yarn
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-12-30T10_10_54_161Z-debug.log
The command '/bin/sh -c npm install -g yarn   && yarn install   && yarn cache clean' returned a non-zero code: 239
##[error]The command '/bin/sh -c npm install -g yarn   && yarn install   && yarn cache clean' returned a non-zero code: 239
##[error]The process '/usr/bin/docker' failed with exit code 239

2

Answers


  1. Let me walk you through how a problem like this can be debugged on your own:

    • You see an error message when building the dockerfile that indicates a 403 Forbidden error.
    • That error is giving you a clear source of the problem: The package repository. If you try to open the URL in a browser, you see that you’re still getting a 403 error. Yes, it’s definitely a problem with the package repository.
    • Visiting the package maintainer’s root page gives you more detail on the source of the problem: Your dockerfile is invalid because the author of those packages has purposefully unpublished them.

    This PPA has been removed from public access as part of a protest against the abuse of open-source projects by large companies. For more detail visit the main page here: https://launchpad.net/~jonathonf

    If you are a company and you would like this PPA to continue then let me know your preferred route for contributions and I will arrange something.

    If we have already been in contact then ping me your Launchpad ID and I will add you to a private PPA in the meantime.

    Ref

    So the solution to your problem is to find an alternate source for the packages or to contact the author of the package.

    Login or Signup to reply.
  2. As mentioned in the other answer,
    the jonathonf/python3.6 PPA was removed, and unfortunately that was the "usual"
    way of installing Python3.6 on Ubuntu 16.04.

    If the Ubuntu version is not required to be 16.04, you can instead use the Ubuntu 18.04 (Bionic) image (ubuntu:bionic or ubuntu:18.04). It already has built-in alternate apt sources for installing Python3.6.

    root@2c4e419e7489:/# apt show python3
    Package: python3
    Version: 3.6.7-1~18.04
    Priority: important
    Section: python
    Source: python3-defaults
    Origin: Ubuntu
    Maintainer: Ubuntu Developers <[email protected]>
    Original-Maintainer: Matthias Klose <[email protected]>
    Bugs: https://bugs.launchpad.net/ubuntu/+filebug
    Installed-Size: 191 kB
    ...
    APT-Sources: http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
    Description: interactive high-level object-oriented language (default python3 version)
    
    root@2c4e419e7489:/# python3 -V
    Python 3.6.9
    

    Here is a working Dockerfile that uses ubuntu:bionic and installs Python3.6, node
    and yarn. Note that I split it into multiple RUN statements just so I can properly
    comment out some extra information. You can combine them if you wish. I also don’t know
    if you have other steps, but your post only mentions those 3.

    FROM ubuntu:bionic
    LABEL maintainer="Praveen"
    
    # Install essentials
    RUN apt-get update -y 
        && apt-get install -y build-essential software-properties-common curl git
    
    # Install Python 3.6
    RUN apt-get install -y python3-pip 
        && apt-get clean 
        && python3 -m pip install --upgrade pip
    
    # Install Node (also installs npm)
    #
    # Based on official instructions for Ubuntu and Debian
    # https://github.com/nodesource/distributions/blob/master/README.md#debinstall
    #
    # The latest is setup_13.x, but I copied your original command that uses setup10.x.
    # It might be better to use setup_13.x instead.
    RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - 
        && apt-get install -y nodejs
    
    # Install Yarn
    #
    # Based on official instructions for Ubuntu and Debian
    # https://yarnpkg.com/lang/en/docs/install/#debian-stable
    RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - 
        && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list 
        && apt-get update 
        && apt-get install -y yarn
    

    Here’s the output from the built Docker image:

    root@34c1457911df:/# cat /etc/lsb-release
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=18.04
    DISTRIB_CODENAME=bionic
    DISTRIB_DESCRIPTION="Ubuntu 18.04.3 LTS"
    root@34c1457911df:/# python3 -V
    Python 3.6.9
    root@34c1457911df:/# python3 -m pip -V
    pip 19.3.1 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)
    root@34c1457911df:/# node --version
    v10.18.0
    root@34c1457911df:/# npm --version
    6.13.4
    root@34c1457911df:/# yarn --version
    1.21.1
    

    The posted error message you got when you tried ubuntu:18.04

    Step 11/22 : RUN npm install -g yarn   && yarn install   && yarn cache clean
     ---> Running in 72517b8173b6
    npm ERR! code EEXIST
    npm ERR! syscall symlink
    npm ERR! path ../lib/node_modules/yarn/bin/yarn.js
    npm ERR! dest /usr/bin/yarn
    npm ERR! errno -17
    npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/yarn/bin/yarn.js' -> '/usr/bin/yarn'
    npm ERR! File exists: /usr/bin/yarn
    

    means that you already installed yarn (maybe using apt install yarn) and then you tried installing it again from npm. NPM will not overwrite a previous installation unless you --force
    it to. But, since you already installed it from apt, you don’t need to install it again with npm. (I don’t use yarn though, so I don’t know if there’s a difference with yarn from apt or from npm.)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search