Installing lattice in R: "Error : Invalid DESCRIPTION file" - r

I'm using R 3.0.2 and am trying to install the lattice package, like so:
install.packages("lattice")
This leads to the following error:
Error : Invalid DESCRIPTION file
Invalid Priority field. Packages with priorities 'base' or 'recommended' or 'defunct-base' must already be known to R.
How can I fix it?
Since the DESCRIPTION just seems to contain meta-info, I do not see why this should preclude me from installing the lattice package.
Update:
I have lattice installed, but need a newer version due to some dependencies. Using update.packages() for lattice returns the same error as above. I wonder if it is possible that the newer lattice versions are not compatible with the new R version?
Seeing BondedDust referring to DESCRIPTION I started investigating it, and it seems the new package has a Priority field in the DESCRIPTION file, but that the old version of the lattice DESCRIPTION file does not. Why should this matter?
me#tang:~/test_lattice$ grep Priority /home/endrebak/local/anaconda/lib64/R/library/lattice/DESCRIPTION
me#tang:~/test_lattice$ grep Priority lattice/DESCRIPTION #New version
Priority: recommended
I've tried updating the old DESCRIPTION file with a Priority: recommended line and reloading R, but still
>rownames(installed.packages(priority="recommended"))
NULL
#rownames(installed.packages(priority="base")) works fine, however.
Full error message below:
trying URL 'http://cran.uib.no/src/contrib/lattice_0.20-29.tar.gz'
Content type 'application/x-gzip' length 347091 bytes (338 Kb)
* installing *source* package ‘lattice’ ...
** package ‘lattice’ successfully unpacked and MD5 sums checked
Error : Invalid DESCRIPTION file
Invalid Priority field.
Packages with priorities 'base' or 'recommended' or 'defunct-base' must
already be known to R.
See the information on DESCRIPTION files in section 'Creating R
packages' of the 'Writing R Extensions' manual.
ERROR: installing package DESCRIPTION failed for package ‘lattice’
* removing ‘/home/me/local/anaconda/lib64/R/library/lattice’
* restoring previous ‘/home/me/local/anaconda/lib64/R/library/lattice’
The downloaded source packages are in
‘/tmp/Rtmptpj1ff/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("lattice") :
installation of package ‘lattice’ had non-zero exit status

I fixed this error by upgrading to R 3.2.

I solved this by just deleting the "Priority: recommended" line in the DESCRIPTION file

Related

Changed R 4.0.0 text encoding behaviour?

I installed R 4.0.0 and now I am unable to open packages with the library function, however installing packages work just fine. See example with ggplot2:
install.packages("ggplot2")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/axehe47/OneDrive - Linköpings universitet/Dokument/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/ggplot2_3.3.0.zip'
Content type 'application/zip' length 4015190 bytes (3.8 MB)
downloaded 3.8 MB
package ‘ggplot2’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\axehe47\AppData\Local\Temp\RtmpgbP5K2\downloaded_packages
As you can see it installed the package properly into the directory but when I try to open the package with library I get this result:
library(ggplot2)
Error: package or namespace load failed for ‘ggplot2’ in get(Info[i, 1], envir = env):
cannot open file 'C:/Users/axehe47/OneDrive - Linköpings universitet/Dokument/R/win-library/4.0/rlang/R/rlang.rdb': No such file or directory
Here the "ö" has changed to "ö" which caused a "No such file or directory" error. It seems weird to me since install.packages doesn't show the same behaviour as library.
Furthermore, in Rmarkdown "å", "ä" and "ö" has changed characters which to me seems like they changed the text encoder (or what you call it), thus I wonder if I somehow can change how R encode text characters? Or is there something I can do to change this in any R settings?
It worked R 3.6.1 so I skimmed through the update news but didn't find anything relevant, but I could easily have missed something.
(ps. I ususally use Rstudio and have the default text encoding for saving set to ISO8859-1, this is not the issue. Also, I get the same behaviour for R and Rstudio)

Trouble Installing rlang and TidyVerse

