Forked from samcofer/0-rebuild-cache-information-after-os-upgrade.txt
Created
February 14, 2025 19:49
-
-
Save statik/85fdafeee240f5f1c8099d7c8c20bd0f to your computer and use it in GitHub Desktop.
Update local renv and python cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Placeholder to change the name of the gist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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