dribnet / pixray

neural image generation
Other
402 stars 53 forks source link

Fails to build Cog image: executor failed running [/bin/sh -c pip install -r /tmp/requirements.txt && rm /tmp/requirements.txt]: exit code: 137 #42

Closed metalaureate closed 2 years ago

metalaureate commented 2 years ago

Any pointers on getting it to build on Cog/Docker?

% cog run python pixray.py --drawer=pixel --prompt=sunrise --output myfile.png

Building Docker image from environment in cog.yaml...
[+] Building 103.3s (15/17)                                                                                                                             
 => [internal] load build definition from Dockerfile                                                                                               0.0s
 => => transferring dockerfile: 1.57kB                                                                                                             0.0s
 => [internal] load .dockerignore                                                                                                                  0.0s
 => => transferring context: 2B                                                                                                                    0.0s
 => resolve image config for docker.io/docker/dockerfile:1.2                                                                                       2.3s
 => [auth] docker/dockerfile:pull token for registry-1.docker.io                                                                                   0.0s
 => CACHED docker-image://docker.io/docker/dockerfile:1.2@sha256:e2a8561e419ab1ba6b2fe6cbdf49fd92b95912df1cf7d313c3e2230a333fdbcc                  0.0s
 => [internal] load metadata for docker.io/nvidia/cuda:10.2-cudnn8-devel-ubuntu18.04                                                               0.6s
 => [auth] nvidia/cuda:pull token for registry-1.docker.io                                                                                         0.0s
 => [stage-0 1/9] FROM docker.io/nvidia/cuda:10.2-cudnn8-devel-ubuntu18.04@sha256:9843db9f92253080bcaad66e44cf8f5e9fbfef3291e10f854d5e226699cca5d  0.0s
 => [internal] load build context                                                                                                                  0.0s
 => => transferring context: 16.35kB                                                                                                               0.0s
 => CACHED [stage-0 2/9] RUN --mount=type=cache,target=/var/cache/apt apt-get update -qq && apt-get install -qqy --no-install-recommends  make  b  0.0s
 => CACHED [stage-0 3/9] RUN curl https://pyenv.run | bash &&  git clone https://github.com/momo-lab/pyenv-install-latest.git "$(pyenv root)"/plu  0.0s
 => CACHED [stage-0 4/9] COPY .cog/tmp/build4193742389/cog-0.0.1.dev-py3-none-any.whl /tmp/cog-0.0.1.dev-py3-none-any.whl                          0.0s
 => CACHED [stage-0 5/9] RUN --mount=type=cache,target=/root/.cache/pip pip install /tmp/cog-0.0.1.dev-py3-none-any.whl                            0.0s
 => CACHED [stage-0 6/9] COPY requirements.txt /tmp/requirements.txt                                                                               0.0s
 => ERROR [stage-0 7/9] RUN --mount=type=cache,target=/root/.cache/pip pip install -r /tmp/requirements.txt && rm /tmp/requirements.txt           99.7s
------                                                                                                                                                  
 > [stage-0 7/9] RUN --mount=type=cache,target=/root/.cache/pip pip install -r /tmp/requirements.txt && rm /tmp/requirements.txt:                       
