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
    '';
}

관련 정보