mach-nix icon indicating copy to clipboard operation
mach-nix copied to clipboard

Jupyterlab example fails if python310 specified due to tomli

Open genomematt opened this issue 2 years ago • 1 comments

Trying to run the Jupyterlab example specifying python 3.10 fails on MacOS ARM because the resolver tries to use tomli 1.2.0 rather than the 2.0.1 wheel it uses with python 3.9 Metadata on pypi for tomli 2.0.1 includes python 3.10. All mentioned versions pip install in a python3.10 nix derived venv.

This is likely to impact a significant number of packages via black etc.

A quick work around is to specify tomli>=1.2.2 in requirements which then pulls from nixpkgs

unpacking source archive /nix/store/snlm4gnf4ig1kmhzpm3skdp6j7wiy8gp-tomli-1.2.0.tar.gz
source root is tomli-1.2.0
setting SOURCE_DATE_EPOCH to timestamp 1627623451 of file tomli-1.2.0/tomli/py.typed
patching sources
applying patch /nix/store/6wprwrjrrxnqfpab3cgjc5cgm247pwla-fix-backwards-compatibility-load.patch
patching file tomli/_parser.py
Hunk #1 FAILED at 1.
Hunk #2 FAILED at 48.
2 out of 2 hunks FAILED -- saving rejects to file tomli/_parser.py.rej
error: builder for '/nix/store/sldnq9jh9gyqnbrc4jzkrs2ffxaxxz4c-python3.10-tomli-1.2.0.drv' failed with exit code 1;
       last 10 log lines:
       > unpacking sources
       > unpacking source archive /nix/store/snlm4gnf4ig1kmhzpm3skdp6j7wiy8gp-tomli-1.2.0.tar.gz
       > source root is tomli-1.2.0
       > setting SOURCE_DATE_EPOCH to timestamp 1627623451 of file tomli-1.2.0/tomli/py.typed
       > patching sources
       > applying patch /nix/store/6wprwrjrrxnqfpab3cgjc5cgm247pwla-fix-backwards-compatibility-load.patch
       > patching file tomli/_parser.py
       > Hunk #1 FAILED at 1.
       > Hunk #2 FAILED at 48.
       > 2 out of 2 hunks FAILED -- saving rejects to file tomli/_parser.py.rej
       For full logs, run 'nix log /nix/store/sldnq9jh9gyqnbrc4jzkrs2ffxaxxz4c-python3.10-tomli-1.2.0.drv'.
error: 1 dependencies of derivation '/nix/store/yywap7kc59p8jc9jl28v0jiyj465v78z-python3-3.10.1-env.drv' failed to build

default.nix to reproduce:

let
  mach-nix = import (builtins.fetchGit {
    url = "https://github.com/DavHau/mach-nix";
    ref = "refs/tags/3.4.0";
  }) {
    # optionally bring your own nixpkgs
    # pkgs = import <nixpkgs> {};

    # optionally specify the python version
    python = "python310";

    # optionally update pypi data revision from https://github.com/DavHau/pypi-deps-db
     pypiDataRev = "897a7471aa4e83aab21d2c501e00fee3f440e0fe";
     pypiDataSha256 = "03gnaq687gg9afb6i6czw4kzr1gbnzna15lfb26f9nszyfq3iyaj";
  };

  pyEnv = mach-nix.mkPython rec {

    requirements =  ''
        jupyterlab
      '';
  };
in
mach-nix.nixpkgs.mkShell {

  buildInputs = [
    pyEnv
  ] ;

  shellHook = ''
    jupyter lab --notebook-dir=~/
  '';
}

genomematt avatar Feb 22 '22 00:02 genomematt

Maybe this helps: https://github.com/DavHau/mach-nix/issues/389

Nebucatnetzer avatar Mar 01 '22 09:03 Nebucatnetzer