Skip to content

Trying to run basic examples, but I think I have some issues with my config #177

@NicolasVidal

Description

@NicolasVidal

Hello there :)
I wanted to give this crate a go and was attracted by the apparent simplijcity of usage.
I downloaded libtorch 1.5 from pytorch website and filled the corresponding Environment Variables
I tried to start a new cargo project and just put :

[dependencies]
tch = "0.1.6"

in my cargo.toml file.

I used the first main in example :

extern crate tch;
use tch::Tensor;

fn main() {
    let t = Tensor::of_slice(&[3, 1, 4, 1, 5]);
    let t = t * 2;
    t.print();
}

When I try to run it I encounter som compilation issue :

   Compiling torch-sys v0.1.6
error: failed to run custom build command for `torch-sys v0.1.6`

Caused by:
  process didn't exit successfully: `F:\RustProjects\tt_torch_rl_demo\target\debug\build\torch-sys-d475e3cf6635366d\build-script-build` (exit code: 1)
--- stdout
cargo:rustc-link-search=native=C:\SDKs\libtorch\libtorch-1.5\lib
TARGET = Some("x86_64-pc-windows-msvc")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-pc-windows-msvc")
CXX_x86_64-pc-windows-msvc = None
CXX_x86_64_pc_windows_msvc = None
HOST_CXX = None
CXX = None
CXXFLAGS_x86_64-pc-windows-msvc = None
CXXFLAGS_x86_64_pc_windows_msvc = None
HOST_CXXFLAGS = None
CXXFLAGS = None
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
DEBUG = Some("true")
running: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-Z7" "-Brepro" "-I" "C:\\SDKs\\libtorch\\libtorch-1.5\\include" "-I" "C:\\SDKs\\libtorch\\libtorch-1.5\\include/torch/csrc/api/include" "-FoF:\\RustProjects\\tt_torch_rl_demo\\target\\debug\\build\\torch-sys-51e7d731766f4f38\\out\\libtch/torch_api.o" "-c" "libtch/torch_api.cpp"
torch_api.cpp
C:\SDKs\libtorch\libtorch-1.5\include\torch\csrc\api\include\torch/data/worker_exception.h(18): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
libtch/torch_api.cpp(380): error C2248: 'torch::autograd::Engine::Engine': cannot access protected member declared in class 'torch::autograd::Engine'
C:\SDKs\libtorch\libtorch-1.5\include\torch/csrc/autograd/engine.h(213): note: see declaration of 'torch::autograd::Engine::Engine'
C:\SDKs\libtorch\libtorch-1.5\include\torch/csrc/autograd/engine.h(159): note: see declaration of 'torch::autograd::Engine'
libtch/torch_api.cpp(394): error C2039: 'beta1': is not a member of 'torch::optim::AdamOptions'
C:\SDKs\libtorch\libtorch-1.5\include\torch\csrc\api\include\torch/optim/adam.h(21): note: see declaration of 'torch::optim::AdamOptions'
libtch/torch_api.cpp(394): error C3536: 'options': cannot be used before it is initialized
libtch/torch_api.cpp(450): error C2039: 'options': is not a member of 'torch::optim::Adam'
C:\SDKs\libtorch\libtorch-1.5\include\torch\csrc\api\include\torch/optim/adam.h(49): note: see declaration of 'torch::optim::Adam'
libtch/torch_api.cpp(450): error C2039: 'options': is not a member of 'torch::optim::RMSprop'
C:\SDKs\libtorch\libtorch-1.5\include\torch\csrc\api\include\torch/optim/rmsprop.h(54): note: see declaration of 'torch::optim::RMSprop'
libtch/torch_api.cpp(450): error C2039: 'options': is not a member of 'torch::optim::SGD'
C:\SDKs\libtorch\libtorch-1.5\include\torch\csrc\api\include\torch/optim/sgd.h(48): note: see declaration of 'torch::optim::SGD'
libtch/torch_api.cpp(463): error C2039: 'options': is not a member of 'torch::optim::Adam'
C:\SDKs\libtorch\libtorch-1.5\include\torch\csrc\api\include\torch/optim/adam.h(49): note: see declaration of 'torch::optim::Adam'
libtch/torch_api.cpp(463): error C2039: 'options': is not a member of 'torch::optim::RMSprop'
C:\SDKs\libtorch\libtorch-1.5\include\torch\csrc\api\include\torch/optim/rmsprop.h(54): note: see declaration of 'torch::optim::RMSprop'
libtch/torch_api.cpp(463): error C2039: 'options': is not a member of 'torch::optim::SGD'
C:\SDKs\libtorch\libtorch-1.5\include\torch\csrc\api\include\torch/optim/sgd.h(48): note: see declaration of 'torch::optim::SGD'
libtch/torch_api.cpp(699): error C2039: 'isGenericList': is not a member of 'c10::IValue'
C:\SDKs\libtorch\libtorch-1.5\include\torch/csrc/jit/runtime/interpreter.h(13): note: see declaration of 'c10::IValue'
libtch/torch_api.cpp(751): error C2039: 'isGenericList': is not a member of 'c10::IValue'
C:\SDKs\libtorch\libtorch-1.5\include\torch/csrc/jit/runtime/interpreter.h(13): note: see declaration of 'c10::IValue'
libtch/torch_api.cpp(751): error C2039: 'toGenericList': is not a member of 'c10::IValue'
C:\SDKs\libtorch\libtorch-1.5\include\torch/csrc/jit/runtime/interpreter.h(13): note: see declaration of 'c10::IValue'
libtch/torch_api.cpp(785): error C2039: 'toGenericList': is not a member of 'c10::IValue'
C:\SDKs\libtorch\libtorch-1.5\include\torch/csrc/jit/runtime/interpreter.h(13): note: see declaration of 'c10::IValue'
libtch/torch_api.cpp(785): error C3536: 'vec': cannot be used before it is initialized
libtch/torch_api.cpp(785): error C2109: subscript requires array or pointer type
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(878): error C2039: '_test_optional_float': is not a member of 'torch'
C:\SDKs\libtorch\libtorch-1.5\include\torch/custom_class.h(18): note: see declaration of 'torch'
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(878): error C3861: '_test_optional_float': identifier not found
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(2364): error C2039: 'cudnn_convolution_backward_bias': is not a member of 'torch'
C:\SDKs\libtorch\libtorch-1.5\include\torch/custom_class.h(18): note: see declaration of 'torch'
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(2364): error C3861: 'cudnn_convolution_backward_bias': identifier not found
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(2392): error C2039: 'cudnn_convolution_transpose_backward_bias': is not a member of 'torch'
C:\SDKs\libtorch\libtorch-1.5\include\torch/custom_class.h(18): note: see declaration of 'torch'
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(2392): error C3861: 'cudnn_convolution_transpose_backward_bias': identifier not found
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(3703): error C2039: 'imag_out': is not a member of 'torch'
C:\SDKs\libtorch\libtorch-1.5\include\torch/custom_class.h(18): note: see declaration of 'torch'
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(3703): error C3861: 'imag_out': identifier not found
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(3985): error C2660: 'at::leaky_relu_backward': function does not take 3 arguments
C:\SDKs\libtorch\libtorch-1.5\include\ATen/Functions.h(14254): note: see declaration of 'at::leaky_relu_backward'
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(3988): error C3536: 'outputs__': cannot be used before it is initialized
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(3985): error C2664: 'at::Tensor::Tensor(at::Tensor &&)': cannot convert argument 1 from 'int' to 'c10::intrusive_ptr<c10::TensorImpl,c10::UndefinedTensorImpl>'
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(3988): note: No constructor could take the source type, or constructor overload resolution was ambiguous
C:\SDKs\libtorch\libtorch-1.5\include\ATen/core/TensorBody.h(85): note: see declaration of 'at::Tensor::Tensor'
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(3992): error C2039: 'leaky_relu_backward_out': is not a member of 'torch'
C:\SDKs\libtorch\libtorch-1.5\include\torch/custom_class.h(18): note: see declaration of 'torch'
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(3992): error C3861: 'leaky_relu_backward_out': identifier not found
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(5958): error C2039: 'real_out': is not a member of 'torch'
C:\SDKs\libtorch\libtorch-1.5\include\torch/custom_class.h(18): note: see declaration of 'torch'
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(5958): error C3861: 'real_out': identifier not found
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(6382): error C2660: 'at::rrelu_with_noise_backward': function does not take 6 arguments
C:\SDKs\libtorch\libtorch-1.5\include\ATen/Functions.h(14406): note: see declaration of 'at::rrelu_with_noise_backward'
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(6385): error C3536: 'outputs__': cannot be used before it is initialized
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(6382): error C2664: 'at::Tensor::Tensor(at::Tensor &&)': cannot convert argument 1 from 'int' to 'c10::intrusive_ptr<c10::TensorImpl,c10::UndefinedTensorImpl>'
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(6385): note: No constructor could take the source type, or constructor overload resolution was ambiguous
C:\SDKs\libtorch\libtorch-1.5\include\ATen/core/TensorBody.h(85): note: see declaration of 'at::Tensor::Tensor'
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(6389): error C2039: 'rrelu_with_noise_backward_out': is not a member of 'torch'
C:\SDKs\libtorch\libtorch-1.5\include\torch/custom_class.h(18): note: see declaration of 'torch'
C:\Users\vidal\.cargo\registry\src\github.com-1ecc6299db9ec823\torch-sys-0.1.6\libtch\torch_api_generated.cpp.h(6389): error C3861: 'rrelu_with_noise_backward_out': identifier not found
exit code: 2

--- stderr


error occurred: Command "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-Z7" "-Brepro" "-I" "C:\\SDKs\\libtorch\\libtorch-1.5\\include" "-I" "C:\\SDKs\\libtorch\\libtorch-1.5\\include/torch/csrc/api/include" "-FoF:\\RustProjects\\tt_torch_rl_demo\\target\\debug\\build\\torch-sys-51e7d731766f4f38\\out\\libtch/torch_api.o" "-c" "libtch/torch_api.cpp" with args "cl.exe" did not execute successfully (status code exit code: 2).

Do you have any idea of what I should do or what is missing on my system ?

I'm on Windows 10
using CLion with rust plugin

Thank you in advance.

Nicolas

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions