Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

youtube_dl is not part of the bundle. Add it to Gemfile. (Gem::LoadError) #31

Open
birchlore opened this issue Mar 16, 2016 · 10 comments
Open

Comments

@birchlore
Copy link

When calling:

YoutubeDL.download "https://www.youtube.com/watch?v=gvdf5n-zI14", output: 'some_file.mp4'
I get this error:

/Users/jackson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/rubygems_integration.rb:304:in block in replace_gem: youtube_dl is not part of the bundle. Add it to Gemfile. (Gem::LoadError)

I previously had 'youtube_dl' in my gemfile, but replaced with 'youtube-dl.rb' and bundle install, bundle update.

Any idea why I'm getting this error message?

@sapslaj
Copy link
Member

sapslaj commented Mar 16, 2016

You have an outdated Gemfile.lock. You can just delete Gemfile.lock and regenerate using bundle install. Try that and see if that fixes anything.

@birchlore
Copy link
Author

Hmm.. No luck. Here's the trace:

from /Users/jackson/.rbenv/versions/2.2.4/bin/youtube-dl:22:in `<main>'
from /Users/jackson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/cocaine-0.5.8/lib/cocaine/command_line.rb:91:in `run'

@sapslaj
Copy link
Member

sapslaj commented Mar 16, 2016

Ahh, I see the problem: youtube_dl is still installed, which causes a conflict with this gem when searching for a usable youtube-dl binary. See Issue #24.

@birchlore
Copy link
Author

Oh, weird. Any idea on how to uninstall it? I thought removing it from gemfile was enough.. no?

@sapslaj
Copy link
Member

sapslaj commented Mar 16, 2016

gem uninstall youtube_dl or use a different gemset.

This gem, youtube-dl.rb, searches for a youtube-dl binary in your PATH before falling back to the built in youtube-dl. But the youtube_dl gem includes a binary named youtube-dl which from what I can tell is basically a really old version of youtube-dl. When youtube_dl (the gem) is installed, rbenv will make a Ruby file called youtube-dl to correspond with the executable youtube_dl (the gem) includes, which basically figures out the Ruby environment you are using at the moment and redirects it to the appropriate directory. That's where the Gem::LoadError is coming from.

It's really complicated, and it really sucks, but there's nothing I can really do about it.

@birchlore
Copy link
Author

Ah, confusing but makes sense. Thanks for the explanation. Successfully removed youtube_dl, uninstalled youtube-dl.rb and re-installed from scratch.

Same use case, I'm getting this error:

Cocaine::CommandNotFoundError: Cocaine::CommandNotFoundError
from /Users/jackson/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/cocaine-0.5.8/lib/cocaine/command_line.rb:82:in `run'

Sorry to keep beating at this, really appreciate your help.

Edit: think this has to do with not having ffmpeg, I'll play around with that. Tried installing ffmpeg locally via homebrew - no change

@birchlore
Copy link
Author

I've traced my error back to line 39 in youtube-dl.rb/lib/youtube-dl/video.rb

set_information_from_json(YoutubeDL::Runner.new(url, @download_options).run)

I can try running this directly in the console YoutubeDL::Runner.new(some_url).run and it causes the error:

Cocaine::CommandNotFoundError: Cocaine::CommandNotFoundError

YoutubeDL::Runner.new(some_url).command returns expected result without error.

Any ideas?

@birchlore
Copy link
Author

In support.rb line 30:

line = Cocaine::CommandLine.new(executable_path, command)

executable_path == "/Users/birchlore/.rbenv/shims/youtube-dl"

so my line.command looks like ""/Users/birchlore/.rbenv/shims/youtube-dl --no-color --no-progress --print-json --format :format --prefer-ffmpeg --extract-audio --audio-format :audio_format \"https://www.youtube.com/watch?v=VA6kCaxaTlk\""

and then line.run throws the error.

If I run youtube-dl --no-color --no-progress --print-json --format :format --prefer-ffmpeg --extract-audio --audio-format :audio_format \'https://www.youtube.com/watch?v=VA6kCaxaTlk\' directly from /Users/birchlore/.rbenv/shims I get:

rbenv: youtube-dl: command not found

@birchlore
Copy link
Author

Update. Issue resolved by running brew install youtube-dl. Not sure why I had to install it separately.

@sapslaj
Copy link
Member

sapslaj commented Mar 16, 2016

This is a very weird situation, but I applaud your persistence. I'll keep this issue open since it is technically a bug, and we might have to call in the rbenv guys to figure it out.

Anyway, thanks for bringing my attention to an issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants