What is the proper way to use pytorch and matplotlib with MKL on Windows?
Is there any clear instruction on how to actually make this work?
The error message I get is:

Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.

It seems, there are only workarounds, such as to opt out from MKL altogether (not to mention, say, nomkl is not available on Windows) or
import os

os.environ['KMP_DUPLICATE_LIB_OK']='True'

which is nasty.

If you have conda and pip installed on your machine. Please try installing by creating a new conda environment. You could try the below steps  (which I have validated from my end) to install matplotlib and pytorch (with mkl).
conda create -n myenv
conda activate myenv
conda install pytorch torchvision torchaudio cpuonly -c pytorch
C:\Users\{USERNAME}\.conda\envs\myenv\python.exe -m pip install matplotlib==2.2.5

Once installed I verified pytorch uses mkl with the below command
&gt;&gt;&gt; import torch
&gt;&gt;&gt; torch.__config__.show()
'PyTorch built with:\n  - C++ Version: 199711\n  - MSVC 192829337\n  - Intel(R) Math Kernel Library Version 2020.0.2 Product Build 20200624 for Intel(R) 64 architecture applications\n  - Intel(R) MKL-DNN v2.2.3 (Git Hash 7336ca9f055cf1bfa13efb658fe15dc9b41f0740)\n  - OpenMP 2019\n  - LAPACK is enabled (usually provided by MKL)\n  - CPU capability usage: AVX2\n  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CXX_COMPILER=C:/cb/pytorch_1000000000000/work/tmp_bin/sccache-cl.exe, CXX_FLAGS=/DWIN32 /D_WINDOWS /GR /EHsc /w /bigobj -DUSE_PTHREADPOOL -openmp:experimental -IC:/cb/pytorch_1000000000000/work/mkl/include -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DUSE_FBGEMM -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.10.0, USE_CUDA=0, USE_CUDNN=OFF, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=OFF, USE_NNPACK=OFF, USE_OPENMP=ON, \n'

