Error with pytorch compilation: LAPACK library not found in compilation. How to solve?
I am already desperate about this problem that I am having.
RuntimeError: inverse: LAPACK library not found in compilation

The easiest way to reproduce it is:
import torch
A = torch.rand(5,5)
torch.inverse(A)

I run this inside a docker container. The part of the dockerfile that compiles pytorch is:
#PyTorch
RUN pip3 install astunparse numpy ninja pyyaml mkl mkl-include setuptools cmake cffi typing_extensions future six requests dataclasses


ENV PYTORCH_INST_VERSION=&quot;v1.8.1&quot;
RUN git clone --recursive --branch ${PYTORCH_INST_VERSION} https://github.com/pytorch/pytorch pytorch-src &amp;&amp; \
    cd pytorch-src &amp;&amp; \
    export MAX_JOBS=$((`nproc` - 2)) &amp;&amp; \
    export TORCH_CUDA_ARCH_LIST=${CUDA_ARCH} &amp;&amp; \
    python3 setup.py install --prefix=/opt/pytorch &amp;&amp; \
    cp -r /opt/pytorch/lib/python3.8/site-packages/* /usr/lib/python3/dist-packages/ &amp;&amp; \
    cd /opt &amp;&amp; \
    rm -rf /opt/pytorch-src

I am not super experienced so I don't know if I need to provide additional details. Please tell me if so.

I solved my own problem.
I added apt-get liblapack-dev on the dockerfile before the torch compilation. Then I runned the docker container again and it worked.
