NixOS:如何将 prophet 添加到 Jupyter 环境中?

NixOS: How to add prophet to Jupyter environment?

我正在使用 JupyterWith framework for the definition of declarative and reproducible Jupyter environments on Nix OS. Based on the documentation,我创建了 shell.nix 文件,我在其中定义了所有 python 依赖项。而且效果很好:

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

  iPython = jupyter.kernels.iPythonWith {
    name = "python";
    packages = p: with p; [
      pandas
      numpy
      seaborn
      matplotlib
      scikitlearn
      # prophet
    ];
  };

  iHaskell = jupyter.kernels.iHaskellWith {
    extraIHaskellFlags = "--codemirror Haskell";
    name = "haskell";
    packages = p: with p; [ hvega formatting ];
  };

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

但是,当我将 prophet 包添加为另一个 python 依赖项时,问题就出现了。之后,当我尝试 运行 nix-shell 时,出现以下错误:

jbezdek@kraken:~$ nix-shell ~/shell.nix.jupyter
error: undefined variable 'prophet' at /home/jbezdek/shell.nix.jupyter:15:7
(use '--show-trace' to show detailed location information)

你能帮我看看我做错了什么吗?

据我所知,你没有做错任何事。 prophet 的问题更隐蔽。您可以与 Nix 一起使用的 Python 包不是在 PyPI 上找到的包(通过某种镜像),而是包源本身的 Nix 派生。这意味着要使一个包可以与 Nix 一起使用,需要有人为此编写一个合适的派生。

标准 nixpkgs-unstable 和稳定频道上的所有可用软件包都可以在 search.nixos.org. When you type prophet there, you won't find it under the python3Packages package set, which means that nobody made an effort to write a derivation for it yet. So the best chance there would be to either start writing your own derivation (see the manual) or make a package request on the GitHub repo 上搜索和找到。