I just hard-coded version of the Python that was detected wrong to 3.8
And then build starts but faced with another issue:
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/redra/Projects/AI/pytorch/third_party/python-peachpy/peachpy/x86_64/__main__.py", line 280, in <module>
    main()
  File "/home/redra/Projects/AI/pytorch/third_party/python-peachpy/peachpy/x86_64/__main__.py", line 267, in main
[ 57%] Built target XNNPACK
    execute_script(writers, options.input[0])
  File "/home/redra/Projects/AI/pytorch/third_party/python-peachpy/peachpy/x86_64/__main__.py", line 198, in execute_script
    execute_script(writers, source_filename)
  File "/home/redra/Projects/AI/pytorch/third_party/python-peachpy/peachpy/x86_64/__main__.py", line 198, in execute_script
    execute_script(writers, source_filename)
  File "/home/redra/Projects/AI/pytorch/third_party/python-peachpy/peachpy/x86_64/__main__.py", line 202, in execute_script
    exec(code, globals())
  File "/home/redra/Projects/AI/pytorch/third_party/NNPACK/src/x86_64-fma/2d-fourier-8x8.py", line 5, in <module>
    import fft.complex_soa
  File "/home/redra/Projects/AI/pytorch/third_party/NNPACK/src/x86_64-fma/fft/complex_soa.py", line 7, in <module>
    from common import cos_npi_over_8, sin_npi_over_8, cos_npi_over_4, sin_npi_over_4
ImportError: cannot import name 'cos_npi_over_8' from 'common' (/home/redra/.local/lib/python3.8/site-packages/common/__init__.py)
[ 57%] Building C object sleef/src/libm/CMakeFiles/sleefavx512fnofma.dir/sleefsimddp.c.o
[ 57%] Building CXX object caffe2/proto/CMakeFiles/Caffe2_PROTO.dir/caffe2.pb.cc.o
make[2]: *** [confu-deps/NNPACK/CMakeFiles/nnpack.dir/build.make:81: confu-deps/NNPACK/src/x86_64-fma/2d-fourier-8x8.py.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:3282: confu-deps/NNPACK/CMakeFiles/nnpack.dir/all] Error 2

Seems like this is related to sudo make install -- ImportError: cannot import name cos_npi_over_8 · Issue #2296 · facebookarchive/caffe2 · GitHub 1