piwheels / packages

Issue tracker for piwheels package issues
https://github.com/piwheels/packages/issues
20 stars 5 forks source link

Missing package: torch #213

Open josuuribe opened 3 years ago

josuuribe commented 3 years ago

Package name: torch Issue type: Missing package Link to PyPI page: https://pypi.org/project/torch/ Link to piwheels page: https://www.piwheels.org/project/torch/ Version: 1.8.1 Python version: 3.7 I am the maintainer: No More information:

This package is missing, it's useful for ml and AI projects

More Info for build https://github.com/pytorch/pytorch#from-source

josuuribe commented 3 years ago

FROM arm32v7/debian:latest

ARG DEBIAN_FRONTEND=noninteractive ARG REPO_HOME=/repos ARG PYTORCH_HOME=$REPO_HOME/dist ARG PYTORCH_TAG=v1.8.1

ARG USE_MKLDNN=OFF ARG USE_NNPACK=ON ARG USE_QNNPACK=ON ARG USE_XNNPACK=ON ARG MAX_JOBS=4

RUN apt-get update && apt-get install -y \ libopenblas-dev \ cython3 \ libatlas-base-dev \ m4 \ libblas-dev \ libeigen3-dev \ libblas-dev \ cmake \ build-essential \ python3-dev \ git \ ccache \ ninja-build && \ rm -rf /var/lib/apt/lists/ && \ rm -rf /tmp/

ADD https://bootstrap.pypa.io/get-pip.py get-pip.py RUN python3 get-pip.py RUN python3 -m pip config --global set global.extra-index-url https://www.piwheels.org/simple RUN python3 -m pip install \ pyyaml \ typing_extensions \ numpy \ wheel \ mock \ pillow

WORKDIR $REPO_HOME RUN git clone --recursive https://github.com/pytorch/pytorch.git WORKDIR $REPO_HOME/pytorch RUN git checkout tags/$PYTORCH_TAG -b build RUN git submodule update --init --recursive

WORKDIR $REPO_HOME/pytorch RUN python3 -m pip install -r requirements.txt

RUN PATH=/usr/lib/ccache:$PATH RUN python3 setup.py bdist_wheel

WORKDIR /drop RUN cp $REPO_HOME/pytorch/dist/*.whl .

CMD ["/bin/bash"]

josuuribe commented 3 years ago

Execute with: docker run -dit image_id

Copy wheel from docker image docker cp container_id:/drop .

Now, you can stop container docker container stop container_id

It works for Pytorch 1.8.1, anyway you can switch versions using PYTORCH_TAG while build (set as value the same label as exists in Pytorch GitHub repository)

Original here: https://github.com/josuuribe/RaraAvis/blob/blog/Docker/build/Dockerfile.pytorch

I hope this helps!!

Thanks for your effort with pywheels!