Closed turgut090 closed 5 years ago
Can you try installing libtorch from this address: https://github.com/dfalbel/torch/releases/download/v0.0.1.9000-alpha/libtorch.zip
Something changed with the most recent version from pytorch website and I still didn't figure out why this doesn't work.
Also, please note that this is a very early work in progress project and most torch functionality is not implemented.
Thank you, the link helped so much :-)
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (torch)
I get the same problem. I tried downloading It manually, but it haven't solved the issue.
Sys.setenv(TORCH_HOME="/libtorch")
devtools::install_github("dfalbel/torch")
#> Downloading GitHub repo dfalbel/torch@master
#> from URL https://api.github.com/repos/dfalbel/torch/zipball/master
#> Installing torch
#> '/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file \
#> --no-environ --no-save --no-restore --quiet CMD INSTALL \
#> '/private/var/folders/9z/k3cb3n413gldbcw9bp6tw5t00000gn/T/RtmpznAmoH/devtoolsd45ed497a5d/dfalbel-torch-3f2f260' \
#> --library='/Users/tomas/Library/R/3.5/library' --install-tests
#>
#> Installation failed: Command failed (1)
Created on 2019-03-11 by the reprex package (v0.2.1)
The interactive session is more verbose:
devtools::install_github("dfalbel/torch")
Downloading GitHub repo dfalbel/torch@master
from URL https://api.github.com/repos/dfalbel/torch/zipball/master
Installing torch
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file \
--no-environ --no-save --no-restore --quiet CMD INSTALL \
'/private/var/folders/9z/k3cb3n413gldbcw9bp6tw5t00000gn/T/RtmpbOmi5U/devtoolsd3087d22f9f3/dfalbel-torch-3f2f260' \
--library='/Users/tomas/Library/R/3.5/library' --install-tests
* installing *source* package ‘torch’ ...
----------------------------------------------------------------
TORCH_HOME env var is set - using it: /libtorch
TORCH_HOME directory exists - assuming library already installed
TORCH_BACKEND!='CUDA' - using 'CPU' backend
----------------------------------------------------------------
Using PKG_LIBS=-L/libtorch/lib -Wl,-rpath,/libtorch/lib -ltorch
Using PKG_CFLAGS=-I/libtorch/include -I/libtorch/include/torch/csrc/api/include
----------------------------------------------------------------
** libs
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/libtorch/include -I/libtorch/include/torch/csrc/api/include -D_GLIBCXX_USE_CXX11_ABI=0 -I"/Users/tomas/Library/R/3.5/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/libtorch/include -I/libtorch/include/torch/csrc/api/include -D_GLIBCXX_USE_CXX11_ABI=0 -I"/Users/tomas/Library/R/3.5/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c cuda.cpp -o cuda.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/libtorch/include -I/libtorch/include/torch/csrc/api/include -D_GLIBCXX_USE_CXX11_ABI=0 -I"/Users/tomas/Library/R/3.5/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c grad_mode.cpp -o grad_mode.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/libtorch/include -I/libtorch/include/torch/csrc/api/include -D_GLIBCXX_USE_CXX11_ABI=0 -I"/Users/tomas/Library/R/3.5/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c tensor.cpp -o tensor.o
tensor.cpp:115:19: error: no matching member function for call to 'to'
tensor = tensor.to(options);
~~~~~~~^~
/libtorch/include/ATen/core/TensorMethods.h:1208:23: note: candidate function not viable: no known conversion from 'torch::TensorOptions' to 'at::ScalarType' for 1st argument
inline Tensor Tensor::to(ScalarType dtype, bool non_blocking) const {
^
/libtorch/include/ATen/core/TensorMethods.h:1211:23: note: candidate function not viable: no known conversion from 'torch::TensorOptions' to 'at::Device' for 1st argument
inline Tensor Tensor::to(Device device, bool non_blocking) const {
^
/libtorch/include/ATen/core/TensorMethods.h:1214:23: note: candidate function not viable: no known conversion from 'torch::TensorOptions' to 'const at::Tensor' for 1st argument
inline Tensor Tensor::to(const Tensor & other, bool non_blocking) const {
^
/libtorch/include/ATen/core/TensorMethods.h:1205:23: note: candidate function not viable: requires at least 2 arguments, but 1 was provided
inline Tensor Tensor::to(Device device, ScalarType dtype, bool non_blocking) const {
^
tensor.cpp:127:19: error: no matching member function for call to 'to'
tensor = tensor.to(tensor_options_(dtype, R_NilValue, device, R_NilValue));
~~~~~~~^~
/libtorch/include/ATen/core/TensorMethods.h:1208:23: note: candidate function not viable: no known conversion from 'torch::TensorOptions' to 'at::ScalarType' for 1st argument
inline Tensor Tensor::to(ScalarType dtype, bool non_blocking) const {
^
/libtorch/include/ATen/core/TensorMethods.h:1211:23: note: candidate function not viable: no known conversion from 'torch::TensorOptions' to 'at::Device' for 1st argument
inline Tensor Tensor::to(Device device, bool non_blocking) const {
^
/libtorch/include/ATen/core/TensorMethods.h:1214:23: note: candidate function not viable: no known conversion from 'torch::TensorOptions' to 'const at::Tensor' for 1st argument
inline Tensor Tensor::to(const Tensor & other, bool non_blocking) const {
^
/libtorch/include/ATen/core/TensorMethods.h:1205:23: note: candidate function not viable: requires at least 2 arguments, but 1 was provided
inline Tensor Tensor::to(Device device, ScalarType dtype, bool non_blocking) const {
^
tensor.cpp:686:29: error: no member named 'cholesky' in 'at::Tensor'
return make_tensor_ptr(x->cholesky(upper));
~ ^
tensor.cpp:849:29: error: no member named 'diag_embed' in 'at::Tensor'
return make_tensor_ptr(x->diag_embed(offset, dim1, dim2));
~ ^
tensor.cpp:925:10: error: no matching function for call to 'caffe_type_to_string'
return caffe_type_to_string(x->dtype());
^~~~~~~~~~~~~~~~~~~~
./scalar.hpp:53:13: note: candidate function not viable: no known conversion from 'at::ScalarType' to 'caffe2::TypeMeta' for 1st argument
std::string caffe_type_to_string (caffe2::TypeMeta type) {
^
tensor.cpp:937:20: error: member reference base type 'at::ScalarType' is not a structure or union
return x->dtype().itemsize();
~~~~~~~~~~^~~~~~~~~
tensor.cpp:1266:29: error: too many arguments to function call, expected 2, have 3; did you mean 'at::index_put_'?
return make_tensor_ptr(x->index_put_(tensor_list_from_r_(indices), *values, accumulate));
^~~~~~~~~~
at::index_put_
/libtorch/include/ATen/Functions.h:3700:24: note: 'at::index_put_' declared here
static inline Tensor & index_put_(Tensor & self, TensorList indices, const Tensor & values) {
^
tensor.cpp:1342:31: error: no matching member function for call to 'mean'
return make_tensor_ptr(x->mean(Rcpp::as<std::vector<std::int64_t>>(dim), keepdim));
~~~^~~~
/libtorch/include/ATen/core/TensorMethods.h:863:23: note: candidate function not viable: no known conversion from 'std::__1::vector<long long, std::__1::allocator<long long> >' to 'int64_t' (aka 'long long') for 1st argument
inline Tensor Tensor::mean(int64_t dim, bool keepdim) const {
^
/libtorch/include/ATen/core/TensorMethods.h:866:23: note: candidate function not viable: no known conversion from 'std::__1::vector<long long, std::__1::allocator<long long> >' to 'int64_t' (aka 'long long') for 1st argument
inline Tensor Tensor::mean(int64_t dim, ScalarType dtype) const {
^
/libtorch/include/ATen/core/TensorMethods.h:854:23: note: candidate function not viable: requires single argument 'dtype', but 2 arguments were provided
inline Tensor Tensor::mean(ScalarType dtype) const {
^
/libtorch/include/ATen/core/TensorMethods.h:860:23: note: candidate function not viable: requires 3 arguments, but 2 were provided
inline Tensor Tensor::mean(int64_t dim, bool keepdim, ScalarType dtype) const {
^
/libtorch/include/ATen/core/TensorMethods.h:857:23: note: candidate function not viable: requires 0 arguments, but 2 were provided
inline Tensor Tensor::mean() const {
^
8 errors generated.
make: *** [tensor.o] Error 1
ERROR: compilation failed for package ‘torch’
* removing ‘/Users/tomas/Library/R/3.5/library/torch’
Installation failed: Command failed (1)
Here is my session info:
devtools::session_info()
Session info --------------------------------------------------------------
setting value
version R version 3.5.0 (2018-04-23)
system x86_64, darwin15.6.0
ui RStudio (1.1.453)
language (EN)
collate pt_BR.UTF-8
tz America/Sao_Paulo
date 2019-03-11
Packages ------------------------------------------------------------------
package * version date source
backports 1.1.3 2018-12-14 cran (@1.1.3)
base * 3.5.0 2018-04-24 local
callr 3.1.1 2018-12-21 cran (@3.1.1)
clipr 0.4.1 2018-06-23 CRAN (R 3.5.0)
compiler 3.5.0 2018-04-24 local
curl 3.2 2018-03-28 CRAN (R 3.5.0)
datasets * 3.5.0 2018-04-24 local
devtools 1.13.5 2018-02-18 CRAN (R 3.5.0)
digest 0.6.18 2018-10-10 cran (@0.6.18)
evaluate 0.10.1 2017-06-24 CRAN (R 3.5.0)
fs 1.2.6 2018-08-23 CRAN (R 3.5.0)
git2r 0.23.0 2018-07-17 CRAN (R 3.5.0)
graphics * 3.5.0 2018-04-24 local
grDevices * 3.5.0 2018-04-24 local
htmltools 0.3.6 2017-04-28 CRAN (R 3.5.0)
httr 1.3.1 2017-08-20 CRAN (R 3.5.0)
knitr 1.20 2018-02-20 CRAN (R 3.5.0)
magrittr 1.5 2014-11-22 CRAN (R 3.5.0)
memoise 1.1.0 2017-04-21 CRAN (R 3.5.0)
methods * 3.5.0 2018-04-24 local
processx 3.3.0 2019-03-10 cran (@3.3.0)
ps 1.3.0 2018-12-21 cran (@1.3.0)
R6 2.4.0 2019-02-14 cran (@2.4.0)
Rcpp 1.0.0 2018-11-07 cran (@1.0.0)
reprex 0.2.1 2018-09-16 CRAN (R 3.5.0)
rlang 0.3.1 2019-01-08 cran (@0.3.1)
rmarkdown 1.9 2018-03-01 CRAN (R 3.5.0)
rprojroot 1.3-2 2018-01-03 CRAN (R 3.5.0)
stats * 3.5.0 2018-04-24 local
stringi 1.3.1 2019-02-13 cran (@1.3.1)
stringr 1.4.0 2019-02-10 CRAN (R 3.5.2)
tools 3.5.0 2018-04-24 local
utils * 3.5.0 2018-04-24 local
whisker 0.3-2 2013-04-28 CRAN (R 3.5.0)
withr 2.1.2 2018-03-15 CRAN (R 3.5.0)
yaml 2.2.0 2018-07-25 cran (@2.2.0)
Can you tell me your clang --version
and ls /libtorch
?
I think this can be related to compiler version or libtorch not being correctly linked.
The clang info:
clang --version
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
And libtorch info:
ls /libtorch
bin build-version include lib share
Hi, I installed libtorch, but get following from R: