jupyenv icon indicating copy to clipboard operation
jupyenv copied to clipboard

`jupyter` command not found, only `jupyter_lab` when using overlay from a flake

Open ParetoOptimalDev opened this issue 3 years ago • 4 comments
trafficstars

Describe the bug

I'm using DevOS if it matters.

I installed jupyterWith per your Using an overlay instructions but the jupyter binary is missing.

Only the jupyter lab related ones are available:

❯ ls /run/current-system/sw/bin/jupyter*
/run/current-system/sw/bin/jupyter-lab
/run/current-system/sw/bin/jupyter-labextension
/run/current-system/sw/bin/jupyter-labhub

To Reproduce From a flake (or maybe this is devos specific) make these changes:

modified   flake.nix
@@ -47,6 +47,8 @@
       emacs-overlay.url = "github:nix-community/emacs-overlay";
       emacs-overlay.inputs.nixpkgs.follows = "nixos";
 
+      jupyterWith.url = "github:tweag/jupyterWith";
+
     };
 
   outputs =
@@ -62,6 +64,7 @@
     , deploy
     , emacs-overlay
+    , jupyterWith
     , ...
     } @ inputs:
     digga.lib.mkFlake
@@ -79,6 +82,12 @@
               nvfetcher.overlay
               emacs-overlay.overlay
+
+              (import "${jupyterWith}/nix/haskell-overlay.nix")
+              (import "${jupyterWith}/nix/python-overlay.nix")
+              # (import "${jupyterWith}/nix/overlay.nix") # doesn't work `error: value is null while a set was expected`
+              jupyterWith.overlays.jupyterWith
+

Then in another module add jupyterEnvironment to systemPackages:

@@ -1,4 +1,20 @@
-{ pkgs, ... }: {
+{ pkgs, ... }:
+
+let jupyter = pkgs.jupyterWith;
+    iPython = jupyter.kernels.iPythonWith {
+      name = "python";
+      packages = p: with p; [ numpy ];
+    };
+
+    iHaskell = jupyter.kernels.iHaskellWith {
+      name = "haskell";
+      packages = p: with p; [ hvega formatting ];
+    };
+    jupyterEnvironment = jupyter.jupyterlabWith {
+      kernels = [ iPython iHaskell ];
+    };
+in
+{
 
   imports = [ ./haskell ];
 
@@ -22,6 +38,8 @@
     # VISUAL = "emacsclient -t -a=\"\"";
   };
 
   environment.systemPackages = with pkgs; [
      hyperfine
+    jupyterEnvironment
   ];

Expected behavior

The same binaries such as jupyter to be available as when I run the the nix-shell on this shell.nix:

let
  jupyter = import (builtins.fetchGit {
    url = https://github.com/tweag/jupyterWith;
    # Example working revision, check out the latest one.
    rev = "5105a7712c7e946fb653a64b2eca1f35622de001";
  }) {};

  iPython = jupyter.kernels.iPythonWith {
    name = "python";
    packages = p: with p; [ numpy ];
  };

  iHaskell = jupyter.kernels.iHaskellWith {
    name = "haskell";
    packages = p: with p; [ formatting ];
  };

  jupyterEnvironment =
    jupyter.jupyterlabWith {
      kernels = [ iPython iHaskell ];
    };
in
  jupyterEnvironment.env

Results in many more jupyter binaries available:

❯ jupyter
jupyter                   jupyter-labhub            jupyter-run
jupyter-bundlerextension  jupyter-migrate           jupyter-server
jupyter-kernel            jupyter-nbclassic         jupyter-serverextension
jupyter-kernelspec        jupyter-nbconvert         jupyter-troubleshoot
jupyter-lab               jupyter-nbextension       jupyter-trust
jupyter-labextension      jupyter-notebook          

Environment

  • OS name + version: NixOS 21.11.20220117.dddab87 using devos+flakes
  • Version of the code: 5105a7712c7e946fb653a64b2eca1f35622de001

Additional context Add any other context about the problem here.

ParetoOptimalDev avatar Jan 25 '22 07:01 ParetoOptimalDev

I wonder if #28 might be affecting me since I aborted some builds in repl.

Need figure out how to garbage collect and ensure package is garbage collected and rebuild.

ParetoOptimalDev avatar Jan 25 '22 20:01 ParetoOptimalDev

Or i'm affected by:

There are chances that the overrides defined here will not be compatible with your snapshot. Your mileage may vary.

Perhaps the null issue I get trying to use import is evidence of that somehow.

ParetoOptimalDev avatar Jan 25 '22 20:01 ParetoOptimalDev

Maybe #142 is related, I think it adds more binaries?

ParetoOptimalDev avatar Jan 31 '22 09:01 ParetoOptimalDev

I also installed jupyterEnv successfully without jupyter command, how the hell do I install jupyter?

PlumpMath avatar May 08 '22 23:05 PlumpMath

This will be fixed and documented with next version of jupyterWith (see main branch)

garbas avatar Aug 17 '22 20:08 garbas