hukkelas / DeepPrivacy

DeepPrivacy: A Generative Adversarial Network for Face Anonymization
MIT License
1.27k stars 171 forks source link

Docker build fails: missing cuda #46

Closed Morgy93 closed 3 years ago

Morgy93 commented 3 years ago

Hello,

I just tried to build the docker image, but sadly it fails:

 => ERROR [ 8/14] RUN pip install -e /detectron2_repo                                                                                                                                                                                                   3.6s
------
 > [ 8/14] RUN pip install -e /detectron2_repo:
#12 1.137 Obtaining file:///detectron2_repo
#12 3.374     ERROR: Command errored out with exit status 1:
#12 3.374      command: /opt/conda/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/detectron2_repo/setup.py'"'"'; __file__='"'"'/detectron2_repo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info
#12 3.374          cwd: /detectron2_repo/
#12 3.374     Complete output (6 lines):
#12 3.374     Traceback (most recent call last):
#12 3.374       File "<string>", line 1, in <module>
#12 3.374       File "/detectron2_repo/setup.py", line 15, in <module>
#12 3.374         assert torch_ver >= [1, 6], "Requires PyTorch >= 1.6"
#12 3.374     AssertionError: Requires PyTorch >= 1.6
#12 3.374     No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda'
#12 3.374     ----------------------------------------
#12 3.375 ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
------
executor failed running [/bin/sh -c pip install -e /detectron2_repo]: exit code: 1

It says No CUDA runtime is found but that's not mentioned in the requirements. Do I need to install it manually or what's the case here?

hukkelas commented 3 years ago

To build with docker it requires cuda and a NVIDIA GPU installed. If you have a nvidia gpu, please follow nvidia docker instructions for installation: https://github.com/NVIDIA/nvidia-docker

Otherwise, I recommend you to use the pip installer python setup.py install (see README)

daniele-salerno commented 2 years ago

image

Error still persists also in a GPU environment

hukkelas commented 2 years ago

The error is that detectron2 has bumped its requirement to >= 1.6, where the NGC container includes pytorch 1.5. Can you try to upgrade the NGC container? By replacing

FROM nvcr.io/nvidia/pytorch:20.03-py3

with:

FROM nvcr.io/nvidia/pytorch:22.08-py3
daniele-salerno commented 2 years ago

image

Now i have this error

Could you freeze your requirements.txt from your docker?

daniele-salerno commented 2 years ago

image

ps: to avoid this i added ENV DEBIAN_FRONTEND=nonintercative

hukkelas commented 2 years ago

Did you get it working, otherwise, this docker image should work:

FROM nvcr.io/nvidia/pytorch:22.08-py3
ENV DEBIAN_FRONTEND=nonintercative
ENV FORCE_CUDA="1"
ENV TORCH_HOME=/workspace

RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 ffmpeg -y
RUN pip install  cython tqdm moviepy opencv-python pyyaml scikit-image albumentations addict 
RUN pip install 'git+https://github.com/facebookresearch/detectron2.git@0703e08a5f589f7503a3fbfce41309c80204eec8'
WORKDIR /workspace
RUN mkdir /pytorch_models
RUN pip install git+https://github.com/hukkelas/DSFD-Pytorch-Inference.git
RUN pip install opencv-python==4.5.5.64
daniele-salerno commented 2 years ago

it works, thanks

hukkelas commented 2 years ago

Good! I've now updated the Dockerfile in master. Let me know if you bump into any other dependency issues :)