replicate / cog

Containers for machine learning
https://cog.run
Apache License 2.0
8.07k stars 561 forks source link

[multistage] python binaries not installed into PATH #1390

Open yorickvP opened 11 months ago

yorickvP commented 11 months ago

Starting in cog 0.9.0b1, binaries included with python dependencies are no longer installed. Repro: deepspeed used to install deepspeed binary, doesn't anymore.

yorickvP commented 11 months ago

Spent some time debugging the deps build.

This installs the binaries in principle:

$ pip install -t /dep -r /tmp/requirements.txt
$ ls /dep/bin
accelerate      cpack         ds_bench    fonttools    jsonschema   pyftmerge   transformers-cli  wb
accelerate-config   cpuinfo       ds_elastic  gradio       lit      pyftsubset  ttx           wheel
accelerate-launch   ctest         ds_report   hjson        markdown-it  pygmentize  upload_theme
cmake           deepspeed     ds_ssh      httpx        markdown2    shortuuid   uvicorn
convert-caffe2-to-onnx  deepspeed.pt  dsr     huggingface-cli  ninja    torchrun    wandb
convert-onnx-to-caffe2  ds        f2py    isympy       normalizer   tqdm        wavedrompy

However, cog's doing:

$ pip install -t /dep /tmp/cog-0.0.1.dev-py3-none-any.whl
$ pip install -t /dep -r /tmp/requirements.txt
$ ls /dep/bin
dotenv normalizer uvicorn watchfiles

This then gets to the final image as:

root@948a06b767ed:/src# ls /root/.pyenv/versions/3.11.6/lib/python3.11/site-packages/bin
dotenv  normalizer  uvicorn  watchfiles

So, 3 problems:

technillogue commented 11 months ago

do you have any suggestions for fixing this?

andreasjansson commented 7 months ago

I think this fixes it:

RUN --mount=type=bind,from=deps,source=/dep,target=/dep cp -rf /dep/bin/* $(pyenv prefix)/bin; pyenv rehash