I eventually resorted in compiling libtorch myself and using it as a pre-built shared library.
Of course I was lucky that our platform was an x86. I wouldn’t want to think what would happen were we using an ARM or something instead.