2

When I tried to install torch in alpine, it report there is no version distribution found for it.

FROM alpine:3.18
ENV PYTHONUNBUFFERED=1
RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python
RUN python3 -m ensurepip
RUN pip3 install --no-cache --upgrade pip setuptools
RUN pip3 install torch # <-- report: Could not find a version that satisfies the requirement torch (from versions: none)
ccd
  • 5,788
  • 10
  • 46
  • 96
  • 1
    Alpine is unlikely to work, because it [uses musl](https://stackoverflow.com/questions/37818831/is-there-a-best-practice-on-setting-up-glibc-on-docker-alpine-linux-base-image) which doesn't have [pthread_attr_setaffinity_np](https://stackoverflow.com/questions/70740411/cannot-import-pytorch-in-alpine-docker-container) (and possibly other members of glibc that Torch might need). If you are dead-set on using Alpine, you could try upgrading [this image](https://github.com/petronetto/pytorch-alpine/blob/master/Dockerfile) (and check that user's repos for the base images) – Zac Anger Jul 24 '23 at 03:08
  • @ZacAnger Thanks for the update. This would make a good answer, you should add it! – Darragh Enright Aug 19 '23 at 13:26

1 Answers1

0

Alpine is unlikely to work, because it uses musl which doesn't have pthread_attr_setaffinity_np (and possibly other members of glibc that Torch might need). If you are dead-set on using Alpine, you could try upgrading this image (and check that user's repos for the base images). But it would be more straightforward to just start with one of the PyTorch images.

Zac Anger
  • 6,983
  • 2
  • 15
  • 42