Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save statik/85fdafeee240f5f1c8099d7c8c20bd0f to your computer and use it in GitHub Desktop.
Save statik/85fdafeee240f5f1c8099d7c8c20bd0f to your computer and use it in GitHub Desktop.
Update local renv and python cache
#Placeholder to change the name of the gist
#!/bin/bash
# Activate the existing venv
source .venv/bin/activate
# Make note of all installed packages
python -m pip freeze > requirements-freeze.txt
# Deactivate the venv and delete
deactivate
rm -rf .venv/
# Create a new virtual environment
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip wheel setuptools
python -m pip install -r requirements-freeze.txt
# snapshot renv.lock to bring it in sync with the library
renv::snapshot()
# Delete the existing libraries
unlink("renv/library", recursive=TRUE)
# Restart R session
.rs.restartR()
# Re-install libraries
renv::restore(rebuild = TRUE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment