无法安装我创建的软件包 [英] Cannot install my created packages
问题描述
我一直在写很多代码供个人使用,最终达到了一个目的,我意识到我应该把所有这些都包含在一个我可以加载的包中,而不是每次都复制并粘贴. /p>
我按照以下教程创建了基本软件包.
https://hilaryparker.com/2014/04/29/Writing-an-r-package-from-scratch/
据我所知,实际的创建元素一切都进行得很好.这是结果的屏幕截图:
cats文件夹:
/cats/R文件夹
/cats/man文件夹
当我想运行该行时出现问题:
install("cats")
当我尝试这样做时,出现以下错误:
Installing cats
"C:/PROGRA~1/R/R-33~1.1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL "/Documents/cats" --library="C:/Users/Aodhán/Documents/R/win-library/3.3" --install-tests
* installing *source* package 'cats' ...
Warning in file(file, if (append) "a" else "w") :
cannot open file 'C:/Users/Aodhán/Documents/R/win-library/3.3/cats/DESCRIPTION': No such file or directory
Error in file(file, if (append) "a" else "w") :
cannot open the connection
ERROR: installing package DESCRIPTION failed for package 'cats'
* removing 'C:/Users/Aodhán/Documents/R/win-library/3.3/cats'
Error: Command failed (1)
此错误发生在我自己的程序包中,但是如果我运行以下命令,也会发生此错误:
devtools::install_github("klutometis/roxygen")
任何建议将不胜感激.
可能是我的用户名中包含字符á吗?
DESCRIPTION文件为:
包装:猫
标题:包裹的用途(一行,标题大小写)
版本:0.0.0.9000
Authors @ R:人员(第一",最后",电子邮件="first.last@example.com", 角色= c("aut","cre"))
维护者:AodhánO'Leary
作者:AodhánO'Leary [aut,cre]
说明:包裹的用途(一个段落).
取决于:R(> = 3.3.1)
许可证:它拥有什么许可证?
编码:UTF-8
LazyData:是
氧气注:6.0.1
Sys.getenv("R_HOME")
返回"C:/PROGRA~1/R/R-33~1.1"
Sys.getenv("R_LIBS_USER")
返回"C:\ Users \Aodhán\ Documents/R/win-library/3.3"
Sys.getenv("R_HOME")
返回"C:\ Users \Aodhán\ Documents"
devtools::build("cats")
创建"cats_0.0.0.9000.tar.gz"
install.packages("../cats_version.tar.gz")
返回与上述相同的错误
注意:这是在使用R 3.3.1的Win10机器上,我对此表示歉意,没有在上面提到.昨天写这篇文章的时候我很累.
这是使用以下命令的结果:R CMD build cats
后跟R CMD check cats
00检查:
- 使用日志目录'C:/Users/Aodhán/Documents/cats.Rcheck'
- 使用R版本3.3.1(2016-06-21)
- 使用平台:x86_64-w64-mingw32(64位)
- 使用会话字符集:ISO8859-1
- 正在检查文件"cats/DESCRIPTION" ...确定
- 这是软件包'cats'版本'0.0.0.9000'
- 程序包编码:UTF-8
- 检查包名称空间信息...确定
- 检查程序包的依存关系...确定
- 检查这是否是源软件包...确定
- 检查是否有名称空间...确定
- 正在检查.dll和.exe文件...确定
- 检查隐藏的文件和目录...注意发现以下隐藏的文件和目录:.gitignore这些是大多数 可能包含在错误中.请参阅 编写R扩展程序"手册.
- 检查可移植文件名...确定
- 正在检查是否可以安装软件包"cats" ...错误安装失败.看 有关详细信息,请访问"C:/Users/Aodhán/Documents/cats.Rcheck/00install.out".
- 完成
状态:1错误,1注意
00install.out
- 安装 source 包'cats'...
文件警告(文件,如果(附加)"a",否则"w"): 无法打开文件'C:/Users/Aodhan/Documents/cats.Rcheck/cats/DESCRIPTION':
没有这样的文件或目录
文件错误(文件(如果(附加)"a",否则(w))): 无法打开连接
错误:对于软件包猫",安装软件包Description失败
- 删除"C:/Users/Aodhán/Documents/cats.Rcheck/cats"
问题是我名字á中的特殊字符.当我将其放在C:\目录中并运行R CMD build cats
和R CMD check cats
时,它通过了该错误(尽管pdf稍后出现错误-我会自行解决).
我将尝试将其发布为错误.有点烦人.应该早点想到该测试的.
I've been writing a lot of code for my personal use and finally reached a point where I realised I should really be including this all in a package which I can load in instead of copy and pasting it in each time.
I followed the following tutorial for the creation of a basic package.
https://hilaryparker.com/2014/04/29/writing-an-r-package-from-scratch/
As far as I can tell everything went well with the actual creation element. Here are screenshots of the result:
The cats folder:
The /cats/R folder
The /cats/man folder
The problem comes when I want to run the line:
install("cats")
When I try to do that I get the following error:
Installing cats
"C:/PROGRA~1/R/R-33~1.1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL "/Documents/cats" --library="C:/Users/Aodhán/Documents/R/win-library/3.3" --install-tests
* installing *source* package 'cats' ...
Warning in file(file, if (append) "a" else "w") :
cannot open file 'C:/Users/Aodhán/Documents/R/win-library/3.3/cats/DESCRIPTION': No such file or directory
Error in file(file, if (append) "a" else "w") :
cannot open the connection
ERROR: installing package DESCRIPTION failed for package 'cats'
* removing 'C:/Users/Aodhán/Documents/R/win-library/3.3/cats'
Error: Command failed (1)
This error happens for my own package, but it also happens if I run the command:
devtools::install_github("klutometis/roxygen")
Any advice would be appreciated.
EDIT: Could it be that my username contains the character á in it?
EDIT 2:The DESCRIPTION file is:
Package: cats
Title: What the Package Does (one line, title case)
Version: 0.0.0.9000
Authors@R: person("First", "Last", email = "first.last@example.com", role = c("aut", "cre"))
Maintainer: Aodhán O'Leary
Author: Aodhán O'Leary [aut, cre]
Description: What the package does (one paragraph).
Depends: R (>= 3.3.1)
License: What license is it under?
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.0.1
Sys.getenv("R_HOME")
returns "C:/PROGRA~1/R/R-33~1.1"
Sys.getenv("R_LIBS_USER")
returns "C:\Users\Aodhán\Documents/R/win-library/3.3"
Sys.getenv("R_HOME")
returns "C:\Users\Aodhán\Documents"
devtools::build("cats")
creates "cats_0.0.0.9000.tar.gz"
install.packages("../cats_version.tar.gz")
returns the same error as above
Note: This is on a Win10 machine, using R 3.3.1, which I apologise for not mentioning up top. I was quite tired when writing the post yesterday.
Edit 3: Here's the result of using the following commands: R CMD build cats
followed by R CMD check cats
00check:
- using log directory 'C:/Users/Aodhán/Documents/cats.Rcheck'
- using R version 3.3.1 (2016-06-21)
- using platform: x86_64-w64-mingw32 (64-bit)
- using session charset: ISO8859-1
- checking for file 'cats/DESCRIPTION' ... OK
- this is package 'cats' version '0.0.0.9000'
- package encoding: UTF-8
- checking package namespace information ... OK
- checking package dependencies ... OK
- checking if this is a source package ... OK
- checking if there is a namespace ... OK
- checking for .dll and .exe files ... OK
- checking for hidden files and directories ... NOTE Found the following hidden files and directories: .gitignore These were most likely included in error. See section 'Package structure' in the 'Writing R Extensions' manual.
- checking for portable file names ... OK
- checking whether package 'cats' can be installed ... ERROR Installation failed. See 'C:/Users/Aodhán/Documents/cats.Rcheck/00install.out' for details.
- DONE
Status: 1 ERROR, 1 NOTE
00install.out
- installing source package 'cats' ...
Warning in file(file, if (append) "a" else "w") : cannot open file 'C:/Users/Aodhan/Documents/cats.Rcheck/cats/DESCRIPTION':
No such file or directory
Error in file(file, if (append) "a" else "w") : cannot open the connection
ERROR: installing package DESCRIPTION failed for package 'cats'
- removing 'C:/Users/Aodhán/Documents/cats.Rcheck/cats'
The problem was the special character in my name, á. When I put it in the C:\ directory and ran R CMD build cats
and R CMD check cats
it passed that error (though there was an error later on with the pdf - I'll see if I can resolve that myself).
I'll try and post this as a bug. Moderately annoying. Should have thought of that test earlier.
这篇关于无法安装我创建的软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!