简体   繁体   中英

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="v1.8.1"
RUN git clone --recursive --branch ${PYTORCH_INST_VERSION} https://github.com/pytorch/pytorch pytorch-src && \
    cd pytorch-src && \
    export MAX_JOBS=$((`nproc` - 2)) && \
    export TORCH_CUDA_ARCH_LIST=${CUDA_ARCH} && \
    python3 setup.py install --prefix=/opt/pytorch && \
    cp -r /opt/pytorch/lib/python3.8/site-packages/* /usr/lib/python3/dist-packages/ && \
    cd /opt && \
    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.

I had the same problem yesterday, I reinstalled pytorch for my system copying the suitable command as instructed (you should choose the parameters suits your system) check here https://pytorch.org/#:~:text=conda%20install%20pytorch%20torchvision%20torchaudio%20cpuonly%20%2Dc%20pytorch when I run my script again the problem was gone

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM