conda env 创建退出与验证交易:/已杀



我正在尝试通过 Ubuntu18 上的conda从现有环境创建一个环境。我想通过导出一个 environment.yml 文件,然后使用它来创建另一个环境来实现这一点。问题是它在创建环境之前终止,没有错误消息。

(nenv) nick {~}$ conda env export --name nenv > nenv.yml
(nenv) nick {~}$ sudo su - testusr
testusr@ip:~$ conda env create --name myenv --file /home/nick/nenv.yml 
Collecting package metadata (repodata.json): done
Solving environment: done
Preparing transaction: done
Verifying transaction: / Killed

无论出于何种原因,它都会在"验证交易"上不断崩溃。我已经在安装到公共路径的环境中和另一个安装到用户目录的环境中尝试过这个。

一些注意事项:

  1. 这是 Linux 上的多用户 anaconda 安装

  2. 根 conda 环境位于/opt/conda/

  3. 用户正在使用根conda二进制文件conda env create

  4. 康达 4.7.11

我已经能够在用户之间创建一个共享环境,但我还想弄清楚如何使用需求文件类型方法(对于 JupyterHub 内核)为两个不同的用户提供相同 conda 环境的副本。


在非常有用的评论之后,我看到有很多权限错误。我可能会从这里得到它。绝对应该考虑寻找详细标志 😅如果我找到解决方案,将在此处更新:

... (much more ☝️)
DEBUG conda.gateways.disk.create:create_link(363): PermissionError(1, 'Operation not permitted')
DEBUG conda.gateways.disk.create:create_link(367): hard-link failed. falling back to copy
error: PermissionError(1, 'Operation not permitted')
src: /opt/conda/pkgs/seaborn-0.9.0-py37_0/info/index.json
dst: /home/scientist/.conda/envs/nenv/.tmp.index.json.ce11d637
DEBUG conda.gateways.disk.create:create_link(363): PermissionError(1, 'Operation not permitted')
DEBUG conda.gateways.disk.create:create_link(367): hard-link failed. falling back to copy
error: PermissionError(1, 'Operation not permitted')
src: /opt/conda/pkgs/anaconda-2019.03-py37_0/info/index.json
dst: /home/scientist/.conda/envs/nenv/.tmp.index.json.26122231
DEBUG conda.core.link:_get_python_version(812): found in current transaction python version 3.7.3
done
Verifying transaction: ...working... Killed

所以,答案是这是由于我的 anaconda 安装方式的权限问题。我最初将其安装到/opt/conda 作为 root 用户,这使得某些功能(包括环境创建)显然不起作用。

有趣的是,我炸毁了服务器并重新创建了它(它有一个 ansible 剧本来设置它),并且安装(虽然仍然由 root 拥有)没有我在这个问题中提出的相同问题。也许新版本的 conda 在创建环境时没有这个问题。


记录我在这里所做的工作,因为它进步;但是,如果有人从我的最新观点中知道出了什么问题,我会将其标记为正确答案!

遵循此处的指南:https://support.anaconda.com/hc/en-us/articles/360023865574-Multi-User-Anaconda-Installation-on-Linux

(nenv) nick {~}$ ls -al /opt/
total 12
drwxr-xr-x  3 root root 4096 Jul 14 10:22 .
drwxr-xr-x 23 root root 4096 Aug 12 18:45 ..
drwxr-xr-x 26 root root 4096 Aug 12 22:10 conda
(nenv) nick {~}$ sudo chgrp -R developers /opt/conda/
(nenv) nick {~}$ ls -al /opt/
total 12
drwxr-xr-x  3 root root       4096 Jul 14 10:22 .
drwxr-xr-x 23 root root       4096 Aug 12 18:45 ..
drwxr-xr-x 26 root developers 4096 Aug 12 22:10 conda
(nenv) nick {~}$ sudo chmod 770 -R /opt/conda/
(nenv) nick {~}$ ls -al /opt/
total 12
drwxr-xr-x  3 root root       4096 Jul 14 10:22 .
drwxr-xr-x 23 root root       4096 Aug 12 18:45 ..
drwxrwx--- 26 root developers 4096 Aug 12 22:10 conda

在这一点上,根据conda文档,我应该能够创建环境......但我不能。错误现在为:

DEBUG conda.gateways.disk.permissions:make_writable(38): tried make writable but failed: /opt/conda/envs/nenv/.tmp.index.json.42434629
PermissionError(1, 'Operation not permitted')
DEBUG conda.gateways.disk.permissions:make_writable(38): tried make writable but failed: /opt/conda/envs/nenv/.tmp.index.json.c45bcb48
PermissionError(1, 'Operation not permitted')
DEBUG conda.gateways.disk.permissions:make_writable(38): tried make writable but failed: /opt/conda/envs/nenv/.tmp.index.json.11a11e9d
PermissionError(1, 'Operation not permitted')
DEBUG conda.core.link:_get_python_version(812): found in current transaction python version 3.7.3
done
Verifying transaction: ...working... Killed

相当令人困惑,因为用户是拥有整个目录的组的一部分。

如果您的计算机没有足够的 RAM 供 conda 解析内存中的所有依赖项,也可能发生 Kill 问题。如果您使用的是虚拟机(例如在 AWS 或 Azure 上),只需调整 VM 大小以增加其 RAM,然后重试conda install

最新更新