I am trying to run the ruby tensorflow example.rb file, as described here. I have installed tensorflow.rb using docker, as described here. When I run bundle exec rspec spec, all examples pass.
I have created a file example.rb as instructed. When I run the file using ruby example.rb, I get the following error
/usr/local/rvm/gems/ruby-2.2.4#ruby-tensorflow/gems/tensorflow-0.0.1/lib/tensorflow/session.rb:168:in `graph_def_to_c_array': undefined method `length' for nil:NilClass (NoMethodError)
from /usr/local/rvm/gems/ruby-2.2.4#ruby-tensorflow/gems/tensorflow-0.0.1/lib/tensorflow/session.rb:51:in `extend_graph'
from example.rb:9:in `<main>'
When I run each line of example.rb in an irb session, the error occurs at the command:
session.extend_graph(graph)
How do I fix this?
This was raised as an issue. It turned out that the docker image was out of date. It has been fixed, so if you follow the new Readme instructions, then it now all works.
Related
I use CentOS 6.6. I want to execute a Ruby code on startup, so I added the following command to execute the code to /etc/rc.d/rc.local.
ruby /ruby/send_mail.rb
In send_mail.rb, there is require 'mail', but error occurred like the following.
/usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- mail (LoadError)
from /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /ruby/send_mail:23:in `<main>'
(I got this error by using ruby /ruby/send_mail.rb &> error_output)
I did gem install mail. And "send_mail.rb" works properly when I run this manually. Would you tell me what I should do?
Try running ruby using the RVM wrappers, as described here:
/usr/local/rvm/wrappers/ruby-2.2.2/ruby /ruby/send_mail.rb
I am new to ruby and am trying to use the line command:
gem install shopify_theme
However, I get an error
NameError: undefined local variable or method 'shopify_theme' for main:Object
from <rb>:2
from C:/Ruby21/bin/irb:11:in '<main>'
I assume this has something to do with my local files? I've used Dir.chdir to target my folder. Also, I have the gem file here as well.
ref: https://github.com/Shopify/shopify_theme
Thank you and any help is greatly appreciated!
You may be in the ruby console. Exit the ruby console and use cmd.exe!
Anyone know why I would get this error: " NameError: undefined local variable or method `list' for main:Object
from (irb):1"
anytime i try to run a ruby command such as "gem list" from irb?
excuse my ignorance , ik nothing about Ruby and all im trying to do is install cocoapods to use with my ios projects.
It's because gem list is not "ruby command". It's shell command to list all ruby gems installed on your machine. You should use this outside ruby's irb console.
I am working with the Shopsense Ruby Gem however I am unable to use the gem. Making requests exactly as in the test I receive the following error:
/Users/rudolph9/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:455:in `block in get_response': undefined method `request_uri' for #<URI::Generic:0x007fd5b3a66810> (NoMethodError)
from /Users/rudolph9/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:745:in `start'
from /Users/rudolph9/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:454:in `get_response'
from /Users/rudolph9/.rvm/gems/ruby-1.9.3-p0/gems/Shopsense-0.1.1/lib/Shopsense.rb:76:in `do_search'
from test_shopsense.rb:10:in `<main>'
However, the test works fine if I clone the repository, modify the test and require the source directly as follows:
1 #!/usr/bin/env ruby¬
2 require 'rubygems'¬
3 #require 'Shopsense'¬
4 require '../lib/shopsense.rb'¬
.
.
.
What is the issue when using the gem it self??
Do you have an older version of the gem installed, or another gem which is named Shopsense?
With the error you're getting, I suspect the issue would be related ruby trying to automatically find the gem when you do require 'Shopsense' and finding something other than what you want. When you do require '../lib/shopsense.rb' it defines a specific path to the gem, so you always get the gem you want.
I don't have any experience with Shopsense, but the link you supplied looks like its a version 0.1.0, while the ruby interpreter found a Shopsense-0.1.1. I suspect the issue has to do with that. In fact, the source for Shopsense you linked to, line 76 (where the error is in your output) is a blank line.
Just installed IronRuby 1.1. I'm trying to take a look at rake and albacore. After installing ironruby, I am able to hit a command prompt by typing ir, and I am able to do simple puts, but when I try to run rake, I get the error
undefined method `rake' for main:Object
How do I resolve this? Any ideas?
Thanks,
~ck in San Diego
rake is an executable Ruby script that you call from the Windows command line, not a Ruby method that you call from IRb.