I am using RGui 3.5.1 and RStudio 1.2.5. I am trying to load Tidyverse and it gave some error message about "onload failed in loadNameSpace() for 'rlang' " so I think maybe I need to load rlang first, but I got the same error message.
I have been going around the circle for days now, tried everything suggested online, except to uninstall the R studio as we need to go through IT for it (R is in local software center which we are able to download ourselves so I did uninstall R and install it myself but its still not working).
Following advice found online,
I deleted rlang then checked on R:
library("rlang")
Error in library("rlang") : there is no package called ‘rlang’
Then I made sure the CRANExtra is removed
setRepositories()
Then I specified the library location to install
install.packages("rlang",lib="C:/Users/LIN0001/DataNow/Home/R/win-library/3.5")
trying URL 'https://mran.microsoft.com/snapshot/2018-08-01/bin/windows/contrib/3.5/rlang_0.2.1.zip'
Content type 'application/zip' length 821580 bytes (802 KB)
downloaded 802 KB
package ‘rlang’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\LIN0001\AppData\Local\Temp\RtmpigNMZO\downloaded_packages
---Then I try to load it from the same folder:
library("rlang",lib.loc="C:/Users/LIN0001/DataNow/Home/R/win-library/3.5")
Error: package or namespace load failed for ‘rlang’:
.onLoad failed in loadNamespace() for 'rlang', details:
call: dots_list(...)
error: object 'rlang_dots_list' not found
I also unticked the "use secure download method for http" of packages option in RStudio and when installing Tidyverse, I selected No instead of Yes on the pop up window (can't remember the exact message, something to do with security again); I have tried to load it both on R and Rstudio but got the same error messages.
Now I ran out of options to try so please help.
Many thanks in advance.

Error in rbind(info, getNamespaceInfo(env, "S3methods")) when installing factoextra

I'm trying to install the "factoextra" package using a local source tar ball on Windows. I can install other packages in the same way with no problem. However, when installing "factoextra", I get an error relating to S3methods.
I have tried using local windows binaries, installing the latest Rtools and made sure I have all the dependencies installed. I have also tried to use archived versions of the package.
install.packages('D:\\R_Packages\\Packages\\factoextra_1.0.5.tar.gz', repos = NULL, type="source")
* installing *source* package 'factoextra' ...
** package 'factoextra' successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
Error in rbind(info, getNamespaceInfo(env, "S3methods")) :
number of columns of matrices must match (see arg 2)
ERROR: lazy loading failed for package 'factoextra'
* removing 'D:/R-3.5.2/library/factoextra'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘D:/R_Packages/Packages/factoextra_1.0.5.tar.gz’ had non-zero exit status
I really just need this package to install.
I found this thread: http://r.789695.n4.nabble.com/Error-in-rbind-info-getNamespaceInfo-env-quot-S3methods-quot-td4755490.html, which leads me to how I solved a similar issue on my machine.
I found that a broken version of the package was installed on my system and had to be removed manually before I could install a clean version.
Find if and where factoextra is installed (it might be on your system, just outdated or broken):
find.package("factoextra")
If it's there already (just broken), you can try to remove it with:
remove.packages("factoextra")
If remove.packages() fails even though find.packages() says the package is there, use the path returned by find.packages() to use your OS' file system to find and delete the package - just be careful only to delete stuff you know is broken.
Once the old, broken package is removed, use install.packages("factoextra") and it should work.
I had several packages that were broken in this way. If that's the case for you, you can identify which packages to remove and install this way by using something like:
allPackages <- installed.packages()[, 1]
findBrokenPackages <- function(packages) {
for (p in packages) {
tryCatch(ncol(asNamespace(p)$.__NAMESPACE__.$S3methods),
error = function(e) print(c(p, e)))
}
}
findBrokenPackages(allPackages)
This will print out any packages that have the same issue. I would suggest removing all broken packages before trying to use install.packages() again.

Failing to install Kieran Healy's 'socviz' package from github using devtools

I am trying to follow along with the online data viz resource by Kieran Healy (socviz.co), and have had minimal trouble setting things up to do so. I cannot seem to successfully install his 'socviz' package. This is the code Healy suggests:
devtools::install_github('kjhealy/socviz')
This returns:
ERROR: dependency 'rlang' is not available for package 'socviz'
* removing 'C:/Users/annem/OneDrive/Documents/R/win-library/3.4/socviz'
Installation failed: Command failed (1)
I tried removing and reinstalling 'rlang', but I still received the same error. I have also tried restarting R.
When reinstalling 'rlang', I get the following:
package ‘rlang’ successfully unpacked and MD5 sums checked
Warning in install.packages :
cannot remove prior installation of package ‘rlang’
And when trying to load:
library(rlang)
Error in library(rlang) : there is no package called ‘rlang’
I'm using R v 3.4.2 on Windows 10.
I'm relatively new to R, so if there's a seemingly obvious solution (or you think it could be solved by doing something I've already done) let me know!
It's very possible I'm making a silly mistake, but I haven't found it myself. Any help is appreciated!
Turns out the problem was in how I was removing 'rlang'. I was attempting to using remove.packages() while the package was loaded into my session. I deleted it from my machine directly, but as Tung mentioned, using the remove.packages() command works as long as it is not loaded into the current R session.
Lesson learned--thanks!

Installing xml2 in R in Fedora 27

I'm having trouble installing xml2 in RStudio, running Fedora 27. On running install.packages('xml2'), I get the following error:
installing to /home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs
** R
** inst
** preparing package for lazy loading
** help
Error : /tmp/Rtmp2sKZQZ/R.INSTALL689b37bd918d/xml2/man/read_xml.Rd:47: unable to load shared object '/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs/xml2.so':
libicui18n.so.58: cannot open shared object file: No such file or directory
ERROR: installing Rd objects failed for package ‘xml2’
* removing ‘/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2’
Warning in install.packages :
installation of package ‘xml2’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpPs5Gzi/downloaded_packages’
I noticed in my /usr/lib64/, I have libicui18n.so.57 only, so I tried copying a libicui18n.so.58 there, and I got the following error:
installing to /home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs
** R
** inst
** preparing package for lazy loading
** help
Error : /tmp/Rtmp908Ecf/R.INSTALL653812e0e41f/xml2/man/read_xml.Rd:47: unable to load shared object '/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs/xml2.so':
libicuuc.so.58: cannot open shared object file: No such file or directory
ERROR: installing Rd objects failed for package ‘xml2’
* removing ‘/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2’
Warning in install.packages :
installation of package ‘xml2’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpPs5Gzi/downloaded_packages’
And I noticed the same problem -- I have version .57, not version .58 of this library as well. Before I repeat this over and over, is this in fact a shared library problem? Or, is there a way to fix this all at once?
I have xml2 installed (libxml2-devel-2.9.5-2.fc27.x86_64) already.
Since no one answered this yet and I've found a hacky solution, I thought I'd give an update on what worked.
It appears that my issue was that, even upon installing libxml2-devel, the version of the libraries I had in /usr/lib64 were not the same version required by RStudio's xml2 package. For example, regarding the particular package being mentioned in my question above, libicuuc.so.58, only libicuuc.so.57 could be found in /usr/lib64.
Running locate libicuuc.so.58, I found that anaconda3 has the correct versions of the libraries, so I got around the above problem temporarily by simply adding ~/anaconda3/lib to $LD_LIBRARY_PATH, roughly following instructions here.
This is a bit hacky, but led to successful installation.
Edit (IMPORTANT): Adding ~/anaconda3/lib to LD_LIBRARY_PATH in .bashrc caused a login loop, presumably because Fedora was trying to use the wrong libraries. To fix this, I added the lines:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ryi/anaconda3/lib/
export LD_LIBRARY_PATH
to R_HOME/etc/ldpaths.
I have solved this problem by install the ICU4C by source:
downloading ICU4C 58.2 from: ICU-Project
compiled
added the library location to $LD_LIBRARY_PATH,
the install will be work.

Resources