Error – cannot install Miniconda with RStudio

Question:

I have written a R script where I use some python lines through the reticulate package.
I need to share it with some colleagues who don’t know about programming and I’ve created a batch file so I can run it without them even opening R.

However, I tried using the install_miniconda() function to silently install python to run the code without them knowing (I guess people are reluctant to installing a couple of programs) but R throws an error:

> reticulate::install_miniconda(path="C:/")
# * Installing Miniconda -- please wait a moment ...
# * Downloading "https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe" ...
# trying URL 'https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe'
# Content type 'application/octet-stream' length 74687656 bytes (71.2 MB)
# downloaded 71.2 MB

# Error: Miniconda installation failed [unknown reason]

I tried without passing any path but my computer user has spaces on it so I cannot use it, that’s why I resorted to supplying it with the root path "C:/"

Can someone help me understand what is happening?

Note: I am using R 4.2.1 on Windows 11 (also tried on Windows 10 with the same result)

Asked By: wernor

||

Answers:

Try installing rminiconda from the github like this:

remotes::install_github("hafen/rminiconda")
rminiconda::install_miniconda(name='your_name')

After that you can specify the installation using reticulate like this:

py <- rminiconda::find_miniconda_python("your_name")
reticulate::use_python(py, required = TRUE)
Answered By: Quinten