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

packageExtra creating requirement conflict with itself #485

Closed
TyberiusPrime opened this issue Jul 11, 2022 · 6 comments · Fixed by #489
Closed

packageExtra creating requirement conflict with itself #485

TyberiusPrime opened this issue Jul 11, 2022 · 6 comments · Fixed by #489

Comments

@TyberiusPrime
Copy link
Collaborator

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.05";
    mach-nix = {
      url = "github:DavHau/mach-nix?rev=51caf584f26acdfaa51bbf7ee1ffa365aea7bc64";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = flakes @ {
    self,
    nixpkgs,
    mach-nix,
  }: let
    pkgs = import nixpkgs {
      system = "x86_64-linux";
    };
    mach-nix_ = mach-nix.lib."x86_64-linux";

  in {
    defaultPackage.x86_64-linux = mach-nix_.mkPython {
      requirements = ''pandas'';
      packagesExtra = [
        (mach-nix_.buildPythonPackage {
          src = pkgs.fetchgit {
            "rev" = "6c82cdc20d6f81c96772da73fc07a672a0a0a6ef";
            "sha256" = "sha256-ORA+GtORqBDhQiwtXUzooqQXostPrQhwHnlD5sW0kTE=";
            "url" = "https://github.com/has2k1/plotnine";
          };        })      ];    };  };}

leads to

> Mach-nix version: master
       > Python: 3.8.11
       > Cause: Requirements conflict: plotnine
       > The requirements which caused the error:
       >   plotnine

This is, of course, the stripped down example.

Could've sworn this was working a while ago, but the older relases die in a different way (something about an empty file_path).

Am I holding it wrong?

@TyberiusPrime
Copy link
Collaborator Author

ok, the file path issue is #403

@TyberiusPrime
Copy link
Collaborator Author

TyberiusPrime commented Jul 14, 2022

fun fact, adding a version="123" to buildPytohnPackage makes it build.
It possibly has something to do with the wonky 'derive version from VCS' that plotnine uses.

bonus fun fact:
version="6c82cdc20d6f81c96772da73fc07a672a0a0a6ef" does not work.
version=".6c82cdc" does not work.
version=".6c82c" does not work.
version=".6c82" does work (so it's not 'there is a char present").
version="6c82c" does work.
version="6c82cd" does not work.
version="0123456" does work (so it's not the length)
version="a012345" fails
version="012345a" works.

something is not treating the version string as something opaque.

ok, so it evaluates to "6c82cdc" if you don't set a version.

So why does this then explode downstream?

@TyberiusPrime
Copy link
Collaborator Author

More debugging shows that in resolver/resolvelib_resolver.py ... resolve() around line 66, self.nixpkgs is slightly different
with working and non working versions.
working:
< 'plotnine': {<Version('123')>: ['plotnine']}
non working:

'plotnine': {<LegacyVersion('6c82cdc')>: ['plotnine']}

so that's the next rabbit hole.

@TyberiusPrime
Copy link
Collaborator Author

TyberiusPrime commented Jul 14, 2022

Got it down to
requirements.py:202

if not req.specs:
        # We filter version with an empty specifier set, since that will filter
        # out prerelease, if there are any other releases.
        return SpecifierSet().filter(versions)

which filters out the one and only available version here.

(which it shouldn't according to the packaging doc's)

@TyberiusPrime
Copy link
Collaborator Author

oh great, LegacyVersion is also going to disappear: pypa/packaging#321

@TyberiusPrime
Copy link
Collaborator Author

once the PR is accepted, this can go away.

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

Successfully merging a pull request may close this issue.

1 participant