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 broken #14341

Closed
jgillich opened this issue Mar 31, 2016 · 5 comments
Closed

youtube-dl is broken #14341

jgillich opened this issue Mar 31, 2016 · 5 comments
Labels

Comments

@jgillich
Copy link
Member

Basic info

To make sure that we are on the same page:

  • Kernel: Linux thinkpad 4.4.6 #1-NixOS SMP Wed Mar 16 15:43:17 UTC 2016 x86_64 GNU/Linux
  • System: 16.09pre79453.32b7b00 (Flounder)
  • Nix version: nix-env (Nix) 1.11.2
  • Nixpkgs version: 16.09pre79453.32b7b00

Describe your issue here

$ nix-env -iA nixos.pypyPackages.youtube-dl
...
$ youtube-dl 
Traceback (most recent call last):
  File "/nix/store/jdy43y0jhl0saq0vbimbvw1bgiks18zk-pypy4.0-youtube-dl-2016.01.01/bin/..youtube-dl-wrapped-wrapped", line 8, in <module>
    from youtube_dl import main
ImportError: No module named youtube_dl
@jgillich
Copy link
Member Author

cc @FRidh I guess #13124 is causing this

@FRidh
Copy link
Member

FRidh commented Mar 31, 2016

It can't be that. The only difference between buildPythonPackage and buildPythonApplication is that in the latter namePrefix is empty, instead of showing e.g. python3.5-.

Anyway, what is done there with youtube-dl is wrong. All Python libraries (and that includes /development/python-modules) should go via python-packages.nix. Python applications should not go via python-packages.nix.

Now that still doesn't explain your issue. In fact, youtube-dl does work with nix-shell
Try nix-shell -p pythonPackages.youtube-dl -I nixpkgs=. --run "youtube-dl" or any other pythonPackages set, and with -I nixpkgs=. checked out at unstable.

Obviously you want to use it as an application in which case it should work when you install it in your profile like you showed you did. Apparently there is something wrong with the wrapper.

Let's try installing it in the profile. We begin with
nix-env -iA nixos.pkgs.pythonPackages.youtube-dl -I nixpkgs=.
Again, I am using -I nixpkgs=. to use your version of NixOS/Nixpkgs.
I get now the following:

nix-env -iA nixos.pythonPackages.youtube-dl -I nixpkgs=.
installing ‘youtube-dl-2016.02.13’

Before I test, there is one important thing to notice. The name of my package is different.
While you are using NixOS Unstable, the channel that nix-env uses is an older version!

Now, youtube-dl does function in combination with CPython 2.7

$ youtube-dl
Usage: .youtube-dl-wrapped [OPTIONS] URL [URL...]

.youtube-dl-wrapped: error: You must provide at least one URL.
Type youtube-dl --help to see a list of all options.

However,

$ nix-env -iA nixos.pypyPackages.youtube-dl -I nixpkgs=.
replacing old ‘youtube-dl-2016.02.13’
installing ‘youtube-dl-2016.02.13’

gives

$ youtube-dl
Traceback (most recent call last):
  File "/nix/store/fnrx71ax877dn68qjsggrrhn77wh9c32-youtube-dl-2016.02.13/bin/..youtube-dl-wrapped-wrapped", line 8, in <module>
    from youtube_dl import main
ImportError: No module named youtube_dl

Somehow the wrapper only fails with pypy.

@FRidh FRidh added 0.kind: bug Something is broken 6.topic: python labels Mar 31, 2016
@FRidh
Copy link
Member

FRidh commented Mar 31, 2016

It is being wrapped twice. First, buildPythonApplication wraps it, and then it is wrapped again manually.

@jgillich
Copy link
Member Author

Alright haha, I just saw that you converted tons of packages and assumed you didn't try running all of them. Sorry :)

With nix-shell, it's working for me as well. So now downloading a youtube video is as simple as

nix-shell -p pythonPackages.youtube-dl --run "SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt youtube-dl https://www.youtube.com/watch?v=77OlKRkaixo"

😁

Wrapping twice is bad, but why does it even use pypy if it works fine with cpython? It just increases the download size for most people.

@FRidh
Copy link
Member

FRidh commented Mar 31, 2016

Well I definitely didn't test all those packages when I made that change :-)

You chose to use the pypy in your bug report. You can use any python version.
We have to decide though...is this an application, or a library. Anyway, closing this.

@FRidh FRidh closed this as completed Mar 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants