我使用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)
你能帮我看看我做错了什么吗
据我所知,你没有做错什么。
prophet
的问题更多的是隐藏在幕后。可以与Nix一起使用的Python包不是PyPI上的包(通过某种镜像),而是包源本身的Nix派生。这意味着,为了使包能够与Nix一起使用,需要有人为此编写合适的派生可以在search.nixos.org上搜索并找到标准
nixpkgs-unstable
和稳定通道上的所有可用包。在那里键入prophet
时,在python3Packages
包集下找不到它,这意味着还没有人为它编写派生。因此,最好的机会是开始编写自己的派生(参见the manual),或者在GitHub repo上发出包请求相关问题 更多 >
编程相关推荐