RStudio cannot find install.packages on Linux (Manjaro, Arch)

Hi, It's as the title says, for some reason, RStudio can't find the install.packages function, or at least, that's what it says. If I run install.packages("package"), it's clearly there and runs but fails, midway through. Here's an example (happens with other packages I tried too):

> install.packages("xml2")
Installing package into ‘/home/ydeng/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/xml2_1.3.2.tar.gz'
Content type 'application/x-gzip' length 271876 bytes (265 KB)
==================================================
downloaded 265 KB



Loading local functions ...Error in install.packages("httr") : 
  could not find function "install.packages"
Calls: source ... eval -> eval -> source -> withVisible -> eval -> eval
Execution halted
Warning in install.packages :
  installation of package ‘xml2’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/RtmpsaepDQ/downloaded_packages’

Interestingly enough, if I run the command in a normal terminal running R, it works fine after prompting for selecting a secure CRAN mirror.

Any help is appreciated!

So I noticed that it was complaining about the httr package no matter which package I told it to install, so I manually installed httr and that fixed it. If anyone can explain this to me, I'd appreciate it. I know httr is used in the .Rprofile.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.