reticulate and OpenSSL problem

This problem seems related to:

What's happening for me is:

  1. Install RStudio
  2. install.packages("reticulate")
  3. 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
  1. 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.

For anyone who hits this, its a problem with reticulate that has been fixed in the github version but not pushed to CRAN as of 2022-11-17. Discussion here: Urgent! How can i install miniconda under R environment by using reticulate? · Issue #1297 · rstudio/reticulate · GitHub

Installing from github version should fix it...

1 Like

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.