Issues with building libtorch without python dependencies

Hello!
I am trying to build libtorch on an HPC with very limited python support (no dependencies). Since I am trying to utilize the C++ frontend only and

states that I don’t need python to build libtorch, I am wondering if anybody managed to do it without any python installation before. When I try to configure cmake, I get the following error:

File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/raid/projects/pytorch/tools/codegen/gen.py", line 3, in <module>
    from typing_extensions import Literal
ModuleNotFoundError: No module named 'typing_extensions'

I see that cmake is actually checking my python directories, which is super weird since I don’t want to do anything with python. This is the cmake command that I tried in my build directory:

cmake -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE:STRING=Release -DPYTHON_LIBRARY='' -DCMAKE_INSTALL_PREFIX:PATH=../pytorch-install -DBUILD_PYTHON:BOOL=OFF -DBUILD_TEST=OFF ../pytorch

Any help would be much appreciated. Thanks!