NixOSに最新のJupyterlabをインストールする方法は?

NixOSに最新のJupyterlabをインストールする方法は?

実行しようとしましたが、pypi2nix -V 3 -e jupyterlab==1.0.0「ipykernelをビルドできません」というメッセージで失敗しました。

jupyterlab 1.0.Xバージョンをインストールする他の方法はありますか?

編集:ますます近づいています。これは私のjupyterlab.nixが実行されているものですnix-shell jupyterlab.nix

with import <nixpkgs> {};

( let
    my_jupyterlab = python37.pkgs.buildPythonPackage rec {
      pname = "jupyterlab";
      version = "1.0.4";

      src = python37.pkgs.fetchPypi {
        inherit pname version;
        sha256 = "0vhdbzrphirl3x37d4zh0gaxhs6f7wj0i30wy4878yjkmlr219rj";
      };

      doCheck = false;
    };

  in python37.withPackages (ps: [ps.jupyter ps.tornado my_jupyterlab])
).env

しかし、これは竜巻の状況を説明するために確立することができませんでした。

ベストアンサー1

ここで以下を見つけることができます。適切なテンプレート最初:

# default37.nix
# start with
#   nix-shell default37.nix
# or
#   nix-shell default37.nix -I nixpkgs=/home/isto/nixpkgs-unstable/
let 
  pkgs = import <nixpkgs> {};
  newpkgs = import pkgs.path { overlays = [ (pkgsself: pkgssuper: {
    python37 = let
      packageOverrides = self: super: {
            openpyxl = openpyxl2;
        # numpy = super.numpy_1_10;
      };
    in pkgssuper.python37.override {inherit packageOverrides;};
  } ) ]; };
  
  multitasking = newpkgs.callPackage /...../......./multitasking/default.nix {
    buildPythonPackage = newpkgs.python37Packages.buildPythonPackage;
    fetchPypi = newpkgs.python37Packages.fetchPypi;
  };
  openpyxl2 = pkgs.callPackage /..../...../openpyxl/default.nix {
    buildPythonPackage = pkgs.python37Packages.buildPythonPackage;
    fetchPypi = pkgs.python37Packages.fetchPypi;
    isPy27 = pkgs.python37Packages.isPy27;
    pytest = pkgs.python37Packages.pytest;
    jdcal = pkgs.python37Packages.jdcal;
    et_xmlfile = pkgs.python37Packages.et_xmlfile;
    lxml = pkgs.python37Packages.lxml;
  };
  yfinance = newpkgs.callPackage /..../...../yfinance/default.nix {
    buildPythonPackage = newpkgs.python37Packages.buildPythonPackage;
    fetchPypi = newpkgs.python37Packages.fetchPypi;
    pandas = newpkgs.python37Packages.pandas;
    numpy = newpkgs.python37Packages.numpy;
    requests = newpkgs.python37Packages.requests;
    multitasking = multitasking;
  };
  kernels = [
    # pkgs.python37Packages.ansible-kernel
    # pythonPackages.jupyter-c-kernel
    # pkgs.gophernotes
  ];
  additionalExtensions = [
    "@jupyter-widgets/jupyterlab-manager"
    "@bokeh/jupyter_bokeh"
    "@pyviz/jupyterlab_pyviz"
  ];
  pythonEnv = newpkgs.python37.withPackages (ps: with ps; [
    ipykernel jupyterlab jupyterlab_server
    python-language-server pyls-isort
    matplotlib numpy pandas scikitlearn
    tensorflow tensorflow-tensorboard 
    bokeh bkcharts networkx statsmodels seaborn
    holoviews hvplot 
    param pyviz-comms
    Keras keras-applications keras-preprocessing
    Theano 
    nltk
    scipy plotly
    sympy
    yfinance
    openpyxl
    #openpyxl2
    sphinx nbsphinx nbconvert
    dash dash-html-components dash-core-components dash-renderer dash-table
    jinja2 
    ipywidgets
  ]);
  
in newpkgs.mkShell rec {
  buildInputs = [
    pythonEnv
    pkgs.nodejs

  ] ++ kernels;
  shellHook = ''
    TEMPDIR=$(mktemp -d -p /tmp)
    mkdir -p $TEMPDIR
    cp -r ${pkgs.python37Packages.jupyterlab}/share/jupyter/lab/* $TEMPDIR
    chmod -R 755 $TEMPDIR
    echo "$TEMPDIR is the app directory"

    # kernels
    export JUPYTER_PATH="${pkgs.lib.concatMapStringsSep ":" (p: "${p}/share/jupyter/") kernels}"

# labextensions
${pkgs.stdenv.lib.concatMapStrings
     (s: "jupyter labextension install --no-build --app-dir=$TEMPDIR ${s}; ")
     (pkgs.lib.unique
       ((pkgs.lib.concatMap
           (d: pkgs.lib.attrByPath ["passthru" "jupyterlabExtensions"] [] d)
           buildInputs) ++ additionalExtensions))  }
jupyter lab build --app-dir=$TEMPDIR
chmod -R +w $TEMPDIR/staging/
jupyter lab build --app-dir=$TEMPDIR
 
# start jupyterlab
jupyter lab --app-dir=$TEMPDIR
    '';
}

おすすめ記事