New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
usethis cannot find path with accents. #1630
Comments
|
I was able to replicate this with umlauts (ä,ü,ö) e.g.,
works fine, but |
|
I would urge Windows users to update to R 4.2, which has made some big strides forward in base R's handling of encoding, which is also going to bring big benefits for file paths. I haven't analyzed this particular case yet, but many problems of this nature on Windows are due to bugs/infelicities in base R itself and are almost beyond the reach of an add-on package to easily fix. https://developer.r-project.org/Blog/public/2021/12/07/upcoming-changes-in-r-4.2-on-windows/ |
|
|
|
Good to hear! Again, I haven't poked around usethis to see if we are doing something suboptimal, but I suspect package maintainers will increasingly advise users with path encoding problems on Windows to upgrade to R 4.2, instead of us continuing to implement special guards and workarounds. |
|
I'm afraid I might haven spoken too fast. In R 4.2.0, the following indeed does work: usethis::create_package("D:/é/mypkg")
usethis::use_package_doc()
devtools::document(roclets = c('rd', 'collate', 'namespace'))
But not getwd()
"D:/é/mypkg"
devtools::check()
[...]
checking R files for syntax errors ... ERROR
Error in file 'R/mypkg-package.R':
cannot open the connection
Warning in file 'R/mypkg-package.R':
cannot open file 'D:/C)/mypkg.Rcheck/00_pkg_src/mypkg/R/mypkg-package.R': No such file or directory
checking examples ... ERROR
Running massageExamples to create 'mypkg-Ex.R' failed
Error in find.package(package, lib.loc) :
there is no package called 'mypkg'
Calls: <Anonymous> -> Rd_db -> find.package
Execution halted
NONESeems like the accent "é" is being replaced with letter "C" in the path. I've tried restarting Rstudio and my computer, to no avail. [Edit: Removed bit about the permission denied error as it was fixed elsewhere and is only tangentially relevant to the current issue about accents: https://community.rstudio.com/t/r-4-2-0-file-rstudio-lock-creates-copying-to-build-directory-failed-permission-denied-error/136347/6. Original issue described above is still not solved.] |
|
Since I was last here, I've discovered a problem in fs that is affecting both devtools and usethis, on Windows, for R versions prior to 4.2: r-lib/fs#383 Once that's fixed, that should fix this. I can't replicate your failure with R 4.2 on Windows. # from a different R session:
# usethis::create_package(fs::path("~/Desktop/föö/fgh"))
R version 4.2.0 (2022-04-22 ucrt) -- "Vigorous Calisthenics"
<snip, snip>
> usethis::use_package_doc()
✔ Setting active project to 'C:/Users/jenny/Desktop/föö/fgh'
✔ Writing 'R/fgh-package.R'
• Modify 'R/fgh-package.R'
> devtools::document(roclets = c('rd', 'collate', 'namespace'))
ℹ Updating fgh documentation
ℹ Loading fgh
Writing fgh-package.Rd
> getwd()
[1] "C:/Users/jenny/Desktop/föö/fgh"
> devtools::check()
ℹ Updating fgh documentation
ℹ Loading fgh
<snip, snip>
── R CMD check results ───────────────────────────────────────────────────────────────────────────────────────────────────── fgh 0.0.0.9000 ────
Duration: 28.6s
❯ checking DESCRIPTION meta-information ... WARNING
Non-standard license specification:
`use_mit_license()`, `use_gpl3_license()` or friends to pick a
license
Standardizable: FALSE
0 errors ✔ | 1 warning ✖ | 0 notes ✔So what you're reporting re the drive name seems like it might be a different problem. For example, I see several existing issues in fs re: a mapped network drive in Windows. Could that be relevant to your situation? |
|
Ok, so I was going to say that for some magical reason, I just tried this again, and it worked. But I set the working directory from a different project (with no accent), then ran So I tried specifically opening the Anyhow, I just deleted the whole folder/package and tried again. And then I was going to say that for some magical reason, the issue was gone, and it just worked. But actually, I found out that it works with the In this case, do you recommend closing this issue and opening one on the RStudio community forum? |
I'd like to leave this open until the fs problem is resolved, just so people don't new issues about this known problem. However it does seem like you might want to pursue the other RStudio and R 4.2 matter separately / elsewhere. That's not the devtools/usethis/fs problem. |
|
For reference, I have created an RStudio community issue here and it was replicated by at least one person: https://community.rstudio.com/t/r-4-2-0-rstudio-specific-error-with-devtools-check-in-accented-path-directory/138119/2 |
Problem:
usethiscannot find path with accents.The following works immediately (path has no accent):
But adding an accent in the path produces an error:
We can set working directory directly and retry the command but that produces the same error. Same with:
A workaround is to create a package using the RStudio interface. However, even after this, trying to document the package:
Or even checking the package with devtools:
Workaround is to move all files and folders in a new path without accents. However, this is not convenient and not even always possible when using shared work OneDrive paths (for instance). Resolution would be to support accented paths.
The text was updated successfully, but these errors were encountered: