r-lib / remotes

Install R packages from GitHub, GitLab, Bitbucket, git, svn repositories, URLs
https://remotes.r-lib.org/
Other
330 stars 152 forks source link

Unable to install devtools #717

Closed alifarhat40 closed 10 months ago

alifarhat40 commented 2 years ago

My lab has a Ubuntu version 20.04.4 LTS (Focal Fossa) and I have spent this past week trying to install devtools to no avail. I tried so many things but cannot seem to install it. I even tried following these sudo tips among other tips but also failed. https://www.digitalocean.com/community/tutorials/how-to-install-r-packages-using-devtools-on-ubuntu-18-04

I also tried conda but that also failed: https://anaconda.org/conda-forge/r-devtools

Has anyone faced something similar and can help me please?

sudo apt-get install libcurl4-openssl-dev libssl-dev

which outputs the following:

sudo apt-get install libcurl4-openssl-dev libssl-dev Reading package lists... Done Building dependency tree Reading state information... Done libcurl4-openssl-dev is already the newest version (7.68.0-1ubuntu2.12). libssl-dev is already the newest version (1.1.1f-1ubuntu2.16). 0 upgraded, 0 newly installed, 0 to remove and 16 not upgraded.

Did you post your log file? If not, add it now. added below

if (!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools") Installing package into ‘/usr/local/lib/R/site-library’ (as ‘lib’ is unspecified) also installing the dependencies ‘zip’, ‘gert’, ‘usethis’

trying URL https://cloud.r-project.org/src/contrib/zip_2.2.0.tar.gz Content type 'application/x-gzip' length 114391 bytes (111 KB) downloaded 111 KB

trying URL https://cloud.r-project.org/src/contrib/gert_1.7.0.tar.gz Content type 'application/x-gzip' length 118288 bytes (115 KB) downloaded 115 KB

trying URL https://cloud.r-project.org/src/contrib/usethis_2.1.6.tar.gz Content type 'application/x-gzip' length 342349 bytes (334 KB) downloaded 334 KB

trying URL 'https://cloud.r-project.org/src/contrib/devtools_2.4.4.tar.gz' Content type 'application/x-gzip' length 374492 bytes (365 KB) downloaded 365 KB

ERROR: failed to lock directory ‘/usr/local/lib/R/site-library’ for modifying Try removing ‘/usr/local/lib/R/site-library/00LOCK-zip’ ERROR: dependency ‘zip’ is not available for package ‘gert’

removing ‘/usr/local/lib/R/site-library/gert’ ERROR: dependency ‘gert’ is not available for package ‘usethis’ removing ‘/usr/local/lib/R/site-library/usethis’ ERROR: dependency ‘usethis’ is not available for package ‘devtools’ removing ‘/usr/local/lib/R/site-library/devtools’ The downloaded source packages are in ‘/tmp/Rtmp8Of1D0/downloaded_packages’ Warning messages: 1: In install.packages("devtools") : installation of package ‘zip’ had non-zero exit status 2: In install.packages("devtools") : installation of package ‘gert’ had non-zero exit status 3: In install.packages("devtools") : installation of package ‘usethis’ had non-zero exit status 4: In install.packages("devtools") : installation of package ‘devtools’ had non-zero exit status

gaborcsardi commented 2 years ago

Have you tried that suggestion?

mmokrejs commented 11 months ago

I managed to install older version of devtools initially 0.5 but later up to 1.13.6 on Ubuntu Bionic 18.04. Then I hit a barrier of R-3.4.4 being too old. See https://github.com/r-lib/devtools/issues/2534 for some copy&paste series of commands to the deps installed manually. Neither devtools nor remotes can keep trying installing older and older version of whatever package to eventually install one, which dependencies are fullfilled (deps are usually added over the years so you are likely to succeed with an older version also not requiring too new version of R).

remotes cannot even give you back a list of versions of a package available in source code repo which you could then use for a series of a few blind attempts like e.g.

install.packages("https://cran.r-project.org/src/contrib/Archive/somepackage/somepackage_2.1-1.tar.gz", repo=NULL, type="source")

Too static listing of versions can be passed down do repmis package, see https://www.r-bloggers.com/2013/02/installoldpackages-a-repmis-command-for-installing-old-r-package-versions/

Basically, remotes::get_package_versions('pkg1') and remotes::install_any_version('pkg1, pkg2, pkg3, ...', keep_going = TRUE) would be very helpful.

There was also an oldr package some whiel ago: https://stackoverflow.com/questions/28766923/how-to-determine-which-older-version-of-the-r-package-is-compatible-with-my-r-ve

In your particular case, you could be saved by https://eddelbuettel.github.io/r2u/ as you are using relatively recent Ubuntu 20.04 (see https://stackoverflow.com/questions/63272046/how-to-install-devtools-package-in-r-3-4-0/77104544?noredirect=1#comment135926254_77104544).

gaborcsardi commented 10 months ago

This issue is probably not relevant today, but please reopen if you still have problems.