facebookresearch / nougat

Implementation of Nougat Neural Optical Understanding for Academic Documents
https://facebookresearch.github.io/nougat/
MIT License
8.81k stars 561 forks source link

Cannot build docker image #138

Open p4thie opened 12 months ago

p4thie commented 12 months ago

Describe the bug Cannot build docker image using Dockerfile.

To Reproduce

  1. run command docker build -t <image-name> .
  2. docker fails to build the image with following error: ERROR: failed to solve: process "/bin/sh -c python3 setup.py install" did not complete successfully: exit code: 1

According to the output, docker fails to solve RUN python3 setup.py install, specifically, by the following error: huggingface-hub 0.17.3 is installed but huggingface_hub<0.17,>=0.16.4 is required by {'tokenizers'}

Temporal fix is that commenting out RUN python3 setup.py install, then resolving the conflict after building the image. However this is not ideal.

mikeb-btw commented 11 months ago

@p4thie Do you mind explaining what you mean by this?

then resolving the conflict after building the image

mikeb-btw commented 11 months ago

By the way, this worked for us:

FROM nvidia/cuda:12.1.0-base-ubuntu22.04
# replace CUDA version to your CUDA version.
# You can check your CUDA version with below.
# nvcc -V

RUN apt-get update && \
    apt-get install -y git python3 python3-pip

RUN pip3 install torch torchvision torchaudio huggingface-hub==0.17.3 fastapi uvicorn[standard] fsspec[http]==2023.1.0 --no-cache-dir

COPY ../ .

RUN python3 setup.py install

EXPOSE 8503

CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8503"]
# Run this using 'docker run -it -d -p <YOUR PORT>:8503 --gpus all <IMAGE NAME>
p4thie commented 11 months ago

@mikeb-btw I was trying to run pip command in the docker environment after building the image (this is what I meant by resolving the conflict ...). Your solution is a lot better than that. For now, anyone has the similar problem might want to modify Dockerfile as you did, then wait for the fix by the nougat team. Thanks a lot!

fqassemi commented 7 months ago

This fix might help: https://github.com/facebookresearch/nougat/pull/208