Nix openai python 开发环境构建失败

Nix openai python dev-environment build failure

我正在尝试使用 nix 创建一个包含 openai pypi 包的 python37 开发环境。

这个question was originally on reddit,但是我找不到答案而且帖子里的activity很低

使用我得到的提示和语言框架文档,我设法想出了以下表达式:

default.nix:

with import<nixpkgs>{};
( let
    openai = pkgs.callPackage ./release.nix {
              inherit pkgs; 
              buildPythonPackage = pkgs.python37Packages.buildPythonPackage;
            };
  in pkgs.python37.buildEnv.override rec {
    extraLibs = [ pkgs.python37Packages.requests openai ];
  }
).env

release.nix

{ pkgs, buildPythonPackage }:

buildPythonPackage rec{
  pname="openai";
  version="0.2.6";

  src=fetchTarball{
    url="https://files.pythonhosted.org/packages/59/2d/b3bc2aa663b2c376f073fd141e128ecfb47f3aff95ccee284a74d85a1ef8/openai-0.2.6.tar.gz";
    sha256="0cplrzfw3i6yxcd35ijfjkx9jbcvkvzn5jn5b8s657a8myhm6kav";
  };

  propagateBuildInputs = [ pkgs.python37Packages.requests ];
  doCheck=false;

  meta = { # only for testing the env right now
    homepage="...";
    description="...";
    license = "...";
    maintainers= [];
  };
}

然而,这给我留下了(我猜它的点)错误

Processing ./openai-0.2.6-py3-none-any.whl
ERROR: Could not find a version that satisfies the requirement requests>=2.20; python_version >= "3.0" (from openai==0.2.6) (from versions: none)
ERROR: No matching distribution found for requests>=2.20; python_version >= "3.0" (from openai==0.2.6)
builder for '/nix/store/ncnga4fcxl15xyvv3f325f9g0q45mqvr-python3.7-openai-0.2.6.drv' failed with exit code 1

这让我感到惊讶,因为 propagateBuildInputs = [ pkgs.python37Packages.requests ]; 清楚地指出包 requests(nixpkgs 中的版本 2.22.0)应该在构建时存在。

我对 buildPythonPackage 阻止此功能工作的功能有什么误解?

progagatedBuildInputs 更改为另一个名称,如 progagateBuildInputs 会导致它被忽略,因此找不到它包含的任何依赖项(即 requests)。例如:

yubico-client/default.nix

  propagateBuildInputs = [ requests ];

ERROR: Could not find a version that satisfies the requirement requests<3.0,>=2.7 (from yubico-client==1.13.0) (from versions: none)
ERROR: No matching distribution found for requests<3.0,>=2.7 (from yubico-client==1.13.0)

  propagatedBuildInputs = [ requests ];

$ nix-build -I nixpkgs=~/git/nixpkgs '<nixpkgs>' -k -A python37Packages.yubico-client
/nix/store/0yjz8smgmjr0006nmka6wliy01z8av7m-python3.7-yubico-client-1.13.0