Bug: [W NNPACK.cpp:80] Could not initialize NNPACK! Reason: Unsupported hardware

Yes, this would be expected, as the env variable doesn’t have any effect on the pre-built pip wheels, so you would need to build PyTorch from source with this env var.

Thanks @ptrblck for the clarification! Now I get what you mean.

One more question: I built from source by the steps at GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration. The installation finishes, but it seems CUDA is not “linked” to my installation:

import torch

gives False. Then, running something that requires CUDA will give no gpu device available.

I then saw your answer at Can I "link" pytorch to already installed CUDA - #7 by ptrblck. Is this related? How should I build from source to “link” CUDA to my build? For your reference, the commands I used to build were

export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
export USE_NNPACK=0; python setup.py develop


Your local CUDA toolkit should be detected automatically. If that’s not the case, set the location via the env var e.g. to:


in case you are using the default location.
The install log would then also show the detected CUDA toolkit version as well as its location.

Hello, I create a venv, downloaded the lastest yolov5 version from Ultralytics and runs pip install -r requirements.txt and it runs ok when i run: python detect.py with the parameters.


I also had this problem when I was training yolov8 with a Macbook M1 pro chip, but the training process worked fine. Does this mean I can ignore this warning.

Thanks for your reply,

Yes, you might ignore the warning as NNPACK does not seem to support macOS on ARM as seen here. I don’t know which code path or accelerator library will be picked instead on your Macbook, but if the training continues I assume a fallback is taken.

1 Like

I didn’t use an accelerator, but simply let it train on my Macbook. I’m guessing that if the training can run continuously, does that mean the warning doesn’t affect the results so I can ignore it.

Yes, that’s what I would assume so.
The warning is raised from init_nnpack via _nnpack_available which is used to determine the dispatching path for convolutions as seen here. Based on this logic the NNPACK path will be skipped after raising the warning once and the “slow” path will be picked.

1 Like

Oh, I see, this warning means that NNPACK can’t pick the “fast” path, it can only use the “slow” path, so the training speed will be slow, but it doesn’t affect the training result.

1 Like