为啥在 conda-build 的构建过程中将 $CONDA_PREFIX 设置为 $BUILD_PREFIX?
Posted
技术标签:
【中文标题】为啥在 conda-build 的构建过程中将 $CONDA_PREFIX 设置为 $BUILD_PREFIX?【英文标题】:Why is $CONDA_PREFIX set to $BUILD_PREFIX during the build process of conda-build?为什么在 conda-build 的构建过程中将 $CONDA_PREFIX 设置为 $BUILD_PREFIX? 【发布时间】:2021-04-07 13:04:55 【问题描述】:我有以下 build.sh 并想通过简单地将 $RECIPE_DIR 复制到 $CONDA_PREFIX/...来安装我的 python 包。
#!/bin/sh
# Variables
# package_name="filip_test_package"
dir_in_conda=$CONDA_PREFIX/lib/python3.8/site-packages/$PKG_NAME
# Install
echo "Installing"
echo $CONDA_PREFIX
echo $RECIPE_DIR
echo $PKG_NAME
mkdir $dir_in_conda
cp -RT $RECIPE_DIR/$PKG_NAME $dir_in_conda
但是,在执行期间,我得到了以下堆栈跟踪。似乎 $CONDA_PREFIX 被替换为 $BUILD_PREFIX 但我不知道为什么。我需要在我的 meta.yaml 中设置一些东西吗?
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done
source tree in: /home/filip/Dokumente/Programming/build_python_package/conda-build/filip_test_package_1617799915931/work
export PREFIX=/home/filip/Dokumente/Programming/build_python_package/conda-build/filip_test_package_1617799915931/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol
export BUILD_PREFIX=/home/filip/Dokumente/Programming/build_python_package/conda-build/filip_test_package_1617799915931/_build_env
export SRC_DIR=/home/filip/Dokumente/Programming/build_python_package/conda-build/filip_test_package_1617799915931/work
Installing
$BUILD_PREFIX
/home/filip/Dokumente/Programming/build_python_package/python_project
filip_test_package
mkdir: cannot create directory ‘/home/filip/Dokumente/Programming/build_python_package/conda-build/filip_test_package_1617799915931/_build_env/lib/python3.8/site-packages/filip_test_package’: No such file or directory
Traceback (most recent call last):
File "/opt/anaconda3/envs/test_env/bin/conda-build", line 11, in <module>
sys.exit(main())
File "/opt/anaconda3/envs/test_env/lib/python3.8/site-packages/conda_build/cli/main_build.py", line 481, in main
execute(sys.argv[1:])
File "/opt/anaconda3/envs/test_env/lib/python3.8/site-packages/conda_build/cli/main_build.py", line 470, in execute
outputs = api.build(args.recipe, post=args.post, test_run_post=args.test_run_post,
File "/opt/anaconda3/envs/test_env/lib/python3.8/site-packages/conda_build/api.py", line 186, in build
return build_tree(
File "/opt/anaconda3/envs/test_env/lib/python3.8/site-packages/conda_build/build.py", line 3068, in build_tree
packages_from_this = build(metadata, stats,
File "/opt/anaconda3/envs/test_env/lib/python3.8/site-packages/conda_build/build.py", line 2191, in build
utils.check_call_env(cmd, env=env, rewrite_stdout_env=rewrite_env,
File "/opt/anaconda3/envs/test_env/lib/python3.8/site-packages/conda_build/utils.py", line 412, in check_call_env
return _func_defaulting_env_to_os_environ('call', *popenargs, **kwargs)
File "/opt/anaconda3/envs/test_env/lib/python3.8/site-packages/conda_build/utils.py", line 392, in _func_defaulting_env_to_os_environ
raise subprocess.CalledProcessError(proc.returncode, _args)
subprocess.CalledProcessError: Command '['/bin/bash', '-o', 'errexit', '/home/filip/Dokumente/Programming/build_python_package/conda-build/filip_test_package_1617799915931/work/conda_build.sh']' returned non-zero exit status 1.
【问题讨论】:
【参考方案1】:我遇到了完全相同的问题。安装 anaconda 而不是 miniconda 解决了我的问题。 请注意,重新安装干净的 miniconda 并没有解决它。
【讨论】:
以上是关于为啥在 conda-build 的构建过程中将 $CONDA_PREFIX 设置为 $BUILD_PREFIX?的主要内容,如果未能解决你的问题,请参考以下文章
当使用 conda-build 构建 conda 包并且我的代码使用纯 python 库时,我需要在 meta.yaml 文件中的 build/host/run 中放入啥?
官方 AnacondaRecipes/opencv-feedstock 的 conda-build 无法查找 libpng.h
使用 (XALM) 构建过程模板在 TFS 2013 中将工具路径设置为 MSBuild 2019
如何在 Webpack 构建过程中将 React 应用程序中的 mockServiceWorker.js 文件复制到我的构建文件夹