#15 1.899 Looking in links: https://download.pytorch.org/whl/torch_stable.html                                                                          
#15 1.909 Collecting git+https://github.com/bfirsh/taming-transformers.git@7a6e64ee (from -r /tmp/requirements.txt (line 24))                           
#15 1.911   Cloning https://github.com/bfirsh/taming-transformers.git (to revision 7a6e64ee) to /tmp/pip-req-build-gifi16k8
#15 1.911   Running command git clone -q https://github.com/bfirsh/taming-transformers.git /tmp/pip-req-build-gifi16k8
#15 19.36   WARNING: Did not find branch or tag '7a6e64ee', assuming revision or ref.
#15 19.37   Running command git checkout -q 7a6e64ee
#15 20.27 Collecting git+https://github.com/openai/CLIP@573315e (from -r /tmp/requirements.txt (line 25))
#15 20.27   Cloning https://github.com/openai/CLIP (to revision 573315e) to /tmp/pip-req-build-r445l8i3
#15 20.28   Running command git clone -q https://github.com/openai/CLIP /tmp/pip-req-build-r445l8i3
#15 21.91   WARNING: Did not find branch or tag '573315e', assuming revision or ref.
#15 21.91   Running command git checkout -q 573315e
#15 22.28 Collecting git+https://github.com/pvigier/perlin-numpy@6f077f8 (from -r /tmp/requirements.txt (line 26))
#15 22.29   Cloning https://github.com/pvigier/perlin-numpy (to revision 6f077f8) to /tmp/pip-req-build-c575k4q6
#15 22.29   Running command git clone -q https://github.com/pvigier/perlin-numpy /tmp/pip-req-build-c575k4q6
#15 23.62   WARNING: Did not find branch or tag '6f077f8', assuming revision or ref.
#15 23.62   Running command git checkout -q 6f077f8
#15 23.97 Collecting git+https://github.com/fbcotter/pytorch_wavelets (from -r /tmp/requirements.txt (line 42))
#15 23.98   Cloning https://github.com/fbcotter/pytorch_wavelets to /tmp/pip-req-build-wgmygv_3
#15 23.98   Running command git clone -q https://github.com/fbcotter/pytorch_wavelets /tmp/pip-req-build-wgmygv_3
#15 25.98 Collecting git+https://github.com/pixray/aphantasia@d7d43a8 (from -r /tmp/requirements.txt (line 48))
#15 25.99   Cloning https://github.com/pixray/aphantasia (to revision d7d43a8) to /tmp/pip-req-build-4ck41u12
#15 25.99   Running command git clone -q https://github.com/pixray/aphantasia /tmp/pip-req-build-4ck41u12
#15 30.97   WARNING: Did not find branch or tag 'd7d43a8', assuming revision or ref.
#15 30.98   Running command git checkout -q d7d43a8
#15 32.98 Collecting torch==1.9.0+cu102
#15 33.00   Downloading https://download.pytorch.org/whl/cu102/torch-1.9.0%2Bcu102-cp38-cp38-linux_x86_64.whl (831.4 MB)
#15 97.89 /root/.pyenv/pyenv.d/exec/pip-rehash/pip: line 20:    71 Killed                  "$PYENV_COMMAND_PATH" "$@"
------
executor failed running [/bin/sh -c pip install -r /tmp/requirements.txt && rm /tmp/requirements.txt]: exit code: 137
ⅹ Failed to build Docker image: exit status 1
dribnet commented 2 years ago

Thanks - note that in the meantime you can use pip with the included requirements.txt file which also generally works.

metalaureate commented 2 years ago

Thank you for the note! I couldn’t get the requirements.txt to install locally, which was why I was trying the Docker route (Mac). Any advice?

dribnet commented 2 years ago

Not a cog expert, but @zeke might be able to help.

zeke commented 2 years ago

cc @bfirsh @andreasjansson

metalaureate commented 2 years ago

The error I get when I try to install locally on a fresh conda environment (Python 3.9) is

ERROR: Could not find a version that satisfies the requirement torch==1.9.0+cu102 (from versions: 1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.10.0)
ERROR: No matching distribution found for torch==1.9.0+cu102

This appears to be the same error that is killing the docker image build.

metalaureate commented 2 years ago

I got it working (hooray!) locally by removing the +cu102 and remembering to execute the # DO THIS comment for installing diffvg, and also randomly needing to install googletrans. I think Cog is really awesome idea and I would love to use it for this if we could figure that out (I mean, it is meant to solve for this exact kind of problem case!).

dribnet commented 2 years ago

Great - if you don't have GPU then you might want to start with quality=draft which will be less resource intensive.