MKL error when building without conda

I am trying to build pytorch from source. I keep getting the following error:

-- Found a library with BLAS API (mkl).
CMake Error at CMakeLists.txt:446 (MESSAGE):
  MKL is used, but MKL header files are not found.  You can get them by
  `conda install mkl-include` if using conda (if it is missing, run `conda
  upgrade -n root conda` first), and `pip install mkl-devel` if using pip.
  If build fails with header files available in the system, please make sure
  that CMake will search the directory containing them, e.g., by setting
  CMAKE_INCLUDE_PATH.

I tried exporting NO_MKLDNN=0, and I still get the above error.
Then I tried installing intel mkl from arch AUR. Exported MKLDNN_LIB_DIR, MKLDNN_LIBRARY, MKLDNN_INCLUDE_DIR, added the library path to PATH and still get the error.

How do I build without MKL?
How do I build with MKL?

MKL and MKLDNN here refer to different libs. The first is used as a BLAS lib, and the second is MKLDNN. So setting NO_MKLDNN doesn’t do anything. Can you just follow the instruction and install the headers please?

I think that you can install mkl-include first via
pip install mkl-include