Bug[wnnpack-cpp-51]-could-not-initialize-nnpack-reason-unsupported-hardware

This error occurs while I run torch on my flask server, can anyone tell me how to solve this problem I am using digital ocean VPS

I guess NNPack depends on some AVX instructions which might not be available on your CPU so you might need to build PyTorch without NNPack.

How to do that because all my packages are installed in a virtualenv.

sudo apt update && sudo apt upgrade
sudo apt install libopenblas-dev libblas-dev m4 cmake cython python3-dev python3-yaml python3-setuptools
cd ~
mkdir pytorch_install && cd pytorch_install
git clone --recursive https://github.com/pytorch/pytorch
cd pytorch

export MAX_JOBS=2
export NO_CUDA=1
export NO_DISTRIBUTED=1
export NO_MKLDNN=1
export USE_NNPACK=0
export USE_QNNPACK=1
export USE_CFLAGS=1
export CFLAGS=’-mfpu=neon-vfpv4 -mtune=cortex-a17 -march=armv7ve -mfloat-abi=hard’

python3 setup.py build # clean first if needed
sudo -E python3 setup.py install

I have tried this method to install the torch but I got this error:

Building wheel torch-1.13.0a0+git942c0f3
– Building version 1.13.0a0+git942c0f3
cmake --build . --target install --config Release – -j 1
gmake: Makefile: No such file or directory
gmake: *** No rule to make target ‘Makefile’. Stop.

from typing_extensions import Literal
ModuleNotFoundError: No module named ‘typing_extensions’
CMake Error at cmake/Codegen.cmake:197 (message):
Failed to get generated_headers list
Call Stack (most recent call first):
caffe2/CMakeLists.txt:2 (include)

Now its giving me the typing_extensions not found

You can either install all dependencies manually via pip install ... or just install them via pip install -r requirements.txt

pytorch_install/pytorch$ pip3 install typing_extensions
Requirement already satisfied: typing_extensions in /home/hamza/xtremeremoval/env/lib/python3.10/site-packages (4.3.0)

But requirement already satisfied

I found one solution to this problem

I have installed cmake on Ubuntu Linux now the server is working fine, the unsupported error has been gone

sudo apt update
sudo apt cmake
check the library:
cmake --version