Trouble installing and loading "mlrMBO" package in R - r

So when I install the package, R returns the following error message:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘mlrMBO’
But It then says the package has non-zero exit status and is in
‘/private/var/folders/b_/xwf1w6cn769_2gq06fntysxm0000gn/T/RtmpCGAr62/downloaded_packages’
When I load the package
library(mlrMBO)
It says the package doesn't exist.
I've tried many different methods like using this code
install.packages('mlr', repo='http://cran.fiocruz.br/')

Here's a couple of things you could try:
Make sure you don't have any Umlauts (ö,ä,ü, å) in your path, i.e. your User-folder, if you're running on windows.
Install devtools install.package("devtools)
clear data in \AppData\Local\Temp\

That package requires compiling C code, for which you have to install the Xcode developer tools.
Per Housemd's answer at Apple.SE:
Open Terminal, and run the following:
xcode-select --install
This will download and install xcode developer tools and fix the problem. The problem is that one needs to explicitly agree to the license agreement.
I found the solution in this question, Command Line Tools not working.
Once you've done that, run install.packages again.

Related

RStudio - Not able to install packages after reinstallation of R & constant working directory issues

I recently had to have a new laptop build at work and therefore reinstalled R and R Studio through a designated 'Company Portal' that did the software installation for me (this might be the problem). When now trying to install and load packages for use, I am running in to the below error for packages (in this case for tidyverse):
Warning message: In options(stringsAsFactors = TRUE) :
'options(stringsAsFactors = TRUE)' is deprecated and will be
disabled Error in setwd("C:/R/WorkingDir") : cannot change working
directory Execution halted Warning in install.packages :
installation of package ‘tidyselect’ had non-zero exit status
I also had this error when I first loaded R up that seems to be reappearing due any attempt to install packages:
Error in setwd("C:/R/WorkingDir") :
cannot change working directory
I've never had this issue before using RStudio across numerous machines and software versions, can anyone advise what is going on? My name (and thus C:\ user file path(s)) does have an apostrophe in it, if that matters - but it has never been an issue before. Is some key installation setting now misaligned and if yes, can anyone advise how to resolve?

Can not install processr and procesR on Windows

Following this question, I am trying to install the package (running R64 as admin on Windows):
devtools::install_github("markhwhiteii/processr")
or
devtools::install_github("cardiomoon/processR")
However, I get the error message:
Error: Failed to install 'processr' from GitHub:
(converted from warning) cannot remove prior installation of package 'digest'
no matter which update option I select. Running the command .libPaths() I found the packages installation folder C:/Program Files/R/R-3.6.2/library and manually deleted the digest package and reinstalled it with package.install("digest"). But I still get the same error! I would appreciate it if you could help me understand what is the problem and how I can resolve it.
The simplest solution is to say no when install_github asks if it should replace digest.
If it still fails for some reason (and I can't see why; neither package requires a specific version of digest and you've reinstalled it in any case), then the problem is that devtools itself uses digest, so it can't be removed as long as devtools is loaded. So you can't use install_github.
You have a couple of options:
Clone the repo, then from the command line, run R CMD INSTALL . in that directory. Note that you'll need to insert the path to your R executable.
Install from the GitHub archive of the master branch: install.packages("https://github.com/markhwhiteii/processr/archive/master.tar.gz")
The steps to install the markhwhiteii/processr package:
install.packages("devtools")
library(devtools)
install.packages("https://github.com/markhwhiteii/processr/archive/master.tar.gz")
for testing the instalation:
library(processr)
processr::model1
Sent a PR on the GitHub repo.
and if you want to run R in the Jupyter environment just follow the instructions to install and regsiter the kernel:
install.packages('IRkernel')
IRkernel::installspec()

Unable to install 'cli' package from GitHub repository using remotes::install_github()

I had recently posted a question about a unicode display issue linked here. The problem then was the 'cli' package bug in the version cli v2.0.0. This bug had been brought up and has been solved on the master branch on GitHub by the developer. I am trying to install the same using remotes::install_github("r-lib/cli"). RStudio connects to GitHub fine, downloads the package, begins installing it, goes onto the step for building the package and then returns an error. The error message is copied below:
Error: (converted from warning) Setting LC_CTYPE failed, using "C"
Execution halted
Error: Failed to install 'cli' from GitHub:
(converted from warning) installation of package '/var/folders/n0/__v02y5j02sby1w2_39185sh0000gn/T//Rtmp5HnvTL/file865408954cc/cli_2.0.0.9000.tar.gz' had non-zero exit status
Session information:
R version 3.6.1
macOS Catalina
Steps taken to solve the problem:
1.Have tried using the 'devtools' package to do the same; Same error message
2.Have reinstalled the Xcode developer tools on the system
3.Tried removing and reinstalling 'cli'. I can install from CRAN with the same bug in it; still cannot install from GitHub repo.
Any thoughts would be appreciated.
The same commands worked when I ran them in R console through terminal as superuser (sudo R from terminal). The packages compiled properly and installed.
Two pages which helped are linked below:
[Installing a package inside RStudio fails on macOS Catalina
[https://support.rstudio.com/hc/en-us/articles/200554786-Problem-Installing-Packages]

make not found when using dynr [duplicate]

The R Package ConvCalendar is not on Cran repository anymore (see here).
However, because I have intensively used this package for previous projects, it would be nice to have it installed on my machine, even an older version would suffice.
(Windows 10 environment)
In the link above it is possible to download older versions of ConvCalendar from the archive. I thus did it, and tried installing it by running (having devtools also installed and loaded):
install.packages("ConvCalendar_1.2.tar.gz", repos=NULL, type="source")
However, I get the following error message:
> install.packages("ConvCalendar_1.0.tar.gz", repos=NULL, type="source")
Installing package into ‘C:/Users/myname/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
* installing *source* package 'ConvCalendar' ...
** libs
*** arch - i386
Warning in system(cmd) : 'make' not found
ERROR: compilation failed for package 'ConvCalendar'
* removing 'C:/Users/myname/Documents/R/win-library/3.5/ConvCalendar'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘ConvCalendar_1.2.tar.gz’ had non-zero exit status
Looking for a solution to this problem.
what do you need is to update the Rtool, here is the link I had the same issue before once you update it will work.
Reinstall Rtools, Please check the below link to figure out the right version of Rtools.
https://cran.r-project.org/bin/windows/Rtools/history.html
'make' not found is a pretty clear cut message on what's the issue, and as noted here and elsewhere it is caused by Rterm not knowing where to find it (unlike other tools like RStudio, base R is completely clueless about the Windows registry value where the Rtools path gets set by default).
Up to Rtools 3.5 this could be neatly avoided with a checkbox in the installer (which took care of adding the right directory to PATH), but newer versions dropped it. Presumably to focus on the RTOOLS_HOME variable (which is far more independent and resilient to whatever else you may have installed on your system), if just so it wasn't that until R 4.2 nothing really cared for it in the code.
On top of that, it's only since Rtools 4.0 (maybe because they updated the old MSYS2/Cygwin environment, or maybe it was something in the accompanying R 4.0?) that you can use long filenames with spaces to point to the folder containing make. Also, hopefully you haven't been manually setting BINPREF anywhere.
TL;DR: just add something like "C:\rtools40\usr\bin" (or whatever you have) to your PATH.
Building on #mirh's answer.
I had installed Rtools 4.0 in the in "C:\rtools" on windows and had the "'make' not found" issue (I also had a warning that RTools was not found). I could not change the PATH through the traditional route though because I was missing admin rights. The following helped:
Add to your .RProfile the line:
Sys.setenv(PATH = paste0(Sys.getenv("PATH"), ";C:\\rtools40\\usr\\bin"))
This will change the path from within R for the current session. You might have to alter it if you have a different version of RTools or a different installation directory.
After this I can install from source and I don't get the RTools warning anymore.

Error Installing package from github with devtools

Trying to install the lego package from Github on Windows in R version 3.1.1 gives the following error:
Error in set(new) : cannot change working directory.
I can verify that Rtools in installed fine and find_rtools() returns TRUE. The debug information indicates it find it in the right location.
This error is caused by wrong command.
The standard command for change working director is setwd(new)

Resources