Skip to content

Instantly share code, notes, and snippets.

@jlomako
Created October 26, 2022 15:38
Show Gist options
  • Save jlomako/b3d273a9fa1f0ac559d221a27a772fea to your computer and use it in GitHub Desktop.
Save jlomako/b3d273a9fa1f0ac559d221a27a772fea to your computer and use it in GitHub Desktop.
create python environment in R Studio for ML class
# Set up environment for Python in R Studio
# install.packages("reticulate") # run only once
library(reticulate)
# create python environment
conda_create(envname = "mlclass", python_version = "3.9")
use_condaenv("mlclass")
# install packages
py_install(packages = c("numpy", "matplotlib", "pandas", "scikit-learn"))
# now open python script in R studio and execute commands from there
# alternatively run python script from file:
source_python("script.py")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment