poetry2nix icon indicating copy to clipboard operation
poetry2nix copied to clipboard

Missing suitable source/wheel file entry for windows-curses

Open colemickens opened this issue 2 years ago • 2 comments

I don't know the latest in python env management, I don't know anything about poetry and I don't know much about poetry2nix even after reading the readme (likely because of the aforementioned lack of python knowledge).

But, streamrip has a poetry.lock file, so I assumed I could use poetry2nix. However, I just get:

[cole@carbon:~/code/nixpkgs/cmpkgs]$ nix build .#streamrip
warning: Git tree '/home/cole/code/nixpkgs/cmpkgs' is dirty
error: Missing suitable source/wheel file entry for windows-curses
(use '--show-trace' to show detailed location information)

when used with a derivation like:

{ lib
, stdenv
, fetchFromGitHub
, poetry2nix
, pythonPackages
}:

let
  verinfo = {
    rev = "251e1267f92331cb2659cc1633fde86198f5955b";
    owner = "nathom";
    repo = "streamrip";
    hash = "sha256-TAxQgpq5JEU0vLYxtcUDHzyUliwzyy3F3uik4Xwyc3U=";
  };
  src = fetchFromGitHub {
    inherit (verinfo) owner repo rev hash;
  };
in
poetry2nix.mkPoetryApplication {
  projectDir = src;
}

Any tips? Thank you!

colemickens avatar Jun 17 '22 00:06 colemickens

It would be useful if you would share all the files to make things easier to reproduce.

Anyway just digging around I see that poetry.lock is referencing version 2.3.0 of windows-curses package https://github.com/nathom/streamrip/blob/251e1267f92331cb2659cc1633fde86198f5955b/poetry.lock#L857

Unfortunately the package doesn't come with source code tarball: https://pypi.org/project/windows-curses/2.3.0/#files only wheel files.

You have two options (although probably best is to do both of them):

  1. file an issue with the author asking to also publish sdist package (Nix doesn't trust binary packages and prefers to build it itself)
  2. until that's done you'll probably need to place an override for windows-curses package to reference github repo. Unfortunately looks like author doesn't tag releases, but looks like last commit is from the same time the version was released, so there's a high chance that latest commit is the version that was published.

Actually there's also possible alternative to 2. there's preferWheels option to mkPoetryApplication that potentially could also be a workaround. Although that option applies to all dependencies. I think you could also place prefferWheel when overriding an individual package, but when I tried to use it, it didn't work for me.

takeda avatar Jun 17 '22 06:06 takeda

Actually there's also possible alternative to 2. there's preferWheels option to mkPoetryApplication that potentially could also be a workaround. Although that option applies to all dependencies. I think you could also place prefferWheel when overriding an individual package, but when I tried to use it, it didn't work for me.

It wouldn't work in this instance as it only changes the preference order and puts wheels first. In this case there are no wheels for anything except windows and that's why the selection fails.

It looks like poetry.lock is missing some metadata to express that this package is windows only. You could work around that by overriding windows-curses to null:

poetry2nix.mkPoetryApplication {
  projectDir = src;
  overrides = poetry2nix.overrides.withDefaults (self: super: {
    windows-curses = null;
  });
}

adisbladis avatar Jun 17 '22 09:06 adisbladis