Unable to Install packages- non-zero exit status

I am new to R. I used it briefly a couple years ago but need it again for a stats class. I reopened my old version of it but it was having trouble running certain simple codes so I tried to download packages (knity, dplyr, ggplot2). Unfortunately, I would get lots of different errors as I tried to do this and I figured I should just get the latest version of R. When I did I ran into a new problem. No packages seem to be able to be installed. I simply did library(reader) and it gave:
Error: package or namespace load failed for ‘readr’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘hms’
I also tried to install the other packages I mentioned and it either says " installation of package ‘ggplot2’ had non-zero exit status" or "The downloaded source packages are in

Not sure what I am doing! Need help!

The installations that end with "The downloaded source packages ..." are probably successful installations. Run

Pkgs <- installed.packages()

then look at the Pkgs matrix and see which packages you have already installed. In addition to the packages you directly installed, there will be many that were installed as dependencies. Look for ggplot2, dplyr, etc., and see what is missing. Then try to install any missing packages and, if the installation message contains and Error message, post the entire output of install.packages() here. Put a line with three back ticks just before and after any output you post, like this:
output of install.packages()


Ok. It shows that I have a few installed including readr. I am not really sure how to post the output so here are my screenshots.


I tried:

> install.packages(dyplr)
Error in install.packages : object 'dyplr' not found

I dont understand why the package for readr "failed to load" if it is installed??

Error: package or namespace load failed for ‘readr’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
 there is no package called ‘hms’
In addition: Warning message:
package ‘readr’ was built under R version 4.0.5 

The package readr will not load because it needs the package hms and that is missing. You can try to install hms and see if that is the only package that is missing from readr's dependencies. However, you are running R 4.0.3, which was released 3 years ago. You may well run into trouble using packages built with more recent versions of R. Is there a reason you can't install the latest R?
The installation of dplyr failed because you did not put quotes around the package name. Try


What you can do is

Pkgs <- installed.packages()
DT  <- as.data.frame(Pkgs)
DT[, c(1, 3)]

And copy and paste the output here between


This will give us the names and versions of all the packages you have installed.

Ok here is what I did

Pkgs <- installed.packages()
> DT  <- as.data.frame(Pkgs)
> DT[, c(1, 3)]
                  Package  Version
base64enc       base64enc    0.1-3
bit                   bit    4.0.5
bit64               bit64    4.0.5
bslib               bslib    0.5.1
cachem             cachem    1.0.8
cli                   cli    3.6.1
clipr               clipr    0.8.0
colorspace     colorspace    2.1-0
cpp11               cpp11    0.4.6
crayon             crayon    1.5.2
digest             digest   0.6.33
ellipsis         ellipsis    0.3.2
evaluate         evaluate     0.22
fansi               fansi    1.0.5
farver             farver    2.1.1
fastmap           fastmap    1.1.1
fontawesome   fontawesome    0.5.2
fs                     fs    1.6.3
ggplot2           ggplot2    3.4.4
glue                 glue    1.6.2
gtable             gtable    0.3.4
highr               highr     0.10
hms                   hms    1.1.3
htmltools       htmltools
isoband           isoband    0.2.7
jquerylib       jquerylib    0.1.4
jsonlite         jsonlite    1.8.7
knitr               knitr     1.44
labeling         labeling    0.4.3
lifecycle       lifecycle    1.0.3
magrittr         magrittr    2.0.3
memoise           memoise    2.0.1
mime                 mime     0.12
munsell           munsell    0.5.0
pillar             pillar    1.9.0
pkgconfig       pkgconfig    2.0.3
prettyunits   prettyunits    1.2.0
progress         progress    1.2.2
R6                     R6    2.5.1
rappdirs         rappdirs    0.3.3
RColorBrewer RColorBrewer    1.1-3
readr               readr    2.1.4
rlang               rlang    1.1.1
rmarkdown       rmarkdown     2.25
sass                 sass    0.4.7
scales             scales    1.2.1
stringi           stringi   1.7.12
stringr           stringr    1.5.0
tibble             tibble    3.2.1
tidyselect     tidyselect    1.2.0
tinytex           tinytex     0.48
tzdb                 tzdb    0.4.0
utf8                 utf8    1.2.4
vctrs               vctrs    0.6.4
viridisLite   viridisLite    0.4.2
vroom               vroom    1.6.4
withr               withr    2.5.1
xfun                 xfun     0.40
yaml                 yaml    2.3.7
base                 base    4.3.1
boot                 boot 1.3-28.1
class               class   7.3-22
cluster           cluster    2.1.4
codetools       codetools   0.2-19
compiler         compiler    4.3.1
datasets         datasets    4.3.1
foreign           foreign   0.8-84
graphics         graphics    4.3.1
grDevices       grDevices    4.3.1
grid                 grid    4.3.1
KernSmooth     KernSmooth  2.23-21
lattice           lattice   0.21-8
MASS                 MASS   7.3-60
Matrix             Matrix  1.5-4.1
methods           methods    4.3.1
mgcv                 mgcv   1.8-42
nlme                 nlme  3.1-162
nnet                 nnet   7.3-19
parallel         parallel    4.3.1
rpart               rpart   4.1.19
spatial           spatial   7.3-16
splines           splines    4.3.1
stats               stats    4.3.1
stats4             stats4    4.3.1
survival         survival    3.5-5
tcltk               tcltk    4.3.1
tools               tools    4.3.1
translations translations    4.3.1
utils               utils    4.3.1

Great, thanks.

If you can, I'd suggest following @ FJC's advice and upgrading R.

Then starting with a fresh RStudio session try something like


Actually, even better try


{data.table} has no dependencies.

This topic was automatically closed 42 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.