facebookresearch / detectron2

Detectron2 is a platform for object detection, segmentation and other visual recognition tasks.
https://detectron2.readthedocs.io/en/latest/
Apache License 2.0
29.34k stars 7.33k forks source link

Dockerfile build failed with unsupported python version #4882

Open zerollzeng opened 1 year ago

zerollzeng commented 1 year ago

Instructions To Reproduce the 🐛 Bug:

  1. Full logs or other relevant observations:
    [+] Building 631.5s (15/16)
    => [internal] load .dockerignore                                                                                                                                                                                                                                   0.0s
    => => transferring context: 2B                                                                                                                                                                                                                                     0.0s
    => [internal] load build definition from Dockerfile                                                                                                                                                                                                                0.0s
    => => transferring dockerfile: 2.13kB                                                                                                                                                                                                                              0.0s
    => [internal] load metadata for docker.io/nvidia/cuda:11.1.1-cudnn8-devel-ubuntu18.04                                                                                                                                                                              1.0s
    => [ 1/13] FROM docker.io/nvidia/cuda:11.1.1-cudnn8-devel-ubuntu18.04@sha256:1f181384de58303eb71b70854033fa0774a3212ac6824ad07859c96f91e98fac                                                                                                                    280.8s
    => => resolve docker.io/nvidia/cuda:11.1.1-cudnn8-devel-ubuntu18.04@sha256:1f181384de58303eb71b70854033fa0774a3212ac6824ad07859c96f91e98fac                                                                                                                        0.0s
    => => sha256:a404e54162968593b8d92b571f3cdd673e4c9eab5d9be28d7c494595c0aa6682 26.71MB / 26.71MB                                                                                                                                                                    0.3s
    => => sha256:391d07dd0009f93d13fb7b13dab2078ad0686953b6b398f66688c7204466df48 7.22MB / 7.22MB                                                                                                                                                                      0.8s
    => => sha256:cb7a4dc5cae35387c4323a9d9855171616e61cd95711ce2b411ce03a03f349e6 10.79MB / 10.79MB                                                                                                                                                                    0.5s
    => => sha256:1f181384de58303eb71b70854033fa0774a3212ac6824ad07859c96f91e98fac 1.05kB / 1.05kB                                                                                                                                                                      0.0s
    => => sha256:26f27dedabe94a7aa56e1683be4595f56993ba42db50ecb54db1d92a73be7be8 2.43kB / 2.43kB                                                                                                                                                                      0.0s
    => => sha256:d91fe8dffe66931f4f2def08c2163dd2c0afc536e21d133c8352eb8978483f5a 15.21kB / 15.21kB                                                                                                                                                                    0.0s
    => => sha256:3f77a3e2807d8cb8690b749c26d19e6e462743141b750330d311916f3c4857e9 186B / 186B                                                                                                                                                                          0.5s
    => => extracting sha256:a404e54162968593b8d92b571f3cdd673e4c9eab5d9be28d7c494595c0aa6682                                                                                                                                                                           1.8s
    => => sha256:0f0ed9680ff1f69ce856414b2c9cd4482d37b24147c07821faba7ae51d862a6d 6.43kB / 6.43kB                                                                                                                                                                      0.6s
    => => sha256:e2250e4b9e6414e7df5d1f97abaa9fdfb5b5a97cef526f9bdf91b6623b076b6a 1.51GB / 1.51GB                                                                                                                                                                     14.5s
    => => sha256:9cf40c59065f805dd01d0a204a6817daa6acf7034abaf92e9d950c73d7b4cb11 63.42kB / 63.42kB                                                                                                                                                                    0.7s
    => => sha256:2948bd655f12ed243a171bd23359dc90cd0be5fed8da758a99997c092a2e4618 1.25GB / 1.25GB                                                                                                                                                                     11.4s
    => => sha256:c27dc09446dd9f1ec89a8a74c1371779e699eedbf6e2e9cd833c884ff1628f08 87.61kB / 87.61kB                                                                                                                                                                    0.9s
    => => sha256:2ada995899f12968272da2be7985d70c2b61eae023b7526afc41757f98536259 1.57GB / 1.57GB                                                                                                                                                                     18.0s
    => => extracting sha256:391d07dd0009f93d13fb7b13dab2078ad0686953b6b398f66688c7204466df48                                                                                                                                                                           0.5s
    => => extracting sha256:cb7a4dc5cae35387c4323a9d9855171616e61cd95711ce2b411ce03a03f349e6                                                                                                                                                                           0.6s
    => => extracting sha256:3f77a3e2807d8cb8690b749c26d19e6e462743141b750330d311916f3c4857e9                                                                                                                                                                           0.0s
    => => extracting sha256:0f0ed9680ff1f69ce856414b2c9cd4482d37b24147c07821faba7ae51d862a6d                                                                                                                                                                           0.0s
    => => extracting sha256:e2250e4b9e6414e7df5d1f97abaa9fdfb5b5a97cef526f9bdf91b6623b076b6a                                                                                                                                                                          84.6s
    => => extracting sha256:9cf40c59065f805dd01d0a204a6817daa6acf7034abaf92e9d950c73d7b4cb11                                                                                                                                                                           0.1s
    => => extracting sha256:2948bd655f12ed243a171bd23359dc90cd0be5fed8da758a99997c092a2e4618                                                                                                                                                                          71.5s
    => => extracting sha256:c27dc09446dd9f1ec89a8a74c1371779e699eedbf6e2e9cd833c884ff1628f08                                                                                                                                                                           0.1s
    => => extracting sha256:2ada995899f12968272da2be7985d70c2b61eae023b7526afc41757f98536259                                                                                                                                                                         109.6s
    => [ 2/13] RUN apt-get update && apt-get install -y  python3-opencv ca-certificates python3-dev git wget sudo ninja-build                                                                                                                                        181.5s
    => [ 3/13] RUN ln -sv /usr/bin/python3 /usr/bin/python                                                                                                                                                                                                             0.4s
    => [ 4/13] RUN useradd -m --no-log-init --system  --uid 42189 appuser -g sudo                                                                                                                                                                                      0.4s
    => [ 5/13] RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers                                                                                                                                                                                                 0.5s
    => [ 6/13] WORKDIR /home/appuser                                                                                                                                                                                                                                   0.0s
    => [ 7/13] RUN wget https://bootstrap.pypa.io/pip/3.6/get-pip.py &&  python3 get-pip.py --user &&  rm get-pip.py                                                                                                                                                   4.2s
    => [ 8/13] RUN pip install --user tensorboard cmake onnx   # cmake from apt-get is too old                                                                                                                                                                        24.9s
    => [ 9/13] RUN pip install --user torch==1.10 torchvision==0.11.1 -f https://download.pytorch.org/whl/cu111/torch_stable.html                                                                                                                                    119.7s
    => [10/13] RUN pip install --user 'git+https://github.com/facebookresearch/fvcore'                                                                                                                                                                                 5.1s
    => [11/13] RUN git clone https://github.com/facebookresearch/detectron2 detectron2_repo                                                                                                                                                                            1.7s
    => ERROR [12/13] RUN pip install --user -e detectron2_repo                                                                                                                                                                                                        11.0s
    ------
    > [12/13] RUN pip install --user -e detectron2_repo:
    #0 0.903 Obtaining file:///home/appuser/detectron2_repo
    #0 0.903   Preparing metadata (setup.py): started
    #0 2.654   Preparing metadata (setup.py): finished with status 'done'
    #0 2.695 Requirement already satisfied: Pillow>=7.1 in ./.local/lib/python3.6/site-packages (from detectron2==0.6) (8.4.0)
    #0 3.251 Collecting matplotlib
    #0 3.282   Downloading matplotlib-3.3.4-cp36-cp36m-manylinux1_x86_64.whl (11.5 MB)
    #0 3.654 Collecting pycocotools>=2.0.2
    #0 3.660   Downloading pycocotools-2.0.6.tar.gz (24 kB)
    #0 3.673   Installing build dependencies: started
    #0 9.152   Installing build dependencies: finished with status 'done'
    #0 9.154   Getting requirements to build wheel: started
    #0 9.531   Getting requirements to build wheel: finished with status 'done'
    #0 9.537   Preparing metadata (pyproject.toml): started
    #0 9.932   Preparing metadata (pyproject.toml): finished with status 'done'
    #0 9.934 Requirement already satisfied: termcolor>=1.1 in ./.local/lib/python3.6/site-packages (from detectron2==0.6) (1.1.0)
    #0 9.935 Requirement already satisfied: yacs>=0.1.8 in ./.local/lib/python3.6/site-packages (from detectron2==0.6) (0.1.8)
    #0 9.935 Requirement already satisfied: tabulate in ./.local/lib/python3.6/site-packages (from detectron2==0.6) (0.8.10)
    #0 9.981 Collecting cloudpickle
    #0 9.988   Downloading cloudpickle-2.2.1-py3-none-any.whl (25 kB)
    #0 9.991 Requirement already satisfied: tqdm>4.29.0 in ./.local/lib/python3.6/site-packages (from detectron2==0.6) (4.64.1)
    #0 9.991 Requirement already satisfied: tensorboard in ./.local/lib/python3.6/site-packages (from detectron2==0.6) (2.10.1)
    #0 10.08 Collecting fvcore<0.1.6,>=0.1.5
    #0 10.09   Downloading fvcore-0.1.5.post20221221.tar.gz (50 kB)
    #0 10.10   Preparing metadata (setup.py): started
    #0 10.37   Preparing metadata (setup.py): finished with status 'done'
    #0 10.40 Collecting iopath<0.1.10,>=0.1.7
    #0 10.41   Downloading iopath-0.1.9-py3-none-any.whl (27 kB)
    #0 10.55 Collecting omegaconf>=2.1
    #0 10.55   Downloading omegaconf-2.3.0-py3-none-any.whl (79 kB)
    #0 10.60 Collecting hydra-core>=1.1
    #0 10.60   Downloading hydra_core-1.3.2-py3-none-any.whl (154 kB)
    #0 10.71 Collecting black
    #0 10.72   Downloading black-22.8.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB)
    #0 10.80 Collecting packaging
    #0 10.81   Downloading packaging-21.3-py3-none-any.whl (40 kB)
    #0 10.81 Requirement already satisfied: dataclasses in ./.local/lib/python3.6/site-packages (from detectron2==0.6) (0.8)
    #0 10.81 ERROR: Package 'detectron2' requires a different Python: 3.6.9 not in '>=3.7'
    ------
    Dockerfile:36
    --------------------
    34 |     ENV TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST}"
    35 |
    36 | >>> RUN pip install --user -e detectron2_repo
    37 |
    38 |     # Set a fixed model cache directory.
    --------------------
    ERROR: failed to solve: process "/bin/sh -c pip install --user -e detectron2_repo" did not complete successfully: exit code: 1
  2. please simplify the steps as much as possible so they do not require additional resources to run, such as a private dataset.
docker build --build-arg USER_ID=$UID -t detectron2:v0 .
mabushey commented 1 year ago

Anyone have the solution? The whole point of docker is to encapsulate this insanely fragile mess. Does reverting to an older commit fix this?

mabushey commented 1 year ago

The reason you couldn't find the solution is it was resolved a year ago, but with over 24K stars there's apparently no one that cares. I got the docker container to build by changing ubuntu18 to ubuntu20, but the demo errors.

I wish these AI libraries were available for Rust so I could actually use them.

sxyxs commented 1 year ago

The reason you couldn't find the solution is it was resolved a year ago, but with over 24K stars there's apparently no one that cares. I got the docker container to build by changing ubuntu18 to ubuntu20, but the demo errors.

I wish these AI libraries were available for Rust so I could actually use them.

I switch the ubuntu 18 to 20 and it works for me :D

farshidrayhancv commented 2 months ago

Is there a solution for this, please? I am having the same issue and changing to 20.04 didn't fix the problem.