jupyenv icon indicating copy to clipboard operation
jupyenv copied to clipboard

Installing Jupyter globally (nixos-rebuild)

Open jesuspc opened this issue 4 years ago • 2 comments

Is your feature request related to a problem? Please describe.

After running Jupyter correctly from a nix-shell, I'd like to install it globally so that it's generally available in my system. To do so, I'd like to include it in my configuration.nix, but probably because of my lack of experience in nix I have not been able to.

Describe the solution you'd like

A description on the README about how to include JupyterWith with different kernels on configuration.nix, so that it can be made globally available by running nixos-rebuild switch.

Additional context

I've noticed that bringing jupyterWith to nixpkgs is already on the roadmap.

jesuspc avatar Aug 22 '20 14:08 jesuspc

I think, Nothing different between nix-shell and nixos-rebuild swtich.

pkgs.buildEnv(nixos-builld option)

pkgs.mkShell

first, if the JupyterWith in all of top-level (nixpkgs). we just need to invoke pkgs.jupyterwith in nixos configuation.file. For example

let
  iRust = pkgs.jupyterwith.kernels.rustWith {
    name = "data-rust-env";
  };
  
jupyterEnvironment =
    pkgs.jupyterwith.jupyterlabWith {
      kernels = [ iRust ];
};
in
environment.systemPackages = with pkgs; [
jupyterEnvironment
];

GTrunSec avatar Sep 16 '20 07:09 GTrunSec

This doesn't work for me.

  1. let is required to be inside environment.systemPackages
  2. pkgs.jupyterwith is not available to me

I have the following in my configuration.nix:

environment.systemPackages =
  let
    jupyter = import (builtins.fetchGit {
      url = https://github.com/tweag/jupyterWith;
      rev = "";
    }) {};

    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
    with pkgs; [
      jupyterEnvironment
    ]

but this does not allow me to run any of the standard jupyter commands from the terminal.

Please help.

nazzacode avatar Sep 24 '21 14:09 nazzacode

As we are working on a flake version of this repository with an improved API we add to the roadmap to document this use case.

garbas avatar Aug 17 '22 20:08 garbas