r-lib / httr

httr: a friendly http package for R
https://httr.r-lib.org
Other
986 stars 1.99k forks source link

installation error if User file path contains an apostrophe #717

Closed roseodea closed 1 year ago

roseodea commented 2 years ago

Using R on a work computer*, my user account name contains an apostrophe. This is messing up the installation of httr. My issue is similar to these two posts:

https://stackoverflow.com/questions/65462881/cannot-download-packages-from-github-from-unexpected-symbol

https://community.rstudio.com/t/trying-to-install-ggplot-2-and-i-keep-getting-this-error-error-unexpected-symbol-in-setwd-c-users-joshs/82061

Due to the security settings on the work computer I can't easily create a different user account.

So far I haven't had any other problems installing packages (e.g., dplyr installed fine). Any chance there's a simple work-around that can be included in httr?

Error message:

installing the source package ‘httr’

trying URL 'https://cran.csiro.au/src/contrib/httr_1.4.3.tar.gz'
Content type 'application/x-gzip' length 161122 bytes (157 KB)
downloaded 157 KB

* installing *source* package 'httr' ...
** package 'httr' successfully unpacked and MD5 sums checked
** using staged installation
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
Error: unexpected symbol in "setwd('C:/Users/ROSE~1.O'D"
Execution halted
ERROR: lazy loading failed for package 'httr'
* removing 'C:/R/library/httr'

The downloaded source packages are in
        ‘C:\Users\Rose.O'Dea\AppData\Local\Temp\Rtmp6PWdMo\downloaded_packages’
Warning message:
In install.packages("httr") :
  installation of package ‘httr’ had non-zero exit status

*Session info:

R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)
hadley commented 1 year ago

This is mostly like a bug with install.packages() which we have limited ability to fix. You might try using the pak package instead.