= 10
x = x + 5
y print(y)
15
mamba create -n ml7331 python=3.9 r-base=4.4.1
mamba activate ml7331 #conda activate ml7331 etc if conda
mamba install ipykernel
python -m ipykernel install --user --name ml7331 --display-name "Python (ml7331)"
# (restart VSCode or source ~/.bashrc)
# always check nano~/.bashrc and /.bash_profile
#mamba init / conda inti - modify condarc or bashrc if need be and echo path
mamba activate ml7331
mamba install tzlocal
mamba install plotly
pip install rpy2
pip install seaborn
pip install jupyter
pip install matplotlib
pip install scipy
pip install scikit-learn
pip install pillow
pip install tensorflow
pip install notebook
pip install folium
pip install geopandas
pip install PyGithub
pip install github3.py
pip install python-gitlab
pip check
.libPaths(c("C:/Users/jessi/mambaforge/envs/ml7331/Lib/R/library", .libPaths()))
install.packages("reticulate")
install.packages('arules')
install.packages('arulesViz')
install.packages('mlbench')
install.packages("tidyverse")
install.packages("caret")
#matlab,keras,tidyr,tidyverse,dlpyr,rmarkdown,quarto,tinytex,torch & whatever else
library(arules)
library(arulesViz)
library(mlbench)
library(reticulate)
mamba env export -n ml7331 > ml7331_environment.yml
# If updated:
mamba env export -n ml7331 > ml7331_environment_updated.yml
conda clean --all
library(reticulate)
use_condaenv("ml7331", required = TRUE)
py_run_string("x = 10")
py_run_string("y = x + 5")
$x # Access the Python variable in R
py$y # Access another Python variable in R py
system("mamba install -c conda-forge r-ggplot2")
system("mamba install -c conda-forge numpy")
# Install numpy using pip
py_install("numpy", method = "pip")
<- import("tensorflow")
tensorflow print(tensorflow$__version__)
<- import("keras")
keras print(keras$__version__)
system("mamba list")
system("pip list")
= 10
x = x + 5
y print(y)
15
rpy2
is used to run R within Python (install with pip).reticulate
is used to run Python within R (install within R).library(reticulate)
use_python("C:/Users/jessi/mambaforge/envs/ml7331/python.exe", required = TRUE)
Bash:
export QUARTO_PYTHON="C:/Users/jessi/mambaforge/envs/ml7331/python.exe"
Command Prompt:
set QUARTO_PYTHON="C:/Users/jessi/mambaforge/envs/ml7331/python.exe"
R:
file.edit("~/.Renviron")
TinyTeX Installation:
::install_tinytex(bundle = 'TinyTeX-2') tinytex
Get R Path:
R.home()
Get Python Version:
python --version
import os
# Set R_HOME to the full directory path
'R_HOME'] = r'C:\Program Files\R\R-4.4.1'
os.environ[
import rpy2.robjects as ro
# Test R integration
print(ro.r('R.version.string'))
[1] "R version 4.4.1 (2024-06-14 ucrt)"
mamba install \
\
numpy=1.23.5 \
pandas=2.2.2 \
scikit-learn=1.5.1 \
matplotlib=3.9.1 \
seaborn=0.13.2 \
tensorflow=2.10.0
jupyterlab=4.2.4mamba install \
\
scipy=1.13.1 \
pytorch=2.3.1 \
torch-geometric=2.5.3 transformers=4.37.2
Using PyGithub:
#from github import Github
#g = Github("your_personal_access_token")
#user = g.get_user("Texas...(username)")
#for repo in user.get_repos():
#print(repo.name)
Using GitLab:
#import gitlab
#gl = gitlab.Gitlab('https://gitlab.com', private_token='your_private_access_token')
#projects = gl.projects.list()
#for project in projects:
#print(project.name)
mamba create -n graphlab-env python=2.7 r-base=3.6.1
mamba activate graphlab-env
mamba install anaconda rpy2 tzlocal plotly pillow
pip install tornado==4.5.3
.libPaths(c("C:/Users/jessi/mambaforge/envs/graphlab-env/Lib/R/library", .libPaths()))
install.packages("reticulate")
install.packages("ggplot2")
mamba env export -n graphlab-env > graphlab-env.yml
library(reticulate)
use_condaenv("graphlab-env", required = TRUE)
List Environments:
mamba env list
conda env list
pip check
pip list
install pip tree depd if need detailed package checks
Remove Environment:
mamba remove -n environment_name --all