LaurentMazare / tch-rs

Rust bindings for the C++ api of PyTorch.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Installation Issues?

JewishLewish opened this issue · comments

error: failed to run custom build command for `torch-sys v0.14.0`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `C:\Users\PCName\Desktop\VS-Code\Otis\target\debug\build\torch-sys-5fcd1056113e7b81\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-env-changed=LIBTORCH_USE_PYTORCH
  cargo:rerun-if-env-changed=LIBTORCH

  --- stderr
  Error: 
  Cannot find a libtorch install, you can either:
  - Install libtorch manually and set the LIBTORCH environment variable to appropriate path.
  - Use a system wide install in /usr/lib/libtorch.so.
  - Use a Python environment with PyTorch installed by setting LIBTORCH_USE_PYTORCH=1

  See the readme for more details:
  https://github.com/LaurentMazare/tch-rs/blob/main/README.md


  Stack backtrace:
     0: std::backtrace_rs::backtrace::dbghelp::trace
               at /rustc/4578435e1695863d921c7763d5a0add98f8e3869/library\std\src\..\..\backtrace\src\backtrace\dbghelp.rs:98
     1: std::backtrace_rs::backtrace::trace_unsynchronized
               at /rustc/4578435e1695863d921c7763d5a0add98f8e3869/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
     2: std::backtrace::Backtrace::create
               at /rustc/4578435e1695863d921c7763d5a0add98f8e3869/library\std\src\backtrace.rs:331
     3: std::backtrace::Backtrace::capture
               at /rustc/4578435e1695863d921c7763d5a0add98f8e3869/library\std\src\backtrace.rs:297
     4: anyhow::kind::Adhoc::new
     5: build_script_build::SystemInfo::check_system_location::{{closure}}
     6: <core::result::Result<T,E> as std::process::Termination>::report
     7: build_script_build::SystemInfo::check_system_location::{{closure}}
     8: core::ops::function::FnOnce::call_once
     9: std::sys_common::backtrace::__rust_begin_short_backtrace
    10: std::rt::lang_start::{{closure}}
    11: std::rt::lang_start_internal::closure$2
               at /rustc/4578435e1695863d921c7763d5a0add98f8e3869/library\std\src\rt.rs:148
    12: std::panicking::try::do_call
               at /rustc/4578435e1695863d921c7763d5a0add98f8e3869/library\std\src\panicking.rs:504
    13: std::panicking::try
               at /rustc/4578435e1695863d921c7763d5a0add98f8e3869/library\std\src\panicking.rs:468
    14: std::panic::catch_unwind
               at /rustc/4578435e1695863d921c7763d5a0add98f8e3869/library\std\src\panic.rs:142
    15: std::rt::lang_start_internal
               at /rustc/4578435e1695863d921c7763d5a0add98f8e3869/library\std\src\rt.rs:148
    16: std::rt::lang_start
    17: main
    18: invoke_main
               at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
    19: __scrt_common_main_seh
               at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
    20: BaseThreadInitThunk
    21: RtlUserThreadStart

I checked my $env paths (on Windows) and found that everything should be setup properly:

``
LIBTORCH_USE_PYTORCH           1
LIBTORCH                       C:\Users\PCName\Desktop\VS-Code\Otis\libtorch
``

My Libtorch (that I installed) is a Stable 2.1.0, Windows, LibTorch, C++/Java and for CPU

I did run the 2nd powershell command $Env:Path += ";C:\Users\PCNAME\Desktop\VS-Code\Otis\libtorch\bin" however I cannot seem to find it when running Get-ChildItem env:

I tried to use PyTorch because I already have the package (and knows it works because I already ran a model with it)

So I am rather confused on what I should do? I read the readme and couldn't find any videos on how to install it step-by-step.

Update; Managed to get it running.