从Bitbucket包创建conda配方时出错

时间:2017-05-18 19:13:38

标签: python bash anaconda conda miniconda

我在Bitbucket上有一个包,其中包含Python,R和bash中的代码文件。 我正在使用运行Linux CentOS 7的笔记本电脑。

我想为它创建conda package。我开始创建一个conda配方,但我可能犯了一些错误。我使用的是conda 4.3.18。 我尝试使用以下命令构建我的conda配方,但它产生了一些我无法解释的错误:

$ conda build behst_conda_recipe/

BUILD START: behst--0
pulling from https://bitbucket.org/PROJECT_ADDRESS
searching for changes
no changes found
checkout: 'tip'
updating to branch default
108 files updated, 0 files merged, 0 files removed, 0 files unresolved
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
Package: behst--0
source tree in: /home/davide/miniconda3/conda-bld/behst_1495134385344/work
+ source /home/davide/miniconda3/bin/activate /home/davide/miniconda3/conda-bld/behst_1495134385344/_b_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac
+ set -o nounset -o pipefail -o errexit
+ set -o xtrace
+ echo 'Running build.sh'
Running build.sh
INFO conda_build.build:bundle_conda(861): Packaging behst--0
number of files: 0
Fixing permissions
Fixing permissions
Traceback (most recent call last):
  File "/home/davide/miniconda3/lib/python3.5/site-packages/conda_build/utils.py", line 133, in _copy_with_shell_fallback
    stderr=subprocess.PIPE, stdout=subprocess.PIPE)
  File "/home/davide/miniconda3/lib/python3.5/subprocess.py", line 581, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'cp -a /home/davide/miniconda3/conda-bld/behst_1495134385344/work/LICENSE /home/davide/miniconda3/conda-bld/behst_1495134385344/_b_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/info/LICENSE.txt' returned non-zero exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/davide/miniconda3/bin/conda-build", line 6, in <module>
    sys.exit(conda_build.cli.main_build.main())
  File "/home/davide/miniconda3/lib/python3.5/site-packages/conda_build/cli/main_build.py", line 334, in main
    execute(sys.argv[1:])
  File "/home/davide/miniconda3/lib/python3.5/site-packages/conda_build/cli/main_build.py", line 325, in execute
    noverify=args.no_verify)
  File "/home/davide/miniconda3/lib/python3.5/site-packages/conda_build/api.py", line 97, in build
    need_source_download=need_source_download, config=config)
  File "/home/davide/miniconda3/lib/python3.5/site-packages/conda_build/build.py", line 1518, in build_tree
    config=config)
  File "/home/davide/miniconda3/lib/python3.5/site-packages/conda_build/build.py", line 1154, in build
    built_package = bundlers[output_dict.get('type', 'conda')](output_dict, m, config, env)
  File "/home/davide/miniconda3/lib/python3.5/site-packages/conda_build/build.py", line 893, in bundle_conda
    create_info_files(metadata, files, config=config, prefix=config.build_prefix)
  File "/home/davide/miniconda3/lib/python3.5/site-packages/conda_build/build.py", line 494, in create_info_files
    copy_license(m, config)
  File "/home/davide/miniconda3/lib/python3.5/site-packages/conda_build/build.py", line 272, in copy_license
    locking=config.locking)
  File "/home/davide/miniconda3/lib/python3.5/site-packages/conda_build/utils.py", line 177, in copy_into
    _copy_with_shell_fallback(src, dst_fn)
  File "/home/davide/miniconda3/lib/python3.5/site-packages/conda_build/utils.py", line 136, in _copy_with_shell_fallback
    raise OSError("Failed to copy {} to {}.  Error was: {}".format(src, dst, e))
OSError: Failed to copy /home/davide/miniconda3/conda-bld/behst_1495134385344/work/LICENSE to /home/davide/miniconda3/conda-bld/behst_1495134385344/_b_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/info/LICENSE.txt.  Error was: Command 'cp -a /home/davide/miniconda3/conda-bld/behst_1495134385344/work/LICENSE /home/davide/miniconda3/conda-bld/behst_1495134385344/_b_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/info/LICENSE.txt' returned non-zero exit status 1
Exception ignored in: <bound method BaseFileLock.__del__ of <filelock.UnixFileLock object at 0x7f30df7349e8>>
Traceback (most recent call last):
  File "/home/davide/miniconda3/lib/python3.5/site-packages/filelock.py", line 305, in __del__
  File "/home/davide/miniconda3/lib/python3.5/site-packages/filelock.py", line 292, in release
  File "/home/davide/miniconda3/lib/python3.5/site-packages/filelock.py", line 371, in _release
AttributeError: 'NoneType' object has no attribute 'flock'

有谁知道这些错误是什么意思?

编辑:这是meta.yaml文件:

package:

  name: behst

source:

  hg_url: https://bitbucket.org/PROJECT_ADDRESS

about:

  home: https://bitbucket.org/PROJECT_ADDRESS
  license: BSD
  license_file: LICENSE

虽然build.sh目前只是一个echo命令:

#!/bin/bash
#
#$ -cwd
#$ -S /bin/bash
#
set -o nounset -o pipefail -o errexit
set -o xtrace

echo "Running build.sh"

2 个答案:

答案 0 :(得分:0)

你的家庭目录是否已加密?以下是github上的related issues。 解决方案是使用指向家外某处的--croot参数,例如:的/ tmp / _conda_build _

答案 1 :(得分:0)

您的主目录似乎已加密。处理加密文件夹时的字符长度从正常的255个字符长度减少。

因此,即使按照conda的贡献者,唯一的解决方案是将--croot用于非加密位置,例如/ tmp / whateverfolder

conda config --prepend pkgs_dirs /tmp/temp_conda_recipe 

然后

conda build behst_conda_recipe/ --croot /tmp/temp_conda_recipe