【发布时间】:2021-08-30 04:02:59
【问题描述】:
我正在尝试让 Python 包 torch-geometric 使用 Nix(我在 NixOS 上)工作。目前,我使用mach-nix 尝试设置 Python 环境。但是,困难在于一些依赖项应该从单独的文件服务器(不是 pypi)下载,即https://pytorch-geometric.com/whl/torch-1.8.0+cpu.html。我首先尝试设置一个包含单个 torch-geometric 依赖项的环境:torch-sparse。
目前我有以下shell.nix:
{ pkgs ? import <nixpkgs> {} }:
let
mach-nix = import (builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix/";
ref = "refs/tags/3.3.0";
}) {
python = "python38";
};
sparse = mach-nix.buildPythonPackage {
pname = "torch_sparse";
version = "0.6.9";
requirements = ''
torch
scipy
pytest
pytest-cov
pytest-runner
'';
src = builtins.fetchGit {
url = "https://github.com/rusty1s/pytorch_sparse";
ref = "refs/tags/0.6.9";
};
};
in mach-nix.mkPython {
requirements = "torch-sparse";
packagesExtra = [
sparse
];
}
在运行 nix-shell 时失败并显示以下错误消息:
running build_ext
error: [Errno 2] No such file or directory: 'which'
builder for '/nix/store/fs9nrrd2a233xp5d6njy6639yjbxp4g0-python3.8-torch_sparse-0.6.9.drv' failed with exit code 1
我尝试将which 包添加到checkInputs 和buildInputs,但这并不能解决问题。显然,我尝试直接从其 GitHub 存储库构建包,因为我不确定如何在 mach-nix 中引用 wheel 包。我对 NixOS 环境比较陌生,坦率地说,我完全迷路了。
我应该如何安装 Python 包,例如 torch-sparse 或 torch-geometric?我是否使用了正确的工具?
【问题讨论】:
标签: python pytorch nix nixos pytorch-geometric