When building a docker container I got repository does not exist or may require 'docker login

I am trying to build this container (that months ago worked ok)

FROM jupyter/scipy-notebook

RUN pip install mlflow

RUN pip install sklearn

USER root
RUN apt-get update && apt-get install -y curl
# Switch back to jovyan to avoid accidental container runs as root
RUN echo $NB_UID

However it fails when trying to install mlflow with

ERROR: Could not find a version that satisfies the requirement mlflow (from versions: none)
ERROR: No matching distribution found for mlflow
The command '/bin/bash -o pipefail -c pip install mlflow' returned a non-zero code: 1
Unable to find image 'chapter_1_homlflow:latest' locally
docker: Error response from daemon: pull access denied for chapter_1_homlflow, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.

The error happens when running a script which is run.sh

docker build -t chapter_1_homlflow .
docker run --network="host" -p 8888:8888 -p 5000:5000 -p 1235:1235 -v $(pwd):/home/jovyan/ -it --rm chapter_1_homlflow

I run this on a ubuntu 18 with a pretty old python version (3.6)

I cannot pip install anything. mlflow, sklearn etc

How can I solve this?

Ubuntu 18.04 ‘Bionic Beaver’ is reaching End of Standard Support this May [2023]

Not sure if you have read about the security breaches happening like every day around the world, but it is highly recommended that you use an up-to-date Linux distro with latest security fixes.

You left out the most relevant part in your post: the result of docker build. I just used your Dockerfile to build an image, and the error message is quite clear and even tells you what needs to be done:

Step 3/7 : RUN pip install sklearn
 ---> Running in 7d48ed1552db
Collecting sklearn
  Downloading sklearn-0.0.post12.tar.gz (2.6 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      The 'sklearn' PyPI package is deprecated, use 'scikit-learn'
      rather than 'sklearn' for pip commands.

      Here is how to fix this error in the main use cases:
      - use 'pip install scikit-learn' rather than 'pip install sklearn'
      - replace 'sklearn' by 'scikit-learn' in your pip requirements files
        (requirements.txt, setup.py, setup.cfg, Pipfile, etc ...)
      - if the 'sklearn' package is used by one of your dependencies,
        it would be great if you take some time to track which package uses
        'sklearn' instead of 'scikit-learn' and report it to their issue tracker
      - as a last resort, set the environment variable

      More information is available at
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
The command '/bin/bash -o pipefail -c pip install sklearn' returned a non-zero code: 1

Although everyone before me had a good point, I just want to reply to the following:

Since you are using the “latest” tag when you don’t specify the tag, months ago you had a different image. The current latest image is 2 months old. It seems that the image supports tags like 2023-10-16 and other tags as well, so you could find out what the old image was and use that in your Dockerfile. But sooner or later, you wold have to solve the issue with the new image. And if you want to use a stable image, than sooner :slight_smile: