Closed jcasu closed 1 year ago
Hi @jcasu, it looks like you're cloning the repo instead of installing the gem. Try following the installation instructions in the readme, and please use Stack Overflow for additional help.
I did the bundle config/bundle install exactly like you said previously:
bundle config build.torch-rb --with-torch-dir=/home/john/local/libtorch bundle install
From the issue I posted, you can see clearly that the torchvision gem was installed by the bundle install, but the torch-rb gem on which it depends was not.
Please don't point me to the page again, because those instructions are obviously unclear to me. What steps am I missing?
thanks, -john
From: Andrew Kane @.> Sent: Sunday, July 30, 2023 7:37 PM To: ankane/torch.rb @.> Cc: john chiraldynamics.com @.>; Mention @.> Subject: Re: [ankane/torch.rb] torch.rb not installing torch gem on Fedora 38/ruby 3.3-preview (Issue #44)
Hi @jcasuhttps://github.com/jcasu, it looks like you're cloning the repo instead of installing the gem. Try following the installation instructionshttps://github.com/ankane/torch.rb#installation in the readme, and please use Stack Overflow for additional help.
— Reply to this email directly, view it on GitHubhttps://github.com/ankane/torch.rb/issues/44#issuecomment-1657409046, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC4YUFWQZM62VSFPSUHT7HDXS4K5FANCNFSM6AAAAAA25TGDJM. You are receiving this because you were mentioned.Message ID: @.***>
Hi, @jcasu.
Looks like you are trying to install torch.rb from local path.
Following the bundler docs , the bundler won't compile the extension:
Unlike :git, bundler does not compile C extensions for gems specified as paths.
The instructions on the site are insufficient for someone like me who is unfamiliar with gem/bundler...
Anyway I got this working:
git clone ... cd torch-rb
gem build gem install --local torch-rb...gem
looks like you're making big assumptions wrt how & where the libtorch package gets unpacked.
my simple test program works, and the torchvision gem that the bundle install command installed works, too.
thanks
-john
From: Yvan @.> Sent: Monday, July 31, 2023 12:29 AM To: ankane/torch.rb @.> Cc: john chiraldynamics.com @.>; Mention @.> Subject: Re: [ankane/torch.rb] torch.rb not installing torch gem on Fedora 38/ruby 3.3-preview (Issue #44)
Hi, @jcasuhttps://github.com/jcasu. Looks like you are trying to install torch.rb from local path. Following the bundler docshttps://bundler.io/v1.12/man/gemfile.5.html#PATH-path- , the bundler won't compile the extension: Unlike :git, bundler does not compile C extensions for gems specified as paths.
— Reply to this email directly, view it on GitHubhttps://github.com/ankane/torch.rb/issues/44#issuecomment-1657819977, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC4YUFQRILPNF7P6JH7PDVTXS5NELANCNFSM6AAAAAA25TGDJM. You are receiving this because you were mentioned.Message ID: @.***>
also happening with Ubuntu 23.04/ruby 3.2.2
anyway: unpacked libtorch-cxx11-abi-shared-with-deps-2.0.1+cpu.zip under ~/local installed fresh ruby 3.3 did gem update did gem install numo-narray git cloned torch-rb did bundle config
followed the instructions you gave me, torch gem was not installed.
fwiw, things work on Mac. unlike Mac, tho, using homebrew on Linux doesn't help.
[john@fedora d.torch-rb]$ ls ~/local bin include lib libtorch share [john@fedora d.torch-rb]$ which ruby ~/local/bin/ruby [john@fedora torch.rb]$ bundle install Using rake 13.0.6 Using bundler 2.5.0.dev Using ffi 1.15.5 Using minitest 5.19.0 Using numo-narray 0.9.2.1 Using rake-compiler 1.2.3 Using rice 4.1.0 Using ruby-vips 2.1.4 Using torch-rb 0.13.2 from source at
.
Using torchvision 0.3.0 Bundle complete! 6 Gemfile dependencies, 10 gems now installed. Usebundle info [gemname]
to see where a bundled gem is installed. [john@fedora torch.rb]$ bundle info torch-rbrequire': cannot load such file -- torch (LoadError) from <internal:/home/john/local/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:85:in
require' from foo.rb:3:in `foo.rb
printf "hello world!\n"
require "torch" require "numo/narray"
shape = [2, 3] rand_tensor = Torch.rand(shape) ones_tensor = Torch.ones(shape) zeros_tensor = Torch.zeros(shape)
puts "Random Tensor:\n#{rand_tensor}\n\n" puts "Ones Tensor:\n#{ones_tensor}\n\n" puts "Zeros Tensor:\n#{zeros_tensor}"
Gemfile.lock below:
PATH remote: . specs: torch-rb (0.13.2) rice (>= 4.1.0)
GEM remote: https://rubygems.org/ specs: ffi (1.15.5) minitest (5.19.0) numo-narray (0.9.2.1) rake (13.0.6) rake-compiler (1.2.3) rake rice (4.1.0) ruby-vips (2.1.4) ffi (~> 1.12) torchvision (0.3.0) numo-narray ruby-vips (>= 2.1.2) torch-rb (>= 0.11.1)
PLATFORMS x86_64-linux
DEPENDENCIES minitest (>= 5) numo-narray rake rake-compiler torch-rb! torchvision (>= 0.2)
BUNDLED WITH 2.5.0.dev [john@fedora torch.rb]$