我正在尝试在 NixOS 上安装 jupyter-book。我有这个薄片:
{
description = "Introduction to Computational Literary Analysis, a Textbook";
outputs = { self, nixpkgs }: let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
in {
jupyterBook = pkgs.callPackage ./jupyter-book.nix {};
myPython = (nixpkgs.legacyPackages.${system}.python3.withPackages
(ps: with ps; [
# pip
jupyter
jupyterlab
self.jupyterBook
pandas
nltk
# spacy
]));
defaultPackage.${system} = self.myPython;
};
}
其中导入 jupyter-book.nix,包含以下表达式:
{ python3Packages }:
let
inherit (python3Packages) buildPythonPackage fetchPypi;
attrs = buildPythonPackage rec {
pname = "attrs";
version = "20.3.0";
src = fetchPypi {
inherit pname; inherit version;
sha256 = "007pchhxk2nh6m2rgflkkij9xjwysq3fl7xr72cy8i4pw76s6al3";
};
propagatedBuildInputs = with python3Packages; [
pytest
];
};
click = buildPythonPackage rec {
pname = "click";
version = "7.1";
src = fetchPypi {
inherit pname; inherit version;
sha256 = "1qk0x1bh6pmn2al9kq6cbgvm7pchnzl6ahf4zzpbjljl5lpmabs8";
};
};
jupytext = buildPythonPackage rec {
pname = "jupytext";
version = "1.10.3";
src = fetchPypi {
inherit pname; inherit version;
sha256 = "09f0ra3ndq4sxb0q3pjx713pfyc731y6fkzx93481mc7qm2cym5x";
};
propagatedBuildInputs = with python3Packages; [
toml
pyyaml
markdown-it-py
];
};
markdown-it-py = buildPythonPackage rec {
pname = "markdown-it-py";
version = "0.6.0";
src = fetchPypi {
inherit pname; inherit version;
sha256 = "0nb6i1hqlipbcpdd7kad26sfhwjxaqnd6md7piaslyzg77gi650w";
};
propagatedBuildInputs = with python3Packages; [
attrs
];
};
sphinxExternalTOC = buildPythonPackage rec {
# https://pypi.org/project/sphinx-comments/
pname = "sphinx-external-toc";
version = "0.2.2";
src = fetchPypi {
pname = "sphinx_external_toc";
inherit version;
sha256 = "a72c5861f670f1c7a1b92f2159fc9c7c5370e079cad1e3a7be4b269fa8048e8a";
};
propagatedBuildInputs = with python3Packages; [
sphinx
attrs
click
pyyaml
];
};
sphinxComments = buildPythonPackage rec {
# https://pypi.org/project/sphinx-comments/
pname = "sphinx-comments";
version = "0.0.3";
src = fetchPypi {
inherit version; inherit pname;
sha256 = "00170afff27019fad08e421da1ae49c681831fb2759786f07c826e89ac94cf21";
};
propagatedBuildInputs = with python3Packages; [
sphinx
];
};
in buildPythonPackage rec {
pname = "jupyter-book";
version = "0.11.2";
src = fetchPypi {
inherit version; inherit pname;
sha256 = "e32298e03c19f514c745062891143693c5e001a098bae9d59d2e4434b2099c54";
};
propagatedBuildInputs = with python3Packages; [
# click
linkify-it-py
sphinx
sphinxComments
sphinxExternalTOC
jupytext
];
}
但是,当我尝试使用 构建它nix build
,或者使用它获取一个 shell 时nix shell
,或者使用nix develop
,我得到这个错误:
❯ nix build
warning: Git tree '/home/jon/Code/book-computational-literary-analysis' is dirty
error: builder for '/nix/store/pp9074i7bmmvfmff4lkdmnj2wkj8vdaj-python3.8-attrs-20.3.0.drv' failed with exit code 1;
last 10 log lines:
> Executing pipInstallPhase
> /build/attrs-20.3.0/dist /build/attrs-20.3.0
> Processing ./attrs-20.3.0-py2.py3-none-any.whl
> Installing collected packages: attrs
> Attempting uninstall: attrs
> Found existing installation: attrs 21.2.0
> Uninstalling attrs-21.2.0:
> ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '_cmp.pyi'
> Consider using the `--user` option or check the permissions.
>
For full logs, run 'nix log /nix/store/pp9074i7bmmvfmff4lkdmnj2wkj8vdaj-python3.8-attrs-20.3.0.drv'.
error: 1 dependencies of derivation '/nix/store/liza7vix65mk26yc8lfxcsb1xl65ljrs-python3-3.8.9-env.drv' failed to build
这里发生了什么,我该如何解决?