Home > other >  How to Remove Conda environment in R with reticulate?
How to Remove Conda environment in R with reticulate?

Time:12-25

I installed the package tabulate in RStudio by the code from the reticulate documentation.

With the simple installation code:

library(reticulate)
py_install("tabulate")

It works perfectly except the warning message: the tabulate version is low and suggest conda update. So I try the Conda installation code:

library(reticulate)
py_install("tabulate")

# create a new environment 
conda_create("r-reticulate")

# install tabulate
conda_install("r-reticulate", "tabulate")

# import tabulate (it will be automatically discovered in "r-reticulate")
 tabulate <- import("tabulate")

It does not work; but when I switch back to the simple installation, it does not work anymore-it seems like they have to stay with Conda. I wonder if I could go back to simple installation as the very beginning? I guess I need to remove the Conda environment, but I do know how to do it. I really want to remove the Conda and go back the state before Conda installation.

CodePudding user response:

Doesn't seem to be in the documentation, but the code shows that if the conda_remove() method receives a packages=NULL argument (same as not specifying), then it will be translated to an --all argument, which would remove the entire environment.

## remove the entire 'r-reticulate' environment
conda_remove("r-reticulate")

CodePudding user response:

You can try this approach:

Remove "r-reticulate" environment:

library(reticulate)
conda_remove_env("r-reticulate")

After remove, you can install the 'tabulate' package:

library(reticulate)
py_install("tabulate")
  • Related