尼克松:如何将prophet添加到Jupyter环境中?

2024-09-28 03:16:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用JupyterWith框架来定义Nix操作系统上的声明性和可复制的Jupyter环境。基于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)

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


Tags: name定义packagesshowwithipythonnixjupyter
1条回答
网友
1楼 · 发布于 2024-09-28 03:16:31

据我所知,你没有做错什么。prophet的问题更多的是隐藏在幕后。可以与Nix一起使用的Python包不是PyPI上的包(通过某种镜像),而是包源本身的Nix派生。这意味着,为了使包能够与Nix一起使用,需要有人为此编写合适的派生

可以在search.nixos.org上搜索并找到标准nixpkgs-unstable和稳定通道上的所有可用包。在那里键入prophet时,在python3Packages包集下找不到它,这意味着还没有人为它编写派生。因此,最好的机会是开始编写自己的派生(参见the manual),或者在GitHub repo上发出包请求

相关问题 更多 >

    热门问题