[英]Using conda to build and install local or custom R package
I would like to install a local R package into a conda environment.我想将本地 R package 安装到 conda 环境中。 The package is not on CRAN or github (and not on any conda channel).
package 不在 CRAN 或 github 上(也不在任何 conda 频道上)。 For packages on CRAN this is relatively straightforward:
对于 CRAN 上的包,这相对简单:
conda skeleton cran <pckg>
conda-build r-<pckg>
conda install --use-local r-<pcgk>
For packages on github this works similarly: install R package from github using "conda" (apart from some issues of versions requiring tags). For packages on github this works similarly: install R package from github using "conda" (apart from some issues of versions requiring tags).
conda skeleton cran <url>/<pcgk>
conda-build r-<pckg>
conda install --use-local r-<pcgk>
However, I cannot get this to work with a local package (the package builds without problems using R CMD build
).但是,我无法与本地ZEFE90A8E604A7C840E8D03A67F6B7D8Z一起使用(
R CMD build
This is what I have tried:这是我尝试过的:
conda skeleton cran <path>/<pcgk>
Connects to cran and then (of course) does not find the package.连接到 cran,然后(当然)找不到 package。
conda skeleton cran --cran-url <relative_path>/<pckg> <pckg>
throws an error with:引发错误:
requests.exceptions.MissingSchema: Invalid URL '<relative_path>/<pckg>/src/contrib/': No schema supplied. Perhaps you meant http://<relative_path>/<pckg>/src/contrib/?
conda skeleton cran <absolute_path>/<pckg> <pckg>
Throws:抛出:
File "/home/myuser/.conda/envs/myenv/lib/python3.9/site-packages/conda_build/skeletons/cran.py", line 743, in package_to_inputs_dict
pkg_name = re.match(r'(.*)_(.*)', pkg_filename).group(1).lower()
AttributeError: 'NoneType' object has no attribute 'group'
And lastly:最后:
conda skeleton cran --cran-url <absolute_path>/<pckg> <pckg>
Throws:抛出:
File "/home/myuser/.conda/envs/myenv/lib/python3.9/site-packages/requests/sessions.py", line 742, in get_adapter
raise InvalidSchema("No connection adapters were found for {!r}".format(url))
requests.exceptions.InvalidSchema: No connection adapters were found for '<absolute path>/<pckg>/src/contrib/'
Is this not possible with conda?康达不可能做到这一点吗? Or am I making a mistake?
还是我犯了一个错误?
Here someone tried to write the skeleton files for a local package themselves, but it seems without success. 这里有人尝试自己为本地的 package 编写骨架文件,但似乎没有成功。
Could you upload your R package to your private github repository?您能否将您的 R package 上传到您的私有 github 存储库? Then you could proceed with the common
conda skeleton cran <github_pckg_http_or_ssh>
.然后你可以继续使用常见的
conda skeleton cran <github_pckg_http_or_ssh>
。
conda
will ask (internally by git, I think) the your password to retrieve the code. conda
会询问(我认为是 git 内部)您的密码以检索代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.