简体   繁体   English

构建conda软件包时未定义cran_mirror

[英]Undefined cran_mirror when building conda packages

I am trying to build an R package in conda using skeleton. 我正在尝试使用骨架在conda中构建R包。 After preparing the environment with the required packages, I execute the following commands 在准备好具有所需软件包的环境之后,我执行以下命令

$ conda skeleton cran arules
$ conda build r-arules

The recipe files are generated and everything seems OK, but the build command results into the following error: 配方文件已生成,并且一切正常,但是build命令导致以下错误:

Adding in variants from internal_defaults
INFO:conda_build.variants:Adding in variants from internal_defaults
Attempting to finalize metadata for r-arules
INFO:conda_build.metadata:Attempting to finalize metadata for r-arules
Undefined Jinja2 variables remain (['cran_mirror', 'cran_mirror']). 
Please enable source downloading and try again.

I've been reading the documentation and searching the Web for a solution to this problem, without success, and I do not know what else to do. 我一直在阅读文档,并在网上搜索该问题的解决方案,但是没有成功,而且我不知道该怎么办。 ¿Any ideas? 有任何想法吗?

Notes : I've started following this tutorial: http://ihrke.github.io/conda.html but afterwards I have also checked the official conda documentation on building packages and other related docs. 注意 :我已经开始按照本教程进行操作: http : //ihrke.github.io/conda.html,但是之后,我还检查了有关构建软件包和其他相关文档的官方conda文档。 I have updated conda (= 4.5.2), as well as conda-build ( = 3.10.1) 我已经更新了conda(= 4.5.2),以及conda-build(= 3.10.1)

I finally find out how to solve my issue in two different ways: 我终于找到了如何以两种不同的方式解决我的问题的方法:

The most straight solution is to specify a cran url using --cran-url option when creating the recipse, as follows: 最直接的解决方案是在创建食谱时使用--cran-url选项指定一个cran url,如下所示:

$ conda skeleton cran arules --cran-url https://mran.microsoft.com/snapshot/2018-01-01/

Another solution is to create a conda-build config file, using yaml . 另一个解决方案是使用yaml创建conda构建配置文件。 Inside that file we specify the cran mirror, for example: 在该文件中,我们指定cran镜像,例如:

cran_mirror: https://mran.microsoft.com/snapshot/2018-01-01/ cran_mirror: https ://mran.microsoft.com/snapshot/2018-01-01/

And then, we should use option -m when creating the recipe 然后,在创建配方时,我们应该使用选项-m

$ conda skeleton cran arules -m path/to/conda_build_config.yam

PD: It seems there will be a default cran mirror in the next release of conda-build , according to comments in this pull request PD:根据此pull request中的评论,似乎在下一版的conda-build中将存在默认的cran镜像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM