This problem seems related to:
What's happening for me is:
- Install RStudio
- install.packages("reticulate")
- repl_python()
reticulate doesn't have a python to play with so asks if I want to install miniconda. Okay, seems reasonable, answer "yes".
Would you like to install Miniconda? [Y/n]: y
* 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
- Miniconda install seems to proceed okay. Up until it tries to create a venv called r-reticulate:
"C:/Users/rowlings/AppData/Local/r-miniconda/condabin/conda.bat" "create" "--yes" "--name" "r-reticulate" "python=3.8" "numpy" "--quiet" "-c" "conda-forge"
Collecting package metadata (current_repodata.json): ...working... failed
CondaSSLError: Encountered an SSL error. Most likely a certificate verification issue.
Exception: HTTPSConnectionPool(host='conda.anaconda.org', port=443): Max retries exceeded with url: /conda-forge/win-64/current_repodata.json (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
Error: Error creating conda environment 'r-reticulate' [exit code 1]
Further attempts to run a repl produce the same creation effort and fail:
> repl_python()
+ "C:/Users/rowlings/AppData/Local/r-miniconda/condabin/conda.bat" "create" "--yes" "--prefix" "C:/Users/rowlings/AppData/Local/r-miniconda/envs/r-reticulate" "python=3.8" "numpy" "--quiet" "-c" "conda-forge"
Collecting package metadata (current_repodata.json): ...working... failed
CondaSSLError: Encountered an SSL error. Most likely a certificate verification issue.
Exception: HTTPSConnectionPool(host='conda.anaconda.org', port=443): Max retries exceeded with url: /conda-forge/win-64/current_repodata.json (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
Error: Error creating conda environment 'C:/Users/rowlings/AppData/Local/r-miniconda/envs/r-reticulate' [exit code 1]
So R can't create a venv because of some OpenSSL error.
Now I go to the Anaconda shell prompt created by R's install of miniconda, and try the same command there - and it works:
(base) PS C:\> C:/Users/rowlings/AppData/Local/r-miniconda/condabin/conda.bat create --yes --prefix C:/Users/rowlings/AppData/Local/r-miniconda/envs/r-reticulate python=3.8 numpy --quiet -c conda-forge
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done
[etc etc[
.... done
So now I've got a working venv where repl_python expects it! Great. So now repl_python() works.
But if I try anything with conda_install() in R, I get OpenSSL fails:
> conda_install(package="foobarbaz")
+ "C:/Users/rowlings/AppData/Local/r-miniconda/condabin/conda.bat" "install" "--yes" "--name" "r-reticulate" "-c" "conda-forge" "foobarbaz"
Collecting package metadata (current_repodata.json): ...working... failed
CondaSSLError: OpenSSL appears to be unavailable on this machine. OpenSSL is required to
download and install packages.
Exception: HTTPSConnectionPool(host='repo.anaconda.com', port=443): Max retries exceeded with url: /pkgs/main/win-64/current_repodata.json (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
Error: one or more Python packages failed to install [error code 1]
But conda install
works fine from the Anaconda powershell prompt.
This is on a Windows VM with Sys.info():
> Sys.info()
sysname release version nodename machine
"Windows" "10 x64" "build 19044" "VDI-W10LAB-062" "x86-64"
login user effective_user
"rowlings" "rowlings" "rowlings"
but it happens on student machines with Windows 11 and up-to-date installs of everything.
So now I've got a half-working reticulate installation - at least it can parse code and run a repl - but to install packages the user has to drop out to the anaconda shell then install the package to the relevant venv, then back to R. This isn't right....
Any ideas anyone? I'm out of them after two days digging into this.