I installed tch in rust and it doesn't work

I created a simple rust project and imported tch, and it doesn't work, even if the program doesn't use it.

use tch::nn;
fn main() {
    println!("Hello, world!");
}

Although the program compiles, running it produces an error:
The procedure entry point __kmpc_masked could not be located in the dynamic link library C:\libtorch
\torch_cpu.dll
I tried reinstalling cuda to fit the torch version (12.4) I tried playing with the dependencies. The current toml file has the following:

[package]
name = "tch_test"
version = "0.1.0"
edition = "2021"

[dependencies]
tch = {version="0.17.0", path="tch-rs"}

[dev-dependencies]
torch-sys = {version="0.17.0", path="tch-rs/torch-sys"}

However, I also tried just using the dependencies when I installed tch using cargo add (changing the tch to just tch="0.17.0" and that didn't work either.
I tried setting my environment variables, as was shown in the github page, and even tried to add the LIBTORCH_USE_PYTORCH variable as pytorch does work on python on my machine.
I am using a windows 10 machine with an RTX4060. Help will be greatly appreciated.

Thank You!

Few Clarifications: Firstly, when I say that "it didn't work" I mean that the exact same result happened as specified above i.e. The program compiles but running it gives the message above. To be clear: This is a runtime issue not a compile time issue.

Additionaly, I want to clarify that the error above happens when I run the exe manually. When I run it from cmd, it displays the following error instead: process didn't exit successfully: target\debug\tch_test.exe (exit code: 0xc0000139, STATUS_ENTRYPOINT_NOT_FOUND)

Secondly, this is a minimal reproducible example. This was a new project I created from scratch to try to fix this issue. It is just a new project with the tch imported as specified (I tried 2 ways, via cargo add, and via cloning the github repo). There are no extra files beyond that, just the cloned tch-rs, gitignore, lock files that come by default, and the toml file above (which I also tried the default and it didn't work), nothing else.

I tried following the guidelines on the github page GitHub - LaurentMazare/tch-rs: Rust bindings for the C++ api of PyTorch. and this tutorial Rust 🤝🏾 PyTorch - Using LibTorch, tch-rs :: Adhita Selvaraj — Be Kind none worked. I even tried to run the example files in the tch-rs I cloned (without doing any modification to the folder) and it produced the same result.